![Seiko Epson S1C17153 Скачать руководство пользователя страница 85](http://html1.mh-extra.com/html/seiko-epson/s1c17153/s1c17153_technical-manual_1235939085.webp)
11 16-BiT PWM TiMeR (T16a2)
11-6
Seiko epson Corporation
S1C17153 TeChniCal Manual
(Rev. 1.0)
half clock mode (hCM = 1)
In half clock mode, T16A2 generates a compare A signal when the dual-edge counter value matches the T16A_
CCA
x
register.
notes
: • T16A2 must be placed into comparator mode to set half clock mode, as it is effective only
when PWM waveform is generated.
Be sure to set T16A2 to normal clock mode (HCM = 0) under a condition shown below.
(1) When T16A2 is placed into capture mode
(2) When TOUTAMD/T16A_CCCTL
x
register is set to 0x2 or 0x3
(3) When TOUTBMD/T16A_CCCTL
x
register is set to 0x2 or 0x3
• The dual-edge counter value cannot be read.
• Do not use the compare A interrupt in half clock mode.
• In half clock mode, the T16A_CCB
x
register setting value must be less than [T16A_CCA
x
set-
ting value / 2 + 0x8000].
Counter Control
11.5
Counter Reset
11.5.1
The counter can be reset to 0 by writing 1 to PRESET/T16A_CTL
x
register.
Normally, the counter should be reset by writing 1 to this bit before starting the count.
The counter is reset by the hardware if the counter reaches the compare B register value after the count starts.
Counter Run/STOP Control
11.5.2
Make the following settings before starting the count operation.
(1) Switch the input/output pin functions to be used for T16A2. Refer to the “I/O Ports (P)” chapter.
(2) Select operating modes. See Section 11.4.
(3) Select the clock source. See Section 11.3.
(4) Configure the timer outputs (TOUT). See Section 11.6.
(5) If using interrupts, set the interrupt level and enable the T16A2 interrupts. See Section 11.7.
(6) Reset the counter to 0. See Section 11.5.1.
(7) Set comparison data (in comparator mode). See Section 11.4.1.
T16A2 provides PRUN/T16A_CTL
x
register to control the counter operation.
The counter starts counting when 1 is written to PRUN. Writing 0 to PRUN disables clock input and stops the
count.
This control does not affect the counter data. The counter data is retained even when the count is halted, allowing
resumption of the count from that data.
If PRUN and PRESET are written as 1 simultaneously, the counter starts counting after reset.
Reading Counter Values
11.5.3
The counter value can be read from T16A2TC[15:0]/T16A_TC
x
register even if the counter is running. However,
the counter value should be read at once using a 16-bit transfer instruction. If data is read twice using an 8-bit trans-
fer instruction, the correct value may not be obtained due to occurrence of count up between readings.