BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – SEROUT
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 425
In Figure 5.39 below, I/O pin 0, Fpin, is pulled to ground through a 10k
resistor. This is to ensure that the sender sees a stop signal (0 for inverted
communications) when the receiver is being programmed.
In the flow control examples above, the only way the SEROUT instruction
will end (other than RESET or power-off) is if the receiver allows it to send
the entire OutputData list. If Fpin permission never occurs, the program is
stuck. However, you can tell the BASIC Stamp to abort SEROUT if it
doesn’t receive Fpin permission within a specified time period. For
instance, to transmit a decimal number through pin 1 at 9600 baud, 8N,
inverted and abort SEROUT after 2 seconds (2000 ms) if no Fpin
permission arrives on I/O pin 0:
SEROUT 1\0, 16468, 2000, No_Permission, [DEC 150]
STOP
No_Permission:
DEBUG "Timeout error", CR
If no Fpin permission arrives within 2 seconds, the program aborts
SEROUT and continues at the label No_Permission.
Figure 5.39: Flow-Control Example
Circuit.
P0
P1
VSS
BS2
sender
P0
P1
BS2
receiver
Host PC (for Debug)
programming
cable
VSS
10k
The SEROUT command supports open-drain and open-source output,
which makes it possible to network multiple BASIC Stamp modules on a
single pair of wires. These "open baudmodes" only actively drive the Tpin
in one state (for the other state, they simply disconnect the pin; setting it to
an input mode). If two BASIC Stamp modules in a network had their
SEROUT lines connected together (while a third device listened on that
line) and the BASIC Stamp modules were using always-driven
baudmodes, they could simultaneously output two opposite states (i.e.: +5
volts and ground). This would create a short circuit. The heavy current
flow would likely damage the I/O pins or the BASIC Stamp modules
USING THE SERIAL TIME-OUT FEATURE.
U
SING OPEN BAUDMODES FOR
NETWORKING BASIC STAMPS.
All
2