Specifications
BASIC Stamp II
Parallax, Inc. • BASIC Stamp Programming Manual 1.8 • Page 291
2
Pulsout
PULSOUT
pin, time
Output a pulse of 2µs to 131 ms in duration.
•
Pin
is a variable/constant (0-15) that specifies the I/O pin to use.
This pin will be placed into output mode immediately before the
pulse and left in that state after the instruction finishes.
•
Time
is a variable/constant (0-65535) that specifies the duration
of the pulse in 2µs units.
Explanation
Pulsout combines several actions into a single instruction. It puts the
specified pin into output mode by writing a 1 to the corresponding bit
of DIRS; inverts the state of that pin’s OUTS bit; waits for the specified
number of 2µs units; then inverts the corresponding bit of OUTS again,
returning the bit to its original state. An example:
PULSOUT 5,50 ' Make a 100-us pulse on pin 5.
The polarity of the pulse depends on the state of the pin’s OUTS bit
when the instruction executes. In the example above, if OUT5 = 0, then
Pulsout 5,50 produces a 100µs positive pulse. If the pin is an input, the
OUTS bit won’t necessarily match the state of the pin. What does
Pulsout do then? Example: pin 7 is an input (DIR7 = 0) and pulled high
by a resistor as shown in figure I-10a. Suppose that OUT7 is 0 when we
execute the instruction:
PULSOUT 7,5 ' 10-us pulse on pin 7.
Figure I-10b shows the sequence of events as they would look on an
oscilloscope. Initially, pin 7 is high. Its output driver is turned off (be-
cause it is in input mode), so the 10k resistor sets the state on the pin.
When Pulsout executes, it turns on the output driver, allowing OUT7
to control the pin. Since OUT7 is low, the pin goes low. After a few
microseconds of preparation, Pulsout inverts OUT7. It leaves OUT7 in
that state for 10µs, then inverts it again, leaving OUT7 in its original
state.
This sequence of events is different from the original Basic Stamp I.
The Basic Stamp I does not have separate INS and OUTS registers;










