In general the ADC embedded in the ST7 microcontroller is enough for most applications.
But, in some cases it is necessary to measure both positive and negative voltages. This
requires an external ADC with this particular capability. Most external ADCs require a dual
supply to be able to do this. However, microcontroller-based applications usually only have a
positive supply available.
This application note describes a technique for implementing an ADC for measuring both
positive and negative input voltages while operating from a single (positive) supply. This
converter is based on a voltage-to-time conversion technique. Like other slope converters,
this ADC also uses an integrating capacitor, but the measured time is inversely proportional
to the input voltage. An additional comparator with a voltage reference is used to improve
conversion accuracy.
As shown in the circuit diagram(Figure 1 on page 6), the converter is implemented using an
integrating capacitor, resistor, external op-amp, comparators and some microcontroller I/O
pins. The ST72F264 microcontroller is used in this application note as an example, but the
implementation is feasible using any ST7 microcontroller. The 16-bit timer of the
microcontroller measures the time using its input capture pins (PB0 and PB2). These pins
are connected to the output of the Comp1 and Comp2 comparators. The I/O pins PB1 and
PB3 are used to switch the M1 and M2 switches on or off. The circuit could also work with a
microcontroller equipped with an 8-bit timer. Only a small modification to the software would
be needed.
is the input voltage. The voltages across resistor R are the reference voltage V1 and the
in
input voltage V
op-amp. Therefore, for a given input voltage, the current flowing through resistor R is
constant. Let this current be I.
Current I charges the capacitor C, and output starts increasing in a positive direction for the
input V
<= V1 (input Vin > V1 charges in the opposite direction).
in
The output is captured at two instants using the two output comparators at voltage
references V
respectively. The final reading of time T
The input voltage is calculated from this difference through the formulae given in the circuit
analysis.
This technique can only be used where the input voltage varies slowly, otherwise the
charging of the capacitor is non-linear.
2.1 Advantage of using two comparators
. Due to the properties of the op-amp, V1 is output on the inverting pin of the
in
and V3. The time corresponding to voltage levels V2 and V3 are T2 and T3
2
is taken as the difference of T3 and T2.
m
The purpose of using the second comparator (comp2) can be understood from the diagram
below (Figure 2), which shows the relationship between the op-amp output (Amp in
Figure 1: Circuit diagram on page 6) and the time for a given input value.
Figure 2.Relationship between V
V
out
V3
V2
V1
and time for a given input
out
Point o f
uncertainty
T2
T
m
T3
Time (t)
The time is measured as the difference of the two timer readings (T3 -T2) for the same
slope. So factors like the residual voltage of the capacitor ( V
(0+)) and any other constant
c
errors (like the effect of output offset voltage) on the output side of the op-amp are
subtracted. So its performance is better than a single-slope converter.
7/37
Timing diagramAN2615
3 Timing diagram
Figure 3 shows the overall operation of the ADC. Initially the capacitor is in the reset state
(M1- on and M2- off), the op-amp output V
comparators, Comp1 and Comp2 is high.
Capacitor charging can be started by switching M1 - off and M2 - on. When the charging
starts, V
rises. When V
out
becomes greater than V2, a falling edge occurs on Comp1. This
out
causes an input capture at pin PB2 and software reads the timer value T
When V
becomes greater than V3, a falling edge occurs on Comp2. Again this causes an
out
input capture at pin PB0 and software reads the timer value T
The capacitor is discharged by switching M1 - on and M2- off. After this, the ADC can be
kept in reset condition by switching M1 - on and M2 - off or we can continue repeating the
same process and make more measurements.
Figure 3.Timing diagram
is at V1 and so, the output of both
out
2
.
3
.
V
out
V3
V2
V1
Comp1
Comp2
M1
M2
Charging
0
T2
time
T
m
Discharg.
time
T3
Settling
time
Time (t)
T
m
8/37
AN2615Circuit analysis
4 Circuit analysis
In this analysis, it is assumed that there is no noise present and the i/p offset voltage of the
op-amp is negligible.
I = (V
– Vin)/R = C * dVc/dt
1
Where, V
Applying the Laplace transform:
or,
Applying the inverse Laplace transform, we get
As shown in Figure 3: Timing diagram on page 8
So,
And,
Equation (2) and equation (3) can both be used as the characteristic equation for this
converter, but factors like Vc(0+) and other constant errors remain present. But if we use
both comparators, then we can remove these factors by subtracting equation (2) and
equation (3).
= V
c
(V
– Vin)/s * R = C * (s Vc(s) – Vc (0+))
1
(V
– Vin)/s2 = (R * C) * ( Vc (s) - Vc(0+)/s)
1
(V
– Vin) * T = (R * C) * ( Vc(t) - Vc(0+) )------------------- (1)
1
At T = T
– V1 and current ‘I’ is constant for a given input.
By using equation(5) we can measure the value of V
- T2 = Tm and we get:
3
m
9/37
------------------- (5)
depending on the value of T3 and T2.
in
V
vs time diagram for different input voltagesAN2615
out
5 V
In Figure 4, we can see the relationship between the V
voltages. From the figure, it is clear that the conversion time for a negative input voltage is
less than the time taken for a positive input voltage.
Figure 4.V
1. T
2. This ADC works for the range Vin <= V1 but if the input voltage is greater than V1 the direction of current I is
3. For negative voltage currents I, that depend on the difference V
vs time diagram for different input voltages
out
and time for different input
out
vs time for different input voltages
out
Effective time Tm = T - T’
< 0Vin =0Vin > 0
V
in
V3
V
out
V2
V1
T1’ T2’ T1 T3’T2
Time (t)
1: for Vin < 0; Tm2: for Vin = 0; and Tm3: for Vin > 0 (where Tin1 < Tin2 < Tin3)
m
inverted and the capacitor starts charging in the opposite direction and conversion never takes place.
- Vin, is high, so the charging time for
negative voltages is less than the positive voltages.
1
T3
10/37
AN2615Characteristics of different slope converters
6 Characteristics of different slope converters
6.1 Single-slope converter
Figure 5.Single-slope converter circuit diagram
C
R
-V
ref
V
INT
V
in
6.1.1 Single-slope converter timing diagram
Here Vin is directly proportional to the time measured.
Figure 6.Single-slope converter timing diagram
V
in
Time
1. Here Vin = K * T
m
The major sources of conversion errors are the correction factor for the R*C product and the
input offset voltage.
A single-slope converter requires a dual supply voltage op-amp to be able to measure the
positive and negative voltages.
11/37
Characteristics of different slope convertersAN2615
6.2 Dual-slope converter
Figure 7.Dual-slope converter circuit diagram
S0
-V
in
V
ref
S1
R
1
out
3
2
gnd
gnd
6.2.1 Dual-slope converter timing diagram
As shown in Figure 8 a dual-slope ADC has a charging phase followed by a fixed rate
discharging phase.
Figure 8.Dual-slope converter timing diagram
Charging phaseFixed-rate discharge
Vin1
V
2
in
-V
ref
-V
ref
clk
Control logic
S1S2
1
out
2
cmp
ctr
enbl
clk
clk
Counter
V
in
V
ref
=
T
charge
T
discharge
The advantage of a dual-slope ADC is that it is not dependent on the correction factor for the
R*C product. However, the input offset voltage problem still persists and this ADC also
requires a dual supply op-amp to be able to measure positive and negative voltages.
12/37
Time
Loading...
+ 25 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.