16 16-BIT PWM TIMERS (T16A3)
16-6
Seiko epson Corporation
S1C17F13 TeChniCal Manual
(Rev. 1.0)
The time from counter = 0x0000 to occurrence of a compare A interrupt (compare A period) and the time to
occurrence of a compare B interrupt (compare B period) can be calculated as follows:
(CCA + 1)
(CCB + 1)
Compare A period = ————— [s]
Compare B period = ————— [s]
(Eq. 16.1)
ct_clk
ct_clk
Where
CCA: T16A
n
CCA register setting value (0 to 65,535)
CCB: T16A
n
CCB register setting value (0 to 65,535)
ct_clk: Count clock frequency [Hz]
The compare A and compare B signals are also used to generate a timer output waveform (TOUT). Refer to
“TOUT Output Control” for more information.
Compare buffers
The comparator provides the compare A and compare B buffers for comparison with the counter instead
of the T16A
n
CCA and T16A
n
CCB registers. These compare buffers are used to synchronize the compari-
son data update timings with the counter operations. Setting the T16A
n
CTL.CBUFEN bit to 1 enables the
compare buffers. The compare A and B signals will be generated by comparing the counter values with the
compare A and B buffer values instead of the T16A
n
CCA and T16A
n
CCB register values. The T16A
n
CCA
and T16A
n
CCB register values written via software are loaded to the compare A and compare B buffers
when the compare B signal is generated (when the T16A
n
CTL.CBUFEN bit is set to 0, the T16A
n
CCA and
T16A
n
CCB register values are loaded to the compare buffers simultaneously with writing).
0xffff
0x0000
When the compare buffers are not used (T16A
n
CTL.CBUFEN bit = 0)
PRUN = 1
CMPAIF = 1
Data (W)
→
CCB[15:0]
Data (W)
→
CCA[15:0]
Data (W)
→
CCA[15:0]
Data (W)
→
CCA[15:0]
CMPBIF = 1
CMPAIF = 1 CMPAIF = 1
CMPAIF = 1
CMPBIF = 1
CMPBIF = 1
MODEN = 1
Counter
0xffff
0x0000
When the compare buffers are used (T16A
n
CTL.CBUFEN bit = 1)
Compare B period
Time
Compare A
buffer value
Compare B
buffer value
PRUN = 1
CMPAIF = 1
Compare A
period
CMPAIF = 1
Data (W)
→
CCB[15:0]
Data (W)
→
CCA[15:0]
Data (W)
→
CCA[15:0]
Data (W)
→
CCA[15:0]
CMPBIF = 1
CMPAIF = 1
CMPAIF = 1
CMPBIF = 1
CMPBIF = 1
MODEN = 1
Counter
Compare B period
Time
Compare A (T16A
n
CCA)
register setting value
Compare B (T16A
n
CCB)
register setting value
Software operation
Hardware operation
Compare A
period
(Note that the T16A
n
INTF.CMPBIF/CMPAIF bit clearing operations via software are omitted from the figure.)
4.3.2 Compare Buffer Operations (Counter = Repeat Mode)
Figure 16.