Texas Instruments MSP430x1xx User Manual
Page 157

Timer Modes
10-17
Timer_A
10.4.1.1 Capture/Compare Block, Capture Mode—Capture Initiated by Software
In addition to internal and external signals, captures can be initiated by
software. This is useful for various purposes, such as:
-
To measure time used by software routines
-
To measure time between hardware events
-
To measure the system frequency
Two bits, CCISx1 and CCISx0, and the capture mode selected by bits CCMx1
and CCMx0 are used by the software to initiate the capture. The simplest
realization is when the capture mode is selected to capture on both edges of
CCIx and bit CCISx1 is set. Software then toggles bit CCISx0 to switch the
capture signal between V
CC
and GND, initiating a capture each time the input
is toggled, as shown in Figure 10–21.
Figure 10–21. Software Capture Example
Capture
Mode
CCISx0
CCISx1
CCIxA
CCIxB
GND
0
1
2
3
V
CC
CCMx1 CCMx0
CMPx
CCIx
CCISx1
CCISx0
CCIx
Capture
Capture
Both Edges Selected
1
1
The following is a software example of a capture performed by software:
; The data of capture/compare register CCRx are taken
; by the software. It is assumed that CCMx1, CCMx0, and
; CCISx1 bits are set. Bit CCIS0 selects the CCIx
; signal to be high or low.
;
...
...
XOR
#CCISx0, &CCTLx
...
...
...