BASIC stamp manual v2.2
SERIN - BASIC Stamp Command Reference
Page 410 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
When SERIN executes, I/O pin 1 (Rpin) is made an input in preparation
for incoming data, and I/O pin 0 (Fpin) is made output low, to signal “go”
to the sender. After SERIN finishes receiving, I/O pin 0 goes high to tell
the sender to stop. If an inverted BaudMode had been specified, the Fpin’s
responses would have been reversed. Here’s the relationship of serial
polarity to Fpin states.
Ready to Receive ("Go") Not Ready to Receive ("Stop")
Inverted
Fpin is High (1) Fpin is Low (0)
Non-inverted
Fpin is Low (0) Fpin is High (1)
Table 5.103: Flow control pin states
in relation to polarity (inverted or
non-inverted) for all BS2 models.
See the demo program, below, for a flow control example using two BS2s.
In the demo program example, without flow control, the sender would
transmit the whole word “Hello!” in about 6 ms. The receiver would catch
the first byte at most; by the time it got back from the first 1-second
PAUSE, the rest of the data would be long gone. With flow control,
communication is flawless since the sender waits for the receiver to catch
up.
In Figure 5.37, 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.
P0
P1
VSS
BS2
sender
P0
P1
BS2
receiver
Host PC (for Debug)
programming
cable
VSS
10k
Figure 5.37: Flow-Control Example
Circuit.
Serial communication, because of its complexity, can be very difficult to
work with at times. Please follow these guidelines when developing a
project using the SERIN and SEROUT commands:
1. Always build your project in steps.
a. Start with small, manageable pieces of code, that deals
with serial communication) and test them, one at a time.
SERIN TROUBLESHOOTING.