derrick826 said:hi again, i have tried the codings and it works fine but it seems that the accuracy of 10bit- digital outputs on the LEDs after conversion when compare using the formula:
actual analogue voltage = [digital values in 10 bit (decimal)] * (5v/1023)
is kinda out...
for example: when i input 4.78v into RA0 it gives me 1111111111 (all leds light up)
when i input 0.02v into RA0 it gives me 0000000001 (first led light up)
but according to the formula which i mentioned, the first LED will light up which represent 1 bit if 4.8mv is being applied:
4.8mv = 1* (5/1023)
is there any method which I can do to improve its accuracy from my codings?
hi,
Assuming your supply is +5.0V and your Vref is the same,then
ADC value/bit = 5/1023 = 4.887mVolt
So ADC value,, 0.02/5 * 1023 =4.092 = 0x04 = 00,0000,0100
And 4.78/5 *1023 =977.98 = 0x3D1= 11,1101,0001
It appears the conversion of the ADC is wrong.
This could be due to.
Too high an input impedance that the ADC inout 'sees',,[ keep to =< 4K7 as posted earlier] will cause inaccurate readings,
also ensure that your program meets the ADC acquisition times.
Check the +5V supply and of course you DVM accuracy,