EmbeddedRelated.com
Forums

Setting SCI baud rate

Started by acerunner316 June 9, 2008
I want to set the baud rate for the SCI based on user selection. So I
am setting SCI1BDH and SCI1BDL depending on what the baud rate is
selected (choices are limited to a few standard baud rates). However,
it seems like any baudrate that requires setting of SCI1BDH does not work.

Bus Speed is 24MHz
I allow the following baud rate:
38.4K, BR = 39 (default)
19.2K, BR = 78
9600, BR = 156
4800, BR = 313
2400, BR = 625
1200, BR = 1250

So the first 3 baud rates work, but the latter 3 doesn't. Only obvious
thing in common in those are that the upper byte of the registry
(SCI1BDH) needs to be written.

Datasheets say "writing to SCIBDH has no effect without writing ot
SCIBDL, since writin got SCIBDH puts the data in a temporary location
until SCIBDL is written to." So I always write SCI1BDH first, followed
by SCI1BDL.

What am I doing wrong?
It may be that you need to do a 16-bit write.

Emmett Redd

________________________________

From: 6... on behalf of acerunner316
Sent: Mon 6/9/2008 4:04 PM
To: 6...
Subject: [68HC12] Setting SCI baud rate

I want to set the baud rate for the SCI based on user selection. So I
am setting SCI1BDH and SCI1BDL depending on what the baud rate is
selected (choices are limited to a few standard baud rates). However,
it seems like any baudrate that requires setting of SCI1BDH does not work.

Bus Speed is 24MHz
I allow the following baud rate:
38.4K, BR = 39 (default)
19.2K, BR = 78
9600, BR = 156
4800, BR = 313
2400, BR = 625
1200, BR = 1250

So the first 3 baud rates work, but the latter 3 doesn't. Only obvious
thing in common in those are that the upper byte of the registry
(SCI1BDH) needs to be written.

Datasheets say "writing to SCIBDH has no effect without writing ot
SCIBDL, since writin got SCIBDH puts the data in a temporary location
until SCIBDL is written to." So I always write SCI1BDH first, followed
by SCI1BDL.

What am I doing wrong?
Issue solved. Mistake was in misinterpretation of a compiler define.