EasyManua.ls Logo

Parallax BASIC Stamp 2e - Page 259

Default Icon
353 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
5: BASIC Stamp Command Reference RCTIME
BASIC Stamp Programming Manual 2.0c www.parallaxinc.com Page 257
value called the RC time constant, or tau (
τ) for short. Tau represents the
time required for a given RC combination to charge or discharge by 63
percent of the total change in voltage that they will undergo. More
importantly, the value
τ is used in the generalized RC timing calculation.
Tau’s formula is just R multiplied by C:
τ = R x C
The general RC timing formula uses
τ to tell us the time required for an
RC circuit to change from one voltage to another:
time = -
τ * ( ln (V
final
/ V
initial
) )
In this formula ln is the natural logarithm; it’s a key on most scientific
calculators. Let’s do some math. Assume we’re interested in a 10 k
resistor and 0.1 µF cap. Calculate
τ:
τ = (10 x 10
3
) x (0.1 x 10
-6
) = 1 x 10
-3
The RC time constant is 1 x 10
-3
or 1 millisecond. Now calculate the time
required for this RC circuit to go from 5V to 1.5V (as in Figure 5.29a):
Time = -1 x 10
-3
* ( ln(5.0v / 1.5v) ) = 1.204 x 10
-3
On the BS2, the unit of time is 2µs (See Table 5.66), that time (1.204 x 10
-3
)
works out to 602 units. With a 10 k resistor and 0.1 µF cap, RCTIME would
return a value of approximately 600. Since V
initial
and V
final
doesn't change,
we can use a simplified rule of thumb to estimate RCTIME results for
circuits like 5.29a:
RCTIME units = 600 x R (in k
) x C (in µF)
Another handy rule of thumb can help you calculate how long to
charge/discharge the capacitor before RCTIME. In the example above
that’s the purpose of the HIGH and PAUSE commands. A given RC
charges or discharges 98 percent of the way in 4 time constants (4 x R x C).
In Figure 5.29, the charge/discharge current passes through the 220
series resistor and the capacitor. So if the capacitor were 0.1 µF, the
minimum charge/discharge time should be:
CALCULATING CHARGE AND
DISCHARGE TIME
.
T
HE RC TIME EQUATION.
D
ETERMINING HOW LONG TO CHARGE
OR DISCHARGE THE CAPACITOR
BEFORE EXECUTING
RCTIME.

Table of Contents

Related product manuals