Specifications

BASIC Stamp II
Page 310 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc.
for byte-oriented data. Parity can detect some communication errors,
but to use it you lose one data bit. This means that incoming data bytes
transferred in 7E mode can only represent values from 0 to 127, rather
than the 0 to 255 of 8N mode.
Direct Connection
(Inverted)
Through Line Driver
(Noninverted)
Baud Rate
300
600
1200
2400
4800
9600
19200
38400
8 data bits,
no parity
7 data bits,
even parity
3313 11505
1646 9838
813 9005
396 8588
188 8380
84 8276
32 8224
6 8198
8 data bits,
no parity
7 data bits,
even parity
19697 27889
18030 26222
17197 25389
16780 24972
16572 27764
16468 24660
16416 24608
16390 24582
Common Data Rates and Their Baudmodes
Table I-3
Simple Input and Numeric Conversions
Stripped to just the essentials, Serin can be as simple as:
Serin rpin,baudmode,[inputData]
For example, to receive a byte through pin 1 at 9600 bps, 8N, inverted:
serData var byte
Serin 1,16468,[serData]
Serin would wait for and receive a single byte of data through pin 1
and store it in the variable serData. If the Stamp were connected to a
PC running a terminal program set to the same baud rate and the user
pressed the A key on the keyboard, after Serin the variable serData
would contain 65, the ASCII code for the letter A. (See the ASCII char-
acter chart in the appendix.) If you wanted to let the user enter a deci-
mal number at the keyboard and put that value into serData, the ap-
propriate Serin would be:
serData var byte
Serin 1,16468,[DEC serData]
Corresponding Baudmode Value
Data Speed