beautypg.com

Texas Instruments MSC1210 User Manual

Page 77

background image

Using Timers to Measure Time

8-3

Timers

The individual bits of TMOD have the following functions:

7

6

5

4

3

2

1

0

Reset Value

SFR 8EH

0

0

T2M

T1M

T0M

MD2

MD1

MD0

01H

T2M (bit 5)—Timer 2 Clock Select. This bit controls the division of the system
clock that drives Timer 2. This bit has no effect when the timer is in baud rate
generator or clock output modes. Clearing this bit to 0 maintains 80C32 com-
patibility. This bit has no effect on instruction cycle timing.

0: Timer 2 uses a divide by 12 of the crystal frequency.

1: Timer 2 uses a divide by 4 of the crystal frequency.

T1M (bit 4)—Timer 1 Clock Select. This bit controls the division of the system
clock that drives Timer 1. Clearing this bit to 0 maintains 8051 compatibility.
This bit has no effect on instruction cycle timing.

0: Timer 1 uses a divide by 12 of the crystal frequency.

1: Timer 1 uses a divide by 4 of the crystal frequency.

T0M (bit 3)—Timer 0 Clock Select. This bit controls the division of the system
clock that drives Timer 0. Clearing this bit to 0 maintains 8051 compatibility.
This bit has no effect on instruction cycle timing.

0: Timer 0 uses a divide by 12 of the crystal frequency.

1: Timer 0 uses a divide by 4 of the crystal frequency.

MD2, MD1, MD0 (bits 2-0)—Stretch MOVX Select 2−0. These bits select the
time by which external MOVX cycles are to be stretched. This allows slower
memory or peripherals to be accessed without using ports or manual software
intervention. The RD or WR strobe will be stretched by the specified interval,
which will be transparent to the software except for the increased time to exe-
cute the MOVX instruction. All internal MOVX instructions on devices contain-
ing MOVX SRAM are performed at the 2 instruction cycle rate.

MD2

MD1

MD0

Stretch

Value

MOVX Duration

RD or WR

Strobe

Width

(SYS CLKs)

RD or WR

Strobe

Width (

µ

s)

at 12MHz

0

0

0

0

2 Instruction Cycles

2

0.167

0

0

1

1

3 Instruction Cycles

(default)

4

0.333

0

1

0

2

4 Instruction Cycles

8

0.667

0

1

1

3

5 Instruction Cycles

12

1.000

1

0

0

4

6 Instruction Cycles

16

1.333

1

0

1

5

7 Instruction Cycles

20

1.667

1

1

0

6

8 Instruction Cycles

24

2.000

1

1

1

7

9 Instruction Cycles

28

2.333