2 timer_b operation – Texas Instruments MSP430x1xx User Manual

Page 181

Advertising
background image

Timer_B Operation

11-5

Timer_B

11.2 Timer_B Operation

The 16-bit timer has four modes of operation selectable with the MC0 and MC1
bits in the TBCTL register and four selectable lengths, also configured in the
TBCTL register. The timer increments or decrements (depending on mode of
operation) with each rising edge of the clock signal. The timer can be read or
written to with software. Additionally, the timer can generate an interrupt with
its ripple-carry output when it overflows.

11.2.1 Timer Length

Timer_B is configurable to operate as a true 8-bit, 10-bit, 12-bit, or 16-bit timer.
The length of the counter is configured in the TBCTL register. Leading bits are
read as zero in 8-bit, 10-bit, and 12-bit mode. Data written to the TBR register
in 8-bit, 10-bit, and 12-bit mode will show leading 0s. The maximum count
value, TBR

(max)

, for the various lengths is:

Timer B Config ration

TBR

Timer_B Configuration

TBR

(max)

16-bit

0FFFFh

12-bit

0FFFh

10-bit

03FFh

8-bit

0FFh

11.2.2 Timer Mode Control

The timer has four modes of operation as shown in Figure 11–2 and described
in Table 11–1: stop, up, continuous, and up/down. The operating mode is soft-
ware selectable with the MC0 and MC1 bits in the TBCTL register.

Figure 11–2. Mode Control

CLK

16-Bit Timer

RC

15

0

Data

POR

Mode

Control

MC1

MC0

Equ0

Carry/Zero

Set_TBIFG

0
0
1
1

0
1
0
1

Stop Mode
Up Mode
Continuous Mode
Up/Down Mode

Timer Clock

† Length is selectable for 8-, 10-, 12-, or 16-bit operation.

Advertising