EasyManuals Logo

Parallax BASIC Stamp II User Manual

Default Icon
68 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #51 background imageLoading...
Page #51 background image
BASIC Stamp II Manual 0.94 • Parallax, Inc. • (916) 624-8333 • Page 51
BASIC Stamp II
RCTIME
Measure an RC charge/discharge time.
usage: RCTIME pin,state,variable
Pin will be placed in input mode and time will be measured in 2µs
units while pin is in state. The result will be written into variable. If an
overflow occurs (>131ms), 0 will be written.
This is useful for measuring resistor-capacitor charge/discharge times.
Since the logic threshold of a pin is ~1.4 volts, it is best to have the RC
voltage go from the 5V supply towards ground, yielding a span of ~3.6
volts. For example, to convert a potentiometer setting to a number:
Connect the pot as shown below. Make the pin high for 1 ms, then
do RCTIME. The resistor-cap junction will start at 5V and fall to-
wards ground. When ~1.4 is reached, the counting will terminate
and the result will be returned to variable. Adjusting the pot causes
the returned value to go up or down.
Note: the 10-ohm resistor may be necessary to avoid
a possible short between ground and the high I/O pin.
Sample Program:
Pot var word
Loop: HIGH 0 'Discharge capacitor
PAUSE 1 'Allow time for discharge
RCTIME 0,1,Pot 'Measure chrage time
DEBUG ?Pot 'Show result on PC
GOTO loop 'Repeat the process

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Parallax BASIC Stamp II and is the answer not in the manual?

Parallax BASIC Stamp II Specifications

General IconGeneral
BrandParallax
ModelBASIC Stamp II
CategoryMicrocontrollers
LanguageEnglish