5: BASIC Stamp Command Reference – SEROUT
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 303
SerData VAR BYTE
SEROUT 1\0, 84, [SerData]
When SEROUT executes, I/O pin 1 (Tpin) is made an output, and I/O pin
0 (Fpin) is made an input, to wait for the “go” signal from the receiver.
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.35, 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, NoPermission, [DEC 150]
STOP
NoPermission:
DEBUG CLS, "timed out"
If no Fpin permission arrives within 2 seconds, the program aborts
SEROUT and continues at the label NoPermission.
Table 5.87: BS2, BS2e, BS2sx and
BS2p flow control pin states in
relation to polarity (inverted or non-
inverted).
2
e
2
sx
2
p
2
U
SING THE SERIAL TIME
-
OUT
FEATURE
.
2
e
2
sx
2
p
2
Содержание BASIC Stamp 2e
Страница 1: ...BASIC Stamp Programming Manual Version 2 0c...
Страница 30: ...Introduction to the BASIC Stamps Page 28 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 90: ...BUTTON BASIC Stamp Command Reference Page 88 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 118: ...END BASIC Stamp Command Reference Page 116 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 128: ...FREQOUT BASIC Stamp Command Reference Page 126 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 196: ...NAP BASIC Stamp Command Reference Page 194 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 206: ...OWIN BASIC Stamp Command Reference Page 204 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 214: ...OWOUT BASIC Stamp Command Reference Page 212 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 216: ...PAUSE BASIC Stamp Command Reference Page 214 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 226: ...POLLMODE BASIC Stamp Command Reference Page 224 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 232: ...POLLOUT BASIC Stamp Command Reference Page 230 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 236: ...POLLRUN BASIC Stamp Command Reference Page 234 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 240: ...POLLWAIT BASIC Stamp Command Reference Page 238 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 262: ...RCTIME BASIC Stamp Command Reference Page 260 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 274: ...RUN BASIC Stamp Command Reference Page 272 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 310: ...SEROUT BASIC Stamp Command Reference Page 308 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 324: ...STOP BASIC Stamp Command Reference Page 322 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...