Bits 3-0 (lower nibble?) of adcon1 are the a/d port configuration control bits. Setting it to 011x means they're all digital I/O (D in the table). So adcon1 = 0x06 will correspond to 00000110 which satisfies this. (In the register 11-2 entry as pointed out by the others.) Mark On 2/16/2010 9:17 PM, Joseph Bento wrote: > I have finally enrolled in a continuing education class on midrange PICs. > We are concentrating on the 16F877A using a QL200 development board to test > our programs. > > I'm having a bit of a brain fart here in comprehending how ADCON1 is > configured. I find plenty of references online as well as my study > materials that state setting ADCON1 to 0x06 sets all PORTA (and E since I > see they have the same address) pins as digital I/O vice analog. > > I'm trying to see how or why this happens. How does setting bits 1 and 2 > (0x06) high change the I/O to digital? > > I'm looking at Table 4-2 (page 43) in the 16F877A datasheet. I am apparently > missing something in understing WHY 0x06 is used, and what I would choose if > I wanted an analog I/O. What configuration chart am I overlooking that > describes the settings? > > This is a portion of my code: (I apologize ahead of time for any formatting > issues.) > > start bsf STATUS,RP0 ;Switch to Bank1 for ADCON1 > bcf STATUS,RP1 ;Make sure in Bank1 > movlw 0x06 ;Load value to make ports A > & E digital I/O > movwf ADCON1 ;as opposed to Analog inputs > > Thanks for any clarification anyone can offer. > > Joe > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist