PDA

View Full Version : Analog input on 18f252



kiteman
- 11th January 2009, 19:41
Hi,
I need to set port RA3 (pin 5 on 18f252) in analog mode to read a level of battery.
Now I have ADCON1 = 7 (all input in digital mode)
What Value I need for ADCON0 and ADCON1 to get RA3 in analog mode only?
Thanks

Roberto

Darrel Taylor
- 11th January 2009, 22:00
There's no way to set ONLY AN3 as analog input on a 252.

The closest you can get is ADCON1 = %10000100 which sets AN0, AN1 and AN3 to analog mode.

If you can move that input to AN0, then you can set ONLY AN0 to analog mode with ADCON1 = %10001110.
<br>

kiteman
- 12th January 2009, 08:34
Thankyou so much Darrel,
I must change the wires on my pcb to set AN0 in analog input
bye



There's no way to set ONLY AN3 as analog input on a 252.

The closest you can get is ADCON1 = %10000100 which sets AN0, AN1 and AN3 to analog mode.

If you can move that input to AN0, then you can set ONLY AN0 to analog mode with ADCON1 = %10001110.
<br>