beautypg.com

8 exenb control during pwm/output control mode, 3 timer b examples, 1 timer b example: reloading timer mode – Maxim Integrated MAXQ Family Users Guide: MAXQ2010 Supplement User Manual

Page 123: 8 exenb control during pwm/output control mode -12, 3 timer b examples -12, 1 timer b example: reloading timer mode -12, Maxq family user’s guide: maxq2010 supplement

background image

MAXQ Family User’s Guide:

MAXQ2010 Supplement

21-12

21.2.8 EXENB Control During PWM/Output Control Mode

The TBB input function (EXENB = 1) and the PWM/output control function (TBCS:TBCR<>00b) can be enabled at the
same time. However, the input function changes slightly when this is done. In this configuration, the detection of a fall-
ing edge on the TBB pin results in setting of the EXFB interrupt flag, but does not force an autoreload.

21.3 Timer B Examples

21.3.1 Timer B Example: Reloading Timer Mode

move PD5.2, #1

; Set P5.2 to output mode

move PO5.2, #1

; Drive high (LED off)

move TB0CN, #0000010000000000b ; Timer mode, reload mode, clock/256

move TB0R, #8000h ; Reload every 8000h timer cycles

move TB0CN.2, #1

; Start timer

;; Reload time is 1/sysclk * 256 * 8000h == 838ms

timerLoop:

move C, TB0CN.7

; Check reload flag

jump NC, timerLoop

move TB0CN.7, #0

; Clear reload flag

move Acc, PO5

xor #0100b

; Toggle bit 2

move PO5, Acc

jump timerLoop