ADC ISSUES

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

ADC ISSUES

Post by siliconchip »

Hi all
ive been playing with ADC and ive used a potential divider (2 10k resistors in series) connected to AN0 of my chip Pic 16f1825, potential divider is connected to the circuits 5v supply, as i expected the display shows 2.5v, but if i alter the circuits 5v supply the lcd stays steady at 2.50v, however if i connect a potentiometer to the analogue input the reading goes from 0v to 5v just as in simulation, i thought by altering the voltage supply this would have affected the reading on the divider but it doesnt, what am i missing, is it a case of re-writing the calculation using the resistor values, :oops:

regards bob
Attachments
BATTERY GAUGE.fcfx
(10.72 KiB) Downloaded 165 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: ADC ISSUES

Post by kersing »

By changing the supply voltage you change the reference voltage used by the pic and the voltage over the divider. Both drop by the same percentage. You need a stable reference voltage to be able to see any change.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: ADC ISSUES

Post by siliconchip »

Hi kersing
Thanks for the reply, i just tried using the internal reference voltage and set the FVRCON as well as changing the pots property to FVR rather than VDD but no joy ive either set it wrong or this is not suitable ??

Bob

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: ADC ISSUES

Post by kersing »

Check viewtopic.php?f=7&t=22569&p=104899&hilit=1.024#p104899 as an example on how to do this. You need to make sure your controller has a real stable reference voltage and not something that depends on voltage powering it. Should be easy recognizable by the voltage limits listed in datasheet (like the Vd >= 2.5V in the example).
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: ADC ISSUES

Post by siliconchip »

hi all
ive set up the FVRCON register as well as ADCON1 to try and get this working, ive trolled through the data sheet to try to get this right but no joy, can anyone point me in the right direction on how to set the FVR function up correctly please

bob
Attachments
BATTERY GAUGE.fcfx
(10.9 KiB) Downloaded 162 times

Post Reply