Quote Originally Posted by earltyso View Post
Hello,
I want to set up 4 of the 13 availiable A2D converter pins on my 18F4620. Can someone clarrify for me......
If I want to set up AN0, AN1, AN4 & AN12 (8 bit resolution only) and leave every other pin on PORTA & B as digital input/ouputs.....
will this do the trick?
ADCON1.0=0
ADCON1.1=0
ADCON1.4=0
ADCON1.12=0
'tristates will already be defined above
Nope, doesn't work that way.
You can only have the analog ports the way the datasheet for the 18F4620 shows in DS39626B, page 224, under the heading Register 19-2.
As you'll see, ADCON only has 8 bits. ADCON1.12...not enough bits in ADCON for that.
Basically, you have to start at AN0 and add AN1, then AN2, then AN3, and so on until you get enough analog ports.