16 16-BIT PWM TIMERS (T16A3)
S1C17F13 TeChniCal Manual
Seiko epson Corporation
16-7
(Rev. 1.0)
Capture mode (T16A
n
CCCTL.CCAMD/CCBMD bit = 1)
The capture mode captures the counter value when an external event such as a key entry occurs (at the spec-
ified edge of the CAPA
n
/CAPB
n
external input signal). In this mode, the T16A
n
CCA and/or T16A
n
CCB
registers function as the capture A and/or capture B registers. Furthermore, the TOUTA
n
/CAPA
n
pin and
the TOUTB
n
/CAPB
n
pin are configured to the CAPA
n
pin and the CAPB
n
pin, respectively.
The trigger edge of the signal can be selected using the T16A
n
CCCTL.CAPATRG[1:0] bits for capture A
and the T16A
n
CCCTL.CAPBTRG[1:0] bits for capture B.
When a specified trigger edge is input during counting, the current counter value is loaded to the T16A
n
C-
CA or T16A
n
CCB register. At the same time the T16A
n
INTF.CAPAIF or CAPBIF bit is set. The interrupt
occurred by this bit can be used to read the captured data from the T16A
n
CCA or T16A
n
CCB register. For
example, external event cycles and pulse widths can be measured from the difference between two captured
counter values read.
If the captured data stored in the T16A
n
CCA or T16A
n
CCB register is overwritten by the next trigger when
the T16A
n
INTF.CAPAIF or CAPBIF bit has already been set, an overwrite error occurs (the T16A
n
INTF.
CAPAOWIF or CAPBOWIF bit is set).
Notes:
•
The correct captured data may not be obtained if the captured data is read at the same time
the next value is being captured. Read the T16A
n
CCA or T16A
n
CCB register twice to check
if the read data is correct as necessary.
•
To capture counter data properly, both the high and low period of the CAPA
n
/CAPB
n
trigger
signal must be longer than the source clock cycle time.
Counter
CAPA
n
input
0xffff
0x0000
T16A
n
CCCTL.CAPATRG[1:0] bits = 0x3 (Trigger: CAPA
n
rising and falling edges)
An overwrite error occurs as the T16A
n
INTF.CAPAIF bit has not been cleared.
Time
Capture A(T16A
n
CCA)
register value
PRUN = 1
CCA[15:0]
→
Data (R)
CAPAIF = 1
CAPAIF = 1
Counter value
→
CCA[15:0]
CAPAIF = 1
Counter value
→
CCA[15:0] CAPAOWIF = 1
Counter value
→
CCA[15:0]
CCA[15:0]
→
Data (R)
CAPAIF = 0
MODEN = 1
Software operation
Hardware operation
4.3.3 Operations in Capture Mode (Counter = Repeat Mode Only Supported)
Figure 16.
Multi-comparator/capture mode and the counter channel used
Normally, a counter block is connected to the comparator/capture block in the same channel and a different
clock can be used in each channel.
On the other hand, when T16A3 is placed into multi-comparator/capture mode (T16A0CLK.MULTIMD bit = 1),
a counter channel to be connected to each comparator/capture channel can be selected using the T16A
n
CTL.
CCABCNT[1:0] bits. This enables a counter block channel to connect to two or more comparator/capture block
channels. Note, however, that all channels must use the count clock configured in the counter block Ch.0, and a
different count clock cannot be used in each channel.