03.01.2015 Views

80C186EC/80C188EC Microprocessor User's Manual

80C186EC/80C188EC Microprocessor User's Manual

80C186EC/80C188EC Microprocessor User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SERIAL COMMUNICATIONS UNIT<br />

Due to internal synchronization requirements, the maximum input frequency to BCLK is one-half<br />

the CPU operating frequency. See “BCLK Pin Timings” on page 11-18 for more information. Table<br />

11-1 shows the correct BxCMP values for common baud rates.<br />

Table 11-1. BxCMP Values for Typical Baud Rates and CPU Frequencies<br />

CPU Frequency<br />

Baud<br />

Rate<br />

BxCMP<br />

Value<br />

25 MHz 20 MHz 16 MHz 8 MHz<br />

%<br />

Error<br />

BxCMP<br />

Value<br />

%<br />

Error<br />

BxCMP<br />

Value<br />

%<br />

Error<br />

BxCMP<br />

Value<br />

%<br />

Error<br />

19,200 80A2H –0.14 8081H 0.16 8067H 0.16 8033H 0.16<br />

9,600 8145H –0.14 8103H 0.16 80CFH 0.16 8067H 0.16<br />

4,800 828AH 0.00 8208H –0.03 81A0H –0.08 80CFH 0.16<br />

2,400 8515H 0.00 8411H –0.03 8340H 0.04 81A0H –0.08<br />

1,200 8A2BH 0.00 8822H 0.01 8682H –0.02 8340H 0.04<br />

NOTE<br />

A zero or one value for BxCMP is illegal and results in unpredictable<br />

operation. Programming BxCMP during a transmission or reception causes<br />

indeterminate operation.<br />

11.2.2 Asynchronous Mode Programming<br />

The serial port operation is controlled by two registers. The Serial Port Control (SxCON) Register<br />

controls the mode of operation of the serial port (see Figure 11-13). The Serial Port Status<br />

(SxSTS) Register acts as the flags register, reporting on errors and the state of the RX and TX<br />

machines (see Figure 11-14). Depending on the serial port mode, these registers can have different<br />

functionality. This section outlines how to use SxCON and SxSTS to obtain the desired operation<br />

from the serial port.<br />

11.2.2.1 Modes 1, 3 and 4 for Stand-alone Serial Communications<br />

When using these modes for their respective seven, eight or nine bit data modes, operation is fairly<br />

straightforward. The serial port must be initialized correctly (through SxCON), then SxSTS<br />

needs to be interpreted.<br />

To configure the serial port, first program the baud rate through the BxCMP register, then program<br />

SxCON (Figure 11-13 on page 11-15) as follows.<br />

1. Determine the values for M2:0 for the desired serial port mode.<br />

2. If parity is used, enable it with the PEN bit. Set the sense of parity (even or odd) with the<br />

EVN bit. Note that parity is not available in Mode 4 (seven bit data).<br />

11-13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!