13 16-BiT PWM TiMeRS (T16a2)
13-2
Seiko epson Corporation
S1C17624/604/622/602/621 TeChniCal Manual
Comparator/capture block
The comparator/capture block provides a counter comparison function (comparator mode) and a count capture
function (capture mode). When comparator mode is selected via software, the comparator/capture block can be
used as a PWM waveform or clock generator. When capture mode is selected, this block can be used as a count
capture unit for measuring external event periods/cycles. The comparator circuit generates the compare A and
B signals that represent matching between compare A/B register values (set via software) and the counter value,
and outputs the signals to the TOUT control circuit and the interrupt control circuit. The TOUT control circuit
generates a PWM or other signal from the compare A and B signals and outputs it to the external TOUTA
x
and
TOUTB
x
pins. The capture circuit loads the counter value to the capture A or B register using the CAPA
x
or
CAPB
x
input signal that represents external events issued as a trigger. The interrupt control circuit outputs an
interrupt signal to the interrupt controller (ITC) module according to the interrupt condition that has been set.
Comparator mode and capture mode cannot be used simultaneously in the same channel.
Combination of counter block channel and comparator/capture block channel
Generally, a counter block is connected to the comparator/capture block with the same channel number. The
counter block and the comparator/capture block in different channels can also be connected. This allows a
counter to use two or more comparator/capture blocks for expanding the comparison/capturing function from
two systems to maximum four systems (details are described later).
notes: • The letter ‘
x
’ in register names refers to a channel number (0 or 1).
Example: T16A_CTL
x
register
Ch.0: T16A_CTL0 register
Ch.1: T16A_CTL1 register
• The letter ‘
x
’ in EXCL
x
, CAPA
x
, CAPB
x
, TOUTA
x
, and TOUTB
x
pins refers to a signal number
(Ch.0 = 5, Ch.1 = 6).
Ch.0: EXCL5, CAPA5, CAPB5, TOUTA5, TOUTB5
Ch.1: EXCL6, CAPA6, CAPB6, TOUTA6, TOUTB6
T16a2 input/Output Pins
13.2
Table 13.2.1 lists the input/output pins for the T16A2 module.
2.1 List of T16A2 Pins
Table 13.
Pin name
i/O
Qty
Function
EXCL5
(for Ch.0)
EXCL6
(for Ch.1)
I
2
External clock input pins
Inputs an external clock for the event counter function.
CAPA5, CAPB5
(for Ch.0)
CAPA6, CAPB6
(for Ch.1)
I
4
Counter-capture trigger signal input pins (effective in capture mode)
The specified edge (falling edge, rising edge, or both) of the signal
input to the CAPA
x
pin captures the counter data into the capture A
register. The CAPB
x
pin input signal captures the counter data into the
capture B register.
TOUTA5, TOUTB5 (for Ch.0)
TOUTA6, TOUTB6 (for Ch.1)
O
4
Timer generating signal output pins (effective in comparator mode)
Each channel has two output pins and the signals generated in differ-
ent conditions can be output.
The T16A2 input/output pins (CAPA
x
, CAPB
x
, TOUTA
x
, and TOUTB
x
) are shared with I/O ports and are initially
set as general purpose I/O port pins. The pin functions must be switched using the port function select bits to use the
general purpose I/O port pins as T16A2 input/output pins. Also the external clock input pins (EXCL
x
) are shared
with I/O ports. Setting the port to input mode enables it to be used as the T16A2 input pin with a general-purpose
input function. For detailed information on pin function switching and port control, see the “I/O Ports (P)” chapter.
Count Clock
13.3
The clock controller includes a clock source selector, dividers, and a gate circuit for controlling the count clock.
The count clock can be controlled in each channel individually.