Issue
133 August 2001
MSP430 News Flash:
Recognizing
the Flexibility of Reprogramming
Start
MSP430F1121 Comparatively
Speaking Battery Monitor
Dynamic Inputs RC
To The Rescue E(OR I)IN
It's Only The Beginning
Sources & PDF
E(ORI)IN
To actually measure a voltage (or current), the method
is similar, however because you are not dealing with full-time
constants, the terms do not cancel out (see Figure 5).
In this instance, Ill be comparing the discharge
reference time (VCC to 0.25 VCC) with the time it takes
the capacitor to discharge to the unknown voltage (VCC
to VIN). For VIN greater than 0.25 VCC and less then VCC,
the formula would be,

[7]
Where

[8]
tm = discharge time of the unknown voltage (VCC to VIN)
in counts
tvcc = discharge time of the reference (VCC to 0.25 VCC)
in counts
| Figure
5When adding a capacitive sensor,
the R and C change position. In this case the reference
C value is the close tolerance device, as the R will
cancel out of each equation. |
If you used the same counts as in the previous example
(reference 46683 and sensor 24003), youd have

[9]
VIN would discharge from VCC to VIN (1.42 V) in 24003
counts. Figure 6 shows an R*C discharge curve with the
x axis in time constants (counts) and the y axis in volts.
| Figure
6This typical logarithmic RC
discharge cycle (five tcs) shows the reference RC
discharging to 0.25 VCC and its associated timer
count. The same reference RC is also shown discharging
to VIN. Its timer count is used to determine VIN
(which is also shown here as ~1.4 V). |
If VIN can fall below 0.25 VCC, youll need to use
a charging cycle because the discharge cycle is referenced
from VCC down to 0.25 VCC. Using the charging cycle, the
reference count is the charge time from Gnd to 0.5 VCC.
The measurement cycle is the charge time from Gnd to VIN.
The formula here is much the same as the discharge cycle,

[10]
Where

[11]
In both instances VIN can be reduced with a resistor voltage
divider at the input if necessary to bring the voltage
at the input pin to within the input specifications (use
discharging for VCC > VIN > 0.25VCC, use charging
for 0.5 VCC > VIN > Gnd).