Page 1 of 1

ADC ISSUES

Posted: Thu Feb 04, 2021 8:04 pm
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

Re: ADC ISSUES

Posted: Thu Feb 04, 2021 8:23 pm
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.

Re: ADC ISSUES

Posted: Thu Feb 04, 2021 8:42 pm
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

Re: ADC ISSUES

Posted: Thu Feb 04, 2021 9:53 pm
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).

Re: ADC ISSUES

Posted: Fri Feb 05, 2021 12:00 pm
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