Page 361 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 361
338 Chapter 11 Input/ Output
TxDO
RxDO
Figure 11.13.6812 Serial Communication Interface
The clock rate is established by the 12-bit SCOBD port (OxcO). The number put in
this port is the clock going to the SCI (Figure 11.13) divided by 16 times the desired
baud rate. For example, to get 9600 baud, put 52 into the SCOBD port.
The 16-bit control port, SCOCR, at Oxc2 has parity enable PE and parity type PT to
establish the parity, transmitter interrupt enable TIE and receiver interrupt enable RIE
to enable interrupts, and transmitter enable TE and receiver enable RE to enable the
device. The 16-bit status port at Oxc4 indicates what is happening in the transmitter and
receiver. TDRE is T (1) if the transmit data register is empty; it is set when data are
moved from the data register to the shift register and is cleared by a read of the status port
followed by a write into the data port. The remaining status bits are for the receiver.
RDRF is T (1) if the receive data register is full because a frame has been received.
Receive error conditions are indicated by OR, set when the receiver overruns (that is, a
word has to be moved from the input shift register before the previously input word is
read from the data register) FE; T (1) if there is a framing error (that is, a stop bit is
expected but the line is low; and PE, T (1) if there is a parity error.