EasyManua.ls Logo

Parallax BASIC Stamp 2e - Page 291

Default Icon
353 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
5: BASIC Stamp Command Reference SERIN
BASIC Stamp Programming Manual 2.0c www.parallaxinc.com Page 289
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):
SerData VAR BYTE
SERIN 1\0, 84, [SerData]
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)
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.33, 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.
Table 5.78: BS2, BS2e, BS2sx and
BS2p flow control pin states in
relation to polarity (inverted or non-
inverted).
2
e
2
sx
2
p
2

Table of Contents

Related product manuals