Analog-to-digital
as Equation 2 in Fig. 5.
Integrating Equations 1 and 2 yields the results shown in
Equations 3 and 4. Since Vref and Vmeas have constant input,
Equations 3 and 4 can be further reduced to Equations 5 and 6. At
the end of each measurement, Vo of Equations 5 and 6 are both
equal to Vth. Therefore, equating both equations yields Equation
7. Here, R1 and C1 can be eliminated and solved for Vmeas, the
unknown input voltage.
In Equation 8, it is apparent that the measurement is
independent of the value of circuit elements R1 and C1. This
makes the conversion insensitive to errors in the R1 and C1 value,
due to the inaccuracy or temperature variation. However, this
does not mean that the values of R1 and C1 are unimportant in
the design of the A-D converter. The values of R1 and C1 should
be selected based upon the number of bits of resolution. Looking
back at Equation 6 and solving R1C1 you get Equation 9 in Fig. 6.
Fig. 6: Calculation of R1C1 value
The actual value for R1C1 should be slightly smaller than
calculated to ensure that the PIC16F5X microcontroller does not
over count during the measurement. It should be noted that
there will be a difference between the R1C1 value when
implementing in Assembly and C because the instruction cycles
per count when using C are greater than in Assembly.
Circuit performance
In actual applications, if measurement accuracy permits, it may
be advantageous to use lower resolution bits and higher clock
source. The maths code can be largely reduced and the measure
time is reduced by the simpler code and shorter count.
The calibration value removes all first order errors (offset, gain, R
and C inaccuracy, power supply voltage and temperature) except
the reference voltage drift. Any change in the reference voltage,
including noise, may result in measurement errors. Other error
sources may be analogue switch leakage, resistor and capacitor
non-linearities, input threshold uncertainty and time
measurement uncertainty (plus or minus one instruction cycle
time). Measured performance shows the
converter to be accurate within 1% of full
scale.
Conclusion
For a simple and low bandwidth analogue
application, it usually requires a low cost yet
high resolution A-D converter. By using the
PIC16F5X baseline family of microcontrollers,
this article has demonstrated how to meet
such requirements. The A-D converter does not only use fewer
components but also has a capability to calibrate out most circuit
errors.
If we can’t see you...
neither can your customers
build your presence, your brand, your business
ELE Times | 46 | November, 2016