16 16-BIT PWM TIMERS (T16A3)
S1C17F13 TeChniCal Manual
Seiko epson Corporation
16-3
(Rev. 1.0)
Clock Supply in SLEEP Mode
16.3.2
When using T16A3 during SLEEP mode, the T16A3 operating clock CLK_T16A
n
must be configured so that it
will keep supplying by writing 0 to the CLGOSC.
xxxx
SLPC bit for the CLK_T16A
n
clock source.
If the CLGOSC.
xxxx
SLPC bit for the CLK_T16A
n
clock source is 1, the CLK_T16A
n
clock source is deactivated
during SLEEP mode and T16A3 stops with the register settings and counter value maintained at those before en-
tering SLEEP mode. After the CPU returns to normal mode, CLK_T16A
n
is supplied and the T16A3 operation
resumes.
Clock Supply in DEBUG Mode
16.3.3
The CLK_T16A
n
supply during DEBUG mode should be controlled using the T16A
n
CLK.DBRUN bit.
The CLK_T16A
n
supply to T16A3 Ch.
n
is suspended when the CPU enters DEBUG mode if the T16A
n
CLK.
DBRUN bit = 0. After the CPU returns to normal mode, the CLK_T16A
n
supply resumes. Although T16A3 Ch.
n
stops operating when the CLK_T16A
n
supply is suspended, the counter and registers retain the status before DE-
BUG mode was entered. If the T16A
n
CLK.DBRUN bit = 1, the CLK_T16A
n
supply is not suspended and T16A3
Ch.
n
will keep operating in DEBUG mode.
Event Counter Clock
16.3.4
The channel that supports the event counter function uses the EXCL
m
pin, not EXOSC, as the clock input pin when
external clock is selected using the T16A
n
CLK.CLKSRC[1:0] bits.
The counter counts up at the rising edge of the EXCL
m
input signal.
EXCL
m
pin input
Counter
x
x
+ 1
x
+ 2
x
+3
3.4.1 Count Up Timing
Figure 16.
Operations
16.4
Initialization
16.4.1
T16A3 Ch.
n
should be initialized and started counting with the procedure shown below. Perform initial settings
for comparator mode when using T16A3 as an interval timer, PWM waveform generator, or external event counter.
Perform initial settings for capture mode when using T16A3 to measure external event periods.
Initial settings for comparator mode
1. Configure the T16A3 Ch.
n
operating clock.
2. Set the T16A0CLK.MULTIMD bit.
(Select multi-comparator/capture or normal channel mode)
3. Set the following T16A
n
CCCTL register bits:
- Set the T16A
n
CCCTL.CCAMD bit to 0. * (Set the T16A
n
CCA register to comparator mode)
- Set the T16A
n
CCCTL.CCBMD bit to 0. * (Set the T16A
n
CCB register to comparator mode)
*
One of the T16A
n
CCA or T16A
n
CCB register can be set to capture mode.
Set the following bits when the TOUTA output is used.
- T16A
n
CCCTL.TOUTAINV bit
(Select TOUT signal polarity)
- T16A
n
CCCTL.TOUTAMD[1:0] bits
(Select TOUT signal generation mode)
Set the following bits when the TOUTB output is used.
- T16A
n
CCCTL.TOUTBINV bit
(Select TOUT signal polarity)
- T16A
n
CCCTL.TOUTBMD[1:0] bits
(Select TOUT signal generation mode)
4. Set the T16A
n
CCA and T16A
n
CCB registers. (Set compare data)
5. Set the following bits when using the interrupt:
- Write 1 to the interrupt flags in the T16A
n
INTF register.
(Clear interrupt flags)
- Set the interrupt enable bits in the T16A
n
INTE register to 1. (Enable interrupts)