BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – SERIN
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 397
Table 5.96: Baudmode calculation
for all BS2 models. Add the
results of steps 1, 2 and 3 to
determine the proper value for the
Baudmode argument.
Step 1: Determine the
bit period
(bits 0 – 11).
BS2, BS2e and BS2pe: = INT(1,000,000 / baud rate) – 20
BS2sx and BS2p: = INT(2,500,000 / baud rate) – 20
BS2px: = INT(4,000,000 / baud rate) – 20
Note: INT means 'convert to integer;' drop the numbers to the right of the decimal
point.
Step 2: Set data bits
and parity (bit 13).
8-bit/no-parity = 0
7-bit/even-parity = 8192
Step 3: Select
polarity (bit 14).
True (noninverted) = 0
Inverted = 16384
Table 5.97: BS2, BS2e, and
BS2pe common baud rates and
corresponding Baudmodes.
Baud
Rate
8-bit
no-parity
inverted
8-bit
no-parity
true
7-bit
even-parity
inverted
7-bit
even-parity
true
300 19697 3313 27889 11505
600 18030 1646 26222 9838
1200 17197 813 25389 9005
2400 16780 396 24972 8588
4800* 16572 188 24764 8380
9600* 16468 84 24660 8276
*The BS2, BS2e and BS2pe may have trouble synchronizing with the incoming serial stream
at this rate and higher due to the lack of a hardware input buffer. Use only simple variables
and no formatters to try to solve this problem.
Table 5.98: BS2sx and BS2p
common baud rates and
corresponding Baudmodes.
Baud
Rate
8-bit
no-parity
inverted
8-bit
no-parity
true
7-bit
even-parity
inverted
7-bit
even-parity
true
1200 18447 2063 26639 10255
2400 17405 1021 25597 9213
4800* 16884 500 25076 8692
9600* 16624 240 24816 8432
*The BS2sx and BS2p may have trouble synchronizing with the incoming serial stream at this
rate and higher due to the lack of a hardware input buffer. Use only simple variables and no
formatters to try to solve this problem.
Table 5.99: BS2px common baud
rates and corresponding
Baudmodes.
Baud
Rate
8-bit
no-parity
inverted
8-bit
no-parity
true
7-bit
even-parity
inverted
7-bit
even-parity
true
1200 19697 3313 27889 11505
2400 18030 1646 26222 9838
4800 17197 813 25389 9005
9600 16780 396 24792 8588
If you’re communicating with existing software or hardware, its speed(s)
and mode(s) will determine your choice of baud rate and mode. In
general, 7-bit/even-parity (7E) mode is used for text, and 8-bit/no-parity
(8N) for byte-oriented data. Note: the most common mode is
8-bit/no-parity, even when the data transmitted is just text. Most devices
CHOOSING THE PROPER BAUD MODE.