I would like to use the on board A/D on the 18F452 to read a battery voltage through a voltage divider on RA0, RA1, RA2, RA3, and RA5, can anyone please help me set up the ADCON1?
Many Thanks,
Regards,
Gavo
I would like to use the on board A/D on the 18F452 to read a battery voltage through a voltage divider on RA0, RA1, RA2, RA3, and RA5, can anyone please help me set up the ADCON1?
Many Thanks,
Regards,
Gavo
The datasheet would be a really good place to find out.
But...
ADCON0 = %01000001 ; A/D converter ON, CLK = FOSC/16
ADCON1 = %11001010 ; Right justified, /16, AN0,AN1,AN2,AN4,AN5 as inputs, Vref into AN3
OR
ADCON1 = %11001001 ; Right justified,/16, AN1,AN2,AN3,AN4,AN5 as inputs, Vref = VDD
Will probably work.
Charles Linquist
Bookmarks