Timer_B Operation
673
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
Timer_B
26.2.4.1.1 Capture Initiated by Software
Captures can be initiated by software. The CM bits can be set for capture on both edges. Software then
sets bit CCIS1 = 1 and toggles bit CCIS0 to switch the capture signal between V
CC
and GND, initiating a
capture each time CCIS0 changes state:
MOV
#CAP+SCS+CCIS1+CM_3,&TB0CCTL1
; Setup TB0CCTL1
XOR
#CCIS0,&TB0CCTL1
; TB0CCR1 = TB0R
NOTE:
Capture Initiated by Software
In general, changing capture inputs while in capture mode may cause unintended capture
events. For this scenario, switching the capture input between VCC and GND, disabling the
capture mode is not required.
26.2.4.2 Compare Mode
The compare mode is selected when CAP = 0. Compare mode is used to generate PWM output signals or
interrupts at specific time intervals. When TBxR
counts
to the value in a TBxCLn, where n represents the
specific capture/compare latch:
•
Interrupt flag CCIFG is set.
•
Internal signal EQUn = 1.
•
EQUn affects the output according to the output mode.
26.2.4.2.1 Compare Latch TBxCLn
The TBxCCRn compare latch, TBxCLn, holds the data for the comparison to the timer value in compare
mode. TBxCLn is buffered by TBxCCRn. The buffered compare latch gives the user control over when a
compare period updates. The user cannot directly access TBxCLn. Compare data is written to each
TBxCCRn and automatically transferred to TxBCLn. The timing of the transfer from TBxCCRn to TBxCLn
is user selectable, with the CLLD bits as described in
.
Table 26-2. TBxCLn Load Events
CLLD
Description
00
New data is transferred from TBxCCRn to TBxCLn immediately when TBxCCRn is written to.
01
New data is transferred from TBxCCRn to TBxCLn when TBxR
counts
to 0.
10
New data is transferred from TBxCCRn to TBxCLn when TBxR
counts
to 0 for up and continuous modes. New data
is transferred to from TBxCCRn to TBxCLn when TBxR
counts
to the old TBxCL0 value or to 0 for up/down mode.
11
New data is transferred from TBxCCRn to TBxCLn when TBxR
counts
to the old TBxCLn value.