16 16-BIT PWM TIMERS (T16A3)
S1C17F13 TeChniCal Manual
Seiko epson Corporation
16-5
(Rev. 1.0)
Counter value read
The counter value can be read out from the T16A
n
TC.T16ATC[15:0] bits. However, since T16A3 operates on
CLK_T16A
n
, one of the operations shown below is required to read correctly by the CPU.
- Read the counter value twice or more and check to see if the same value is read.
- Stop the timer and then read the counter value.
Comparator/Capture Block Operations
16.4.3
The comparator/capture block functions as a comparator to compare the counter value with the register value set or
a capture unit to capture counter values using the external trigger signals.
Comparator/capture block operating mode (comparator mode and capture mode)
The T16A
n
CCA and T16A
n
CCB registers that are embedded in the comparator/capture block can be set to
comparator mode or capture mode, individually.
Comparator mode (T16A
n
CCCTL.CCAMD/CCBMD bit = 0)
The comparator mode compares the counter value and the value set via software. It generates an interrupt
and toggles the timer output signal level when the values are matched. The T16A
n
CCA and/or T16A
n
CCB
registers function as the compare A and/or compare B registers that are used for setting compare values
in this mode. Furthermore, the TOUTA
n
/CAPA
n
pin and the TOUTB
n
/CAPB
n
pin are configured to the
TOUTA
n
pin and the TOUTB
n
pin, respectively.
When the counter reaches the value set in the T16A
n
CCA register during counting, the comparator asserts
the compare A signal and issues a compare A interrupt request.
When the counter reaches the value set in the T16A
n
CCB register, the comparator asserts the compare B
signal and issues a compare B interrupt request. At the same time, the counter is cleared to 0.
Counter
0xffff
0x0000
Counter = Repeat mode
Compare B period
Time
Compare A (T16A
n
CCA)
register setting value
Compare B (T16A
n
CCB)
register setting value
PRUN = 1
Software operation
CMPAIF = 1
Hardware operation
Compare A
period
PRUN = 1
CMPBIF = 1
CMPAIF = 1
CMPAIF = 1
CMPBIF = 1
CMPBIF = 1
MODEN = 1
PRESET = 1
PRUN = 0
Counter
0xffff
0x0000
Counter = One-shot mode
Compare B period
Time
Compare B (T16A
n
CCB)
register setting value
PRUN = 1
Compare B
period
PRUN = 1
Data (W)
→
CCB[15:0]
CMPBIF = 1
CMPBIF = 1
MODEN = 1
(Note that the T16A
n
INTF.CMPBIF/CMPAIF bit clearing operations via software are omitted from the figure.)
4.3.1 Operations in Comparator Mode
Figure 16.