Hi,
Input let us say i apply 5 volts and i measure 4.95, can i say i am reading with accuracy of 0.05V?
There is
* accuracy
* precision
* resolution
If you want high accuracy, then I recommend to take a lot of measurements and calculate the average.
This cancels out precision errors and increases resolution (although this often is not much of benefit)
* accuracy problems are manly caused by drift (VRef, resistor drift, ADC gain drift offset drift and linearity, Opamp offset..)
* precision problems mainly are caused by noise, quatisation error (with AC signals: additionally conversion clock jitter)
*******
On a real ADC this means:
* if VRef fluctuates by x%, then the digital result will also fluctuate by x%
--> thus using VCC as VRef is not recommended
* when - because of temperature coefficient - a resistor value of a voltage divider drifts by x% , then the digital output value will also drift by x%
--> use high quality, low toleeance, low tc resistors
* when the offset voltage fluctuates (ground bounce, Opamp offset voltage drift) by x millivolts, then the digital output will also drift by x mV
--> carefully design the PCB layout, use good, low drift Opamps
* x millivolts of signal input noise (resistor noise, Opamp noise, but also coupled noise - maybe from mains or an SMPS) will cause x mV of noise at the digital output
--> use low pass filters in the signal path, use filters in analog power supply and ADC power supply, use digital filters
* offset error and gain errors (both non fluctuating) can simply calibrated by software
--> subtract offset_value from the ADC_reading and multiply the result with gain_correction to get more accurate results
You may write a simple interrupt driven ADC routine that continously reads the ADC, does simple (integer) offset correction, gain correction and noise filtering.
Store the value in a "volatile, static" variable.
Then you always have immediate (no need for waiting for ADC_conversion_complete) and simple access to clean and reliable ADC readings in the main loop. Mind to use "atomic access".
Once written this routine .... you further may forget about it ... it won't influence your other software.
Klaus