Specifications
BASIC Stamp II
Page 316 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc.
badData:
debug cls, "parity error"
goto again
Controlling Data Flow
When you design an application that requires serial communication
between BS2s, you have to work within these limitations:
• When the BS2 is sending or receiving data, it can’t execute other
instructions.
• When the BS2 is executing other instructions, it can’t send or
receive data.
• The BS2 executes 3000 to 4000 instructions per second and there
is not serial buffer in the BS2 as there is in PCs. At most serial rates,
the BS2 cannot receive data via Serin, process it, and execute
another Serin in time to catch the next chunk of data, unless there
are significant pauses between data transmissions.
These limitations can be addressed by using flow control; the fpin
option for Serin and Serout (at baud rates of up to 19200). Through
fpin, Serin can tell a BS2 sender when it is ready to receive data. (For
that matter, fpin flow control follows the rules of other serial hand-
shaking schemes, but most computers other than the BS2 cannot start
and stop serial transmission on a byte-by-byte basis. That’s why this
discussion is limited to BS2-to-BS2 communication.)
Here’s an example of a flow-control Serin (data through pin 1, flow
control through pin 0, 9600 baud, N8, noninverted):
serData var byte
Serin 1\0,84,[serData]
When Serin executes, pin 1 (rpin) is made an input in preparation for
incoming data, and pin 0 (fpin) is made output low to signal “go” to
the sender. After Serin finishes receiving, pin 0 goes high to tell the
sender to stop. If an inverted baudmode had been specified, the fpin’s
repsonses would have been reversed. Here’s the relationship of serial
polarity to fpin states.










