BASIC stamp manual v2.2

PULSOUT – BASIC Stamp Command Reference
Page 348 BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com
Figure 5.29b shows the sequence of events on that pin. Initially, pin 7 is
high. Its output driver is turned off (because it is in input mode), so the 10
k resistor sets the state on the pin. When PULSOUT executes, it turns on
the output driver, allowing OUT7 (PIN7 on the BS1) to control the pin.
Vdd
10 k
P7
O-scope
pin 7 can be connected to an
oscilloscope as shown to
view the results shown on
the right
(instruction
executes)
PULSOUT 7,5
positive pulse
pin 7 in input mode
(DIR7 = 0,
OUT7 = 0)
but held high by
resistor to Vdd pin changes to
output
pin left as
output - low
(DIR7 = 1,
OUT7 = 0)
a. b.
Figure 5.29: Example Pulse
Diagram.
Since OUT7 (PIN7 on the BS1) is low, the pin goes low. After a few
microseconds of preparation, PULSOUT inverts the state of the pin; from
low to high. It leaves the pin in that state for the specified time (10µs if
using a BS2) and then inverts it again, leaving the pin in its original state.
Figure 5.30: LED Circuit for
PULSOUT Demo Programs.
Demo Program (PULSOUT.bs1)
' PULSOUT.bs1
' This program blinks an LED on for 25 ms at 1-second intervals. Connect an
' LED (active-low) to I/O pin 0.
' {$STAMP BS1}
' {$PBASIC 1.0}
1