circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 133 August 2001
MSP430 News Flash:

Recognizing the Flexibility of Reprogramming


by Jeff Bachiochi

Start MSP430F1121Comparatively Speaking Battery MonitorDynamic Inputs RC To The RescueE(OR I)IN It's Only The BeginningSources & 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, I’ll 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,

2108002-e7.gif (742 bytes)
        [7]

Where

2108002-e8.gif (869 bytes)
    [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 5—When 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), you’d have
2108002-e9.gif (1612 bytes)


    [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 6—This 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, you’ll 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,
      
2108002-e10.gif (1152 bytes)

             
    [10]

Where
2108002-e11.gif (843 bytes)

        [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).