View Full Version : Baud Rates Beyond 9600 For BS2px

06-03-2005, 07:44 AM
Can you give me the BAUD rates and the values for the BS2px above 9600 Baud for the SEROUT command, I can't find them in the manual.

Jon Williams
06-03-2005, 08:18 AM
Remember that the BASIC Stamp can do any baud within it's range, and each group of modules has it's own baud formula that you will find under SERIN and SEROUT in the manau.ˇ For the BS2px, the formula is: INT(4,000,000 ÷ baud rate) - 20.

I've precalculated the most popular baudmodes for use in my programs, and have embedded them into a Conditional Compilation block that is part of my template file.ˇ I find it far easier to delete this section if I don't need it than to have to calculate or look up baud parameters.

ˇˇˇ T1200ˇˇˇˇˇˇ CONˇˇˇˇ 813
ˇˇˇ T2400ˇˇˇˇˇˇ CONˇˇˇˇ 396
ˇˇˇ T4800ˇˇˇˇˇˇ CONˇˇˇˇ 188
ˇˇˇ T9600ˇˇˇˇˇˇ CONˇˇˇˇ 84
ˇˇˇ T19K2ˇˇˇˇˇˇ CONˇˇˇˇ 32
ˇˇˇ TMidiˇˇˇˇˇˇ CONˇˇˇˇ 12
ˇˇˇ T38K4ˇˇˇˇˇˇ CONˇˇˇˇ 6
ˇˇˇ T1200ˇˇˇˇˇˇ CONˇˇˇˇ 2063
ˇˇˇ T2400ˇˇˇˇˇˇ CONˇˇˇˇ 1021
ˇˇˇ T4800ˇˇˇˇˇˇ CONˇˇˇˇ 500
ˇˇˇ T9600ˇˇˇˇˇˇ CONˇˇˇˇ 240
ˇˇˇ T19K2ˇˇˇˇˇˇ CONˇˇˇˇ 110
ˇˇˇ TMidiˇˇˇˇˇˇ CONˇˇˇˇ 60
ˇˇˇ T38K4ˇˇˇˇˇˇ CONˇˇˇˇ 45
ˇˇˇ T1200ˇˇˇˇˇˇ CONˇˇˇˇ 3313
ˇˇˇ T2400ˇˇˇˇˇˇ CONˇˇˇˇ 1646
ˇˇˇ T4800ˇˇˇˇˇˇ CONˇˇˇˇ 813
ˇˇˇ T9600ˇˇˇˇˇˇ CONˇˇˇˇ 396
ˇˇˇ T19K2ˇˇˇˇˇˇ CONˇˇˇˇ 188
ˇˇˇ TMidiˇˇˇˇˇˇ CONˇˇˇˇ 108
ˇˇˇ T38K4ˇˇˇˇˇˇ CONˇˇˇˇ 84

SevenBitˇˇˇˇˇˇˇ CONˇˇˇˇ $2000
Invertedˇˇˇˇˇˇˇ CONˇˇˇˇ $4000
Openˇˇˇˇˇˇˇˇˇˇˇ CONˇˇˇˇ $8000

Baudˇˇˇˇˇˇˇˇˇˇˇ CONˇˇˇˇ T9600

Jon Williams
Applications Engineer, Parallax

Beau Schwabe
06-03-2005, 11:24 AM

This is really a matter of personal preference, but I usually do something like this in my code....

'Initialize varaibles

BaudRate CON 9600
Bs2Baud VAR W0

'Calculate BS2Baud

Bs2Baud = BaudRate / 100
Bs2Baud = 40000 / Bs2Baud
Bs2Baud = Bs2Baud - 20
Bs2Baud = Bs2Baud + 16384 'Inverted Mode

'Main program goes below here

...Just be sure and keep your BaudRate to something evenly divisible by 100


Beau Schwabe
Parallax IC Layout Engineer