Thanks ^^^
I am doing the same register setups as you show, except that I'm using AN2 (ANSELA=%0100, TRISA=%01100). In addition I have ADCON0.0=1 (enable ADC). I'll try removing this. I'll work on this and post my results.
Thanks again!
Thanks ^^^
I am doing the same register setups as you show, except that I'm using AN2 (ANSELA=%0100, TRISA=%01100). In addition I have ADCON0.0=1 (enable ADC). I'll try removing this. I'll work on this and post my results.
Thanks again!
ADCON0.0=1 serves no purpose the ADCIN code will do that for you
This may be obvious but since you didn't post your code I'll say it anyway.
The variable you're putting the result in is declared as a WORD, right?
/Henrik.
looks like "Occam's Razor" may have struck again
Not sure if you figured this out, but 10bit AD need to be read out as RIGHT justified, and 8 bit reads should be LEFT justified. Here's a config that works for 8-bit:
ADCON0.0 = 1 ' AD ON
ANSELA = %00000001 ' select analog vs digital (1=analog)
ADCON1.7 = 1 ' bit7 = 1 = LEFT justified
define adc_bits 8 ' set ADC as 8 bit
"Do or do not, there is no try" Yoda
Thank you^^^. Yes, I got it sorted out. I think my initial confusion resulted from some interaction between PBP3 DEFINEs for the ADC module and some direct settings I was also doing on some ADC-related registers. Everythings good now. Thanks again!
Last edited by swr999; - 31st October 2014 at 00:08.
Bookmarks