Yes this is correct! Also note that if you want ADC1 as an analogue port and ADC0 as a digital this is not possible at the same time unless you turn off the analogue stuff (PIC16C7710 and 12xxxx) Dennis > -----Original Message----- > From: Tony Nixon [SMTP:Tony.Nixon@ENG.MONASH.EDU.AU] > Sent: Wednesday, 30 August 2000 9:13 > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: Gotcha - A2D pins > > Hi all, > > This may be a gotcha for the unwary - well, it got me anyway. > > I thought setting A2D pins as outputs, like RA0 etc, would override the > A2D function of the pins, but this does not seem to be the case on the F > series. > > I couldn't figure out why these instructions were not toggling bit 0 > when I was testing some software on a 16F873 that I knew had worked > previouly on a 16C74. > > movlw 01h > xorwf PORTA << PORTA always = 1 > > After my hair turned a lighter shade of grey, it turned out to be the > ADCON1 setting. > > > Example: [16F873] ADCON1 = default = A2D pins enabled > > set TRISA = 00h > set PORTA = FFh > > read PORTA = 00h > > I would have thought 2Fh, but not so. > However, it does work on a C74 that I have. > > > Example: [16F873] ADCON1 = 07h = all digital IO > > set TRISA = 00h > set PORTA = 02h > > read PORTA = 02h > > As expected on both chips. > > > This may be a trap for Read/Modify/Write type instructions as it will > read all 0's and write them back to the port along with the modified > bit. > > I suppose the bummer is when you have mixed A2D and digital pins set, > and because of the limited A2D configurations from ADCON1, that you must > have some analog pins set as digital outputs. > > > -- > Best regards > > Tony > > ICmicro's > http://www.picnpoke.com > mailto:sales@picnpoke.com > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu