beautypg.com

2 mode 2, 3 mode 1 or 3, Power control register (pcon; 87h) – Maxim Integrated High-Speed Microcontroller User Manual

Page 141: Watchdog control register (wdcon; d8h), Timer two control register ( t2con; c8h), Ates, Mode 0

background image

High-Speed Microcontroller User’s Guide

Rev: 062210

141 of 176

12.3.2

Mode 2

In this asynchronous mode, baud rates are also generated from the oscillator input. This mode works
identically to the original 8051 family. The baud rate is given by the following formula.

2

SMOD_x

Oscillator

Frequency

Mode 1, 3 Baud Rate =

64

12 x (256 - TH1)

The result of this formula generates a baud rate of either 1/32 x oscillator frequency or 1/64 x oscillator
frequency. In the formula, the numerator is expressed as two to the power of SMOD, where SMOD is
either a 0 or 1. When 0, the numerator is a 1 and when SMOD = 1, the numerator is a 2.

SMOD is a bit that effectively doubles the baud rate when set to logic 1. For Serial Port 0, SMOD_0
resides at

PCON

.7. This is the original location in the 8051 family. For Serial port 1, SMOD_1 resides in

WDCON

.7. The SMOD bits are set to a logic 0 on reset, which gives the lower speed baud rate.


If the application determines that Mode 0 or 2 must be used, then the oscillator or crystal frequency must
be selected to generate the correct baud rates since each mode offers two selections for a given frequency.

12.3.3

Mode 1 or 3

These asynchronous modes are commonly used for communication with PCs, modems, and other similar
interfaces. The baud rates are programmable using the oscillator input and 16-bit Timer 2 or 8-bit Timer
1. The

respective timer is placed in auto-reload mode. Each time the timer reaches its rollover condition

(FFFFh→0000h—Timer 2 or FFh→00h—Timer 1), a clock is sent to the baud-rate circuit. This clock is
then divided by 16 to generate the exact baud rate. For Serial Port 0, either Timer 1 or 2 can be used to
generate baud rates. Note that there are differences between the timers when used as baud-rate generators.
Serial Port 1 can use Timer 1 as a baud-rate generator. Thus in Mode 1 or 3, the two serial ports can run
at the same frequency if Timer 1 is used for both, but different frequencies if both timers are used.

Also note that the user can determine the speed at which Timer 1 runs (4 clocks or 12 clocks). In most
cases, 12 clocks will be used for baud-rate generation. Timer 2 runs from a two-clock scheme when used
for baud-rate generation. This is compatible with the 80C32.

The baud rates for Mode 1 or 3 are given by these formulas.

Serial Port 0 or 1

2

SMOD_x

Mode 1, 3 Baud Rate =

32

Timer 1 Overflow

Serial Port 0

Timer 2 Overflow

Mode 1, 3 Baud Rate =

16


To use Timer 1 as the baud-rate generator, it is commonly put into the 8-bit auto-reload mode. In this
way, the CPU is not involved in baud-rate generation. Note that the timer interrupt should not be enabled.
In the 8-bit auto-reload mode (Timer 1 Mode 2), the reload value is stored in TH1. Thus the combination
of crystal frequency and TH1 determine the baud rate. The complete formula is as follows.

2

SMOD_x

Oscillator Frequency

Mode 1, 3 Baud Rate =

32

12 x (256 - TH1)

x

x

x