SEROUT - BASIC Stamp Command Reference
Page 302
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
sending the 7-bit value: %0011010, it sets the parity bit to 1 in order to
make an even number of 1s (four).
The receiver also counts the data bits to calculate what the parity bit
should be. If it matches the parity bit received, the serial receiver assumes
that the data was received correctly. Of course, this is not necessarily true,
since two incorrectly received bits could make parity seem correct when
the data was wrong, or the parity bit itself could be bad when the rest of
the data was OK. Parity errors are only detected on the receiver side.
Generally, the receiver determines how to handle the error. In a more
robust application, the receiver and transmitter might be set up such that
the receiver can request a re-send of data that was received with a parity
error.
When you design an application that requires serial communication
between BASIC Stamps, you have to work within these limitations:
•
When the BASIC Stamp is sending or receiving data, it can’t
execute other instructions.
•
When the BASIC Stamp is executing other instructions, it can’t
send or receive data. The BASIC Stamp does not have a serial
buffer as there is in PCs. At most serial rates, the BASIC Stamp
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 sometimes be addressed by using flow control; the
Fpin option for SERIN and SEROUT (at baud rates of up to the limitation
shown in Table 5.79). Through Fpin, SERIN can tell a BASIC Stamp sender
when it is ready to receive data and SEROUT (on the sender) will wait for
permission to send. (For that matter, Fpin flow control follows the rules of
other serial handshaking schemes, but most computers other than the
BASIC Stamp cannot start and stop serial transmission on a byte-by-byte
basis. That’s why this discussion is limited to communication between
BASIC Stamps.)
Here’s an example using flow control on the BS2 (data through I/O pin 1,
flow control through I/O pin 0, 9600 baud, N8, noninverted):
C
ONTROLLING DATA FLOW
.
Summary of Contents for BASIC Stamp 1
Page 1: ...BASIC Stamp Programming Manual Version 2 0c...
Page 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...