ELE Times PDF 1 Nov 2016 | Page 45

Analog-to-digital switches directly into the capacitor.
The converter requires only five external components and is software and hardware configurable for conversion resolutions from 6 to 10bit, and conversion times of 250μs or longer. The method is usable for both voltage and current conversion and uses a software calibration technique that compensates for time and temperature drift, as well as component errors.
To visualise the different stages of conversion, take a look at the U1 output voltage Vo waveform shown in Fig 2.
Fig. 4: Equivalent circuit during measurement
Fig. 2: Operational amplifier output voltage waveform
At t0-t1, S1 and S3 are on, S2 and S4 are off and RA0 is pulled to ground by the software. This yields the equivalent circuit in Fig. 3.
are on, S1 and S4 are off and RA0 is pulled to ground again by the software. This yields the same equivalent circuit in Fig. 3. However, Vo is equal to Vmeas since Vin is equal to Vmeas and S3 to force unity feedback. C1 is discharging from t2 to t3. At the end of t3, S2 remains on, S1 remains off, S3 is off, S4 is on and RA0 is configured as an input pin. This yields the same equivalent circuit in Fig. 4.
As a function of Vmeas, Vo is started to ramp-up linearly while C1 is charging. The Vo ramp-up continues until the Vth of the microcontroller trips. This generates a software Vmeas value equal to tmeas. This value is compared with the software calibration value to determine the actual digital representation of Vmeas.
Circuit equations
Based on the circuit operation, equations are used by the microcontroller to calculate the conversion result. In Fig. 4, the current through R1 is equal to the current through C1. When the input voltage Vin is equal to Vref, the relation between the two currents is represented as Equation 1 in Fig. 5. When Vin is equal to Vmeas, the relation between the two currents is represented
Fig. 3: Equivalent circuit during discharging
Vo is equal to Vref since Vin is equal to Vref and S3 to force unity gain feedback. C1 is discharging or is initially discharged after the reset state. In any case, this stage ensures that C1 is fully discharged before going to the next stage. At the end of t1, S1 remains on, S2 remains off, S3 is off, S4 is on and RA0 is configured as an input pin. This yields the equivalent circuit in Fig. 4.
As a function of Vref, Vo is started to ramp-up linearly while C1 is charging. The Vo ramp-up continues until the threshold voltage input Vth of the microcontroller trips. This generates a software calibration value equal to tref.
This calibration value is measured and used to calibrate out most circuit errors, including inaccuracies in the resistor and capacitor, changes in the Vth, and temperature variation.
After the software calibration value is measured at t2, S2 and S3
Fig. 5: Analogue-to-digital conversion equations
ELE Times | 45 | November, 2016