
13 PWM Timer (T16E)
13-2
EPSON
S1C17003 TECHNICAL MANUAL
13.2 PWM Timer Operating Modes
The PWM Timer has the following two operating modes:
1. Internal clock mode (Timer counting internal clock)
2. External clock mode (Functions as event counter)
The operating mode is selected using CLKSEL (D3/T16E_CTL register).
CLKSEL: Input Clock Select Bit in the PWM Timer Control (T16E_CTL) Register (D3/0x5306)
Setting CLKSEL to 0 (default) selects internal clock mode, while setting to 1 selects external clock mode.
Internal clock mode
Internal clock mode uses the prescaler output clock as the count clock.
The count clock is selected by the T16EDF[3:0] (D[3:0]/T16E_CLK register) from the 15 types generated by
the prescaler dividing the PCLK clock into 1/1 to 1/16 K divisions.
T16EDF[3:0]: Timer Input Clock Select Bits in the PWM Timer Input Clock Select (T16E_CLK) Register
(D[3:0]/0x5308)
Table 13.2.1: Prescaler clock selection
T16EDF[3:0]
Prescaler output clock
T16EDF[3:0]
Prescaler output clock
0xf
Reserved
0x7
PCLK-1/128
0xe
PCLK-1/16384
0x6
PCLK-1/64
0xd
PCLK-1/8192
0x5
PCLK-1/32
0xc
PCLK-1/4096
0x4
PCLK-1/16
0xb
PCLK-1/2048
0x3
PCLK-1/8
0xa
PCLK-1/1024
0x2
PCLK-1/4
0x9
PCLK-1/512
0x1
PCLK-1/2
0x8
PCLK-1/256
0x0
PCLK-1/1
(Default: 0x0)
Note: The prescaler must run before operating the PWM Timer in internal clock mode.
Make sure the PWM Timer count is halted before changing count clock settings.
For detailed information on the prescaler control, see “9 Prescaler (PSC).”
External clock mode
In external clock mode, channel 0 uses a clock or pulse input via the P15(EXCL3) port for the count clock.
Therefore it can be used as an event counter. Timer operations other than input clock are the same as those in
the internal clock mode.
To input the EXCL3 clock via the P15 port, write 0 to the P15MUX (D3-2/P1_PMUX register) to change the
pin function, and set it to the input mode.
T15MUX: P15 Port Function Select bit in the P0 Port Function Select (P1_PMUX) Register (D3-2/0x52a3)
The PWM Timer increments counts based on the input signal rising edge.
The PWM Timer does not use the prescaler in this mode. If no other peripheral modules are using the prescaler
clock, the prescaler can be stopped to reduce current consumption.