Parallax BASIC Stamp 2e Programming Manual page 246

Table of Contents

Advertisement

PULSOUT - BASIC Stamp Command Reference
10k 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
a
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.
Demo Program (PULSOUT.bas)
' This program blinks an LED on for 10ms at 1-second intervals. Connect the LED to I/O
' pin 0 as shown in the figure within the NAP command description of the manual.
'{$STAMP BS1}
HIGH 0
Again:
PULSOUT 0, 1000
PAUSE 1000
GOTO Again
Demo Program (PULSOUT.bs2)
' This program blinks an LED on for 10ms at 1-second intervals. Connect the LED to I/O
' pin 0 as shown in the figure within the NAP command description of the manual.
'{$STAMP BS2}
HIGH 0
Again:
PULSOUT 0, 5000
PAUSE 1000
GOTO Again
Page 244 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
(instruction
executes)
PULSOUT 7,5
pin 7 in input mode
(DIR7 = 0,
OUT7 = 0)
but held high by
resistor to Vdd
pin changes to
output
b
'STAMP directive (specifies a BS1)
' Set the pin high (LED off).
' Flash the LED for 10 ms.
' Wait one second.
' Repeat endlessly.
'STAMP directive (specifies a BS2)
' Set the pin high (LED off).
' Flash the LED for 10 ms.
' Wait one second.
' Repeat endlessly.
positive pulse
pin left as
output - low
(DIR7 = 1,
OUT7 = 0)
Figure 5.26: Example Pulse
Diagram.
1
2
2
2
2
e
p
sx
NOTE: This is written for the BS2
but can be used for the BS2e,
BS2sx and BS2p also. Locate the
proper source code file or modify
the STAMP directive before
downloading to the BS2e, BS2sx or
BS2p. Keep in mind that the unit of
time may be different than what
appears in the comments here.

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

Table of Contents