CHAN0 = 193
Would also work.
Take a look at this from the data sheet.
When using 8 bit ADC we are after the MSB from ADRESH.
If we want 10 bit ADC we would grab a couple extra bits from ADRESL.
So you are on the right track.
Here is a snippet from something doing 10 bit.
TC is a WORD size VAR
Code:getT2: ADCON0= %00000101 '$5 '%00000101 AN1 ADCON2.7 = 1 gosub getAD TC.highbyte = ADRESH TC.lowbyte = ADRESL return getAD: pause 50 WHILE ADCON0.1=1:WEND return






Bookmarks