Maxim Integrated Secure Microcontroller User Manual

Page 128

Advertising
background image

Secure Microcontroller User’s Guide

128 of 187

To create 19,200 baud, the SMOD bit should be set to a logic 1 with the same value for TH1. SMOD has
the doubles the baud rate for any time out value. The values for TH1 and SMOD have been determined.
The only remaining task is to configure the timer 1 for 8-bit auto-reload operation. This causes the timer
to start counting from the TH1 value after each timeout. The TMOD register is set as follows:

TH1–8Dh

D7

D6

D5

D4

D3

D2

D1

D0

1

1

1

1

1

1

0

1

PCON–87h

SMOD

POR

PFW

WTR

EPFW

EST

STOP

IDL

0

X

X

X

X

X

X

X

TMOD–89h

GATE

C/

T

M1

M0

GATE

C/

T

M1

M0

0

0

1

0

X

X

X

X


As shown in the TCON description, setting M1 = 1 and M0 = 0 selects Timer 1 mode 2 which is the 8-bit
auto-reload mode. In this example, Timer 0 is not used, so the lower four bits of TMOD are unused.
Therefore the TMOD register can be written with 00100000b or 20h. The remaining step is to enable the
timer. Once this is done, the baud rate generator will be in operation and serial I/O can be performed. The
TCON register is used to enable the timers as shown below. The TR1 bit is set to a logic 1 to enable the
Timer 1 function. Writing a 01000000b or 40h to TCON will do this.

TCON–88h

TF1

TR1

TF0

TR0

IE1

IT1

IE0

IT0

0

1

0

0

0

0

0

0


In summary the following SFRs are configured to enable the serial port for 9600-baud asynchronous
operation:

TH1

FDh

SCON

50h

IE

90h

IP

10h

TMOD

20h

TCON

40h

PCON

00h (SMOD = 0)


To set up the serial port for 19,200 baud, the only difference is that the SMOD bit at PCON.7 is set.
Therefore, writing 80h to PCON accomplishes this.

The example described moving 256 bytes of data from memory to the serial port, then receiving a
confirmation code of 0A5h. The memory is assumed to be located in the MOVX RAM beginning at the
partition address. For this example, the partition is 4000h and the microcontroller is a DS5000. Using a
DS5001/2 would change the value written to the MCON to configure the partition.

Advertising