beautypg.com

2 up/down count with auto-reload, 12 .1 .2 up/down count with auto-reload -4, 2up/downcountwithauto-reload – Maxim Integrated MAX31782 User Manual

Page 106

background image

MaximIntegrated 12-4

MAX31782 User’s Guide

Revision 0; 8/11

12.1.2Up/DownCountwithAuto-Reload

The 16-Bit up/down count auto-reload mode is enabled by clearing the capture/reload bit (CP/RLB) to 0 and setting the
down count enable bit (DCEN) to 1 . This mode is illustrated in

Figure 12-2

. When DCEN is set to 1 the Timer B either

counts up or down, depending upon the state of the TBB pin . If the TBB pin is high, the Timer B counts up and, if the
TBB pin is low, the Timer B counts down . When DCEN = 0, the Timer B only counts up .
When counting up and an overflow occurs (a match between the value in the TB0V and TB0R register), the TB0V reg-
ister reloads with a value of 0000h and continues counting . When the timer is counting down and an underflow occurs
(the TB0V register reaches 0000h), the TB0V register is reloaded with the value in the TB0R register and downward
counting continues .
Note that in this mode of operation an overflow or underflow of the timer is provided to an edge-detection circuit as well
as to the TFB bit . This edge-detection circuit toggles the EXFB bit on every overflow or underflow . Therefore, the EXFB
bit behaves as a 17th bit of the counter, and can be used as such .

Figure 12-2. Up/Down Count with Auto-Reload Mode Block Diagram

SYSTEM

CLOCK

CLOCK PRESCALER

TBPS[2:0]

CLK

TBA PIN

TRB

TBB PIN

COUNT DIRECTION (1 = UP, 0 = DOWN)

(DOWN-COUNTING RELOAD VALUE)

(UP-COUNTING RELOAD VALUE)

TFB = 1

RISE/FALL

EDGE

TOGGLE

EXFB

ETB

TIMER B

INTERRUPT

TB0R

TB0V

0000h

15

0

15

0

0

1

C/TB