beautypg.com

Serial mode summary, Mode 0, Mode 1 – Maxim Integrated Ultra-High-Speed Flash Microcontroller User Manual

Page 137: Mode 2, Serial mode summary -3, Mode 0 -3, Mode 1 -3, Mode 2 -3, Table 12-1. serial i/o modes and max baud rates -3, Table 12-1. serial i/o modes and max baud rates

background image

12-3

Ultra-High-Speed Flash
Microcontroller User’s Guide

SECTION 12: SERIAL I/O

The ultra-high-speed microcontroller provides two fully independent UARTs (serial ports) with framing-error detection and automatic

address recognition. The two UARTs can be operated simultaneously in identical or different modes and communication speeds. In

this documentation, all descriptions apply to both UARTs, unless stated otherwise.

Each serial port is capable of both synchronous and asynchronous modes. In the synchronous mode, the microcontroller generates

the clock and operates the UART in a half-duplex mode. In the asynchronous mode, full-duplex operation is available. Receive data is

buffered in a holding register. This allows the UART to receive an incoming word before software has read the previous value. Each

UART has an associated control register (SCON0, SCON1) and each has a transmit/receive register (SBUF0, SBUF1). The SFR loca-

tions are: SCON0, 98h; SBUF0, 99h; SCON1, C0h; SBUF1, C1h. The SBUF location provides access to both transmit and receive reg-

isters. Reads are directed to the receive buffer and writes to the transmit buffer automatically.

Serial Mode Summary

Each port provides four operating modes. These offer different communication protocols and baud rates.

The four serial operating modes and max baud rate for each are shown in Table 12-1, followed by a brief summary of each mode.

Detailed descriptions of the modes are provided later in this section. In addition, provisions for use of the serial ports in conjunction

with the crystal multiplier and power-management mode are discussed later in this section.

Mode 0

Mode 0 provides synchronous communication with external devices. It is commonly used to communicate with serial peripherals. Serial I/O

occurs on the RXD pin. The shift clock is provided on the TXD pin. Note that, whether transmitting or receiving, the serial clock is generat-

ed by the ultra-high-speed microcontroller. Thus, any device on the serial port in mode 0 must accept the microcontroller as the master.

When not using power-management mode, the baud rate in mode 0 is the system clock frequency divided by either 12 or 4, as select-

ed by the SM2 bit for the associated UART. When set to a logic 0, the serial port runs at a divide-by-12. When set to a logic 1, the ser-

ial port runs at a divide-by-4. The SM2 bit for serial port 0 is located at SCON0.5 and the SM2 bit for serial port 1 is located at SCON1.5.

With the exception of the additional new divide-by-4 selection (supported by SM2), mode 0 operation is identical to the 80C32.

Mode 1

This mode provides standard full-duplex asynchronous communication. A total of 10 bits are transmitted including 1 start bit, 8 data

bits, and 1 stop bit. The received stop bit is stored in bit location RB8 of the relevant SCON register.

In mode 1, the baud rate is a function of timer overflow. This makes the baud rate programmable by the user. One difference that exists

between the two UARTs, with respect to mode 1 configuration, is that serial port 1 can use only timer 1, whereas serial port 0 can use

either timer 1 or 2 to generate baud rates. If both serial ports use the same timer, they run at the same baud rate, or one can run twice

as fast as the other (when baud-rate doubler bits, PCON.7 and WDCON.7, are configured differently). If the two UARTs use different

timers, the baud-rate configurations, in relation to one another, are not as restrictive. Baud rates are discussed in more detail later. Mode

1 operation is identical to the standard 80C32 when timers 1 or 2 use the default oscillator divide-by-12 as an input clock.

Mode 2

This mode is an asynchronous mode that transmits a total of 11 bits. These include 1 start bit, 9 data bits (the ninth data bit being pro-

grammable), and 1 stop bit. The ninth bit is determined by the value in TB8 (SCON0.3 or SCON1.3) for transmission. When the ninth

bit is received, it is stored in RB8 (SCON0.2 or SCON1.2). The ninth bit can be a parity value by moving the P bit (PSW.0) to TB8.

Table 12-1. Serial I/O Modes and Max Baud Rates

MODE

SYNC/

ASYNC

BAUD CLOCK

START/STOP

DATA BITS

9TH BIT

FUNCTION

MAX BAUD RATE

SYSCLK = 33MHz

0

Sync

4 or 12 tCLK

None

8

None

8,250,000

1

Async

Timer 1 or 2*

1 start, 1 stop

8

None

2,062,500

2

Async

32 or 64 tCLK

1 start, 1 stop

9

0, 1, parity

1,031,250

3

Async

Timer 1 or 2*

1 start, 1 stop

9

0, 1, parity

2,062,500

†Use of the crystal multiplier or power-management mode affects the baud clock.
*Timer 2 available for serial port 0 only.

Maxim Integrated