SERIN - BASIC Stamp Command Reference
Page 288
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
If no data arrives within 2 seconds, the program aborts SERIN and
continues at the label NoData.
Here's a very important concept: this timeout feature is not picky about
the kind of data SERIN receives; if any serial data is received, it prevents
the timeout. In the example above, SERIN wants a decimal number. But
even if SERIN received letters “ABCD...” at intervals of less than two
seconds, it would never abort.
You can combine parity and serial timeouts. Here is an example for the
BS2 designed to receive a decimal number through pin 1 at 2400 baud, 7E,
inverted with a 10-second timeout:
Result VAR BYTE
Again:
SERIN 1, 24660, BadData, 10000, NoData, [DEC Result]
DEBUG CLS, ? Result
GOTO Again
NoData:
DEBUG CLS, "timed out"
GOTO Again
BadData:
DEBUG CLS, "parity error"
GOTO Again
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.70). Through Fpin, SERIN can tell a BASIC Stamp sender
when it is ready to receive data. (For that matter, Fpin flow control follows
R
EMEMBER
: T
IMEOUT DOES NOT
CARE WHAT KIND OF DATA IS
RECEIVED
,
ONLY THAT DATA IS
RECEIVED OR NOT
!
C
OMBINING PARITY AND TIME
-
OUT
.
2
e
2
sx
2
p
2
C
ONTROLLING DATA FLOW
.
Содержание 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...