Epson S1C17W03 Technical Manual page 178

Cmos 16-bit single chip microcontroller
Table of Contents

Advertisement

(3) Repeat up/down count mode
PRESET = 1
RUN = 1
0xffff
Compare period
during counting up
Counter
0x0000
(Note that the T16BnINTF.CMPCAPmIF/CNTMAXIF/CNTZEROIF bit clearing operations via software are omitted from the figure.)
The time from counter = 0x0000 or MAX value to occurrence of a compare interrupt (compare period) and the
time to occurrence of a counter MAX or counter zero interrupt (count cycle) can be calculated as follows:
During counting up
Compare period = — — — — — — — [s]
During counting down
Compare period = — — — — — — — — — — [s]
Where
CC:
MAX:
f
: Count clock frequency [Hz]
CLK_T16B
The comparator MATCH signal and counter MAX/ZERO signals are also used to generate a timer output wave-
form (TOUT). Refer to "TOUT Output Control" for more information.
Compare buffer
The comparator loads the comparison value, which has been written to the T16BnCCRm register, to the
compare buffer before comparing it with the counter value. For example, when generating a PWM wave-
form, the waveform with the desired duty ratio may not be generated if the comparison value is altered
asynchronous to the count operation. To avoid this problem, the timing to load the comparison value to the
compare buffer can be configured using the T16BnCCCTLm.CBUFMD[2:0] bits for synchronization with
the count operation.
(1) Repeat up count mode
(1.1) T16BnCCCTLm.CBUFMD[2:0] bits = 0x0
Data (W) → CC[15:0]
Data (W) → MC[15:0]
MODEN = 1
PRESET = 1
RUN = 1
0xffff
Count cycle
Compare period
Counter
0x0000
S1C17W03/W04 TECHNICAL MANUAL
(Rev. 1.2)
Count cycle
Compare period
during counting down
CNTMAXIF = 1
CMPCAPmIF = 1
CMPCAPmIF = 1
Figure 15.4.3.1 Operation Examples in Comparator Mode
(CC + 1)
f
CLK_T16B
(MAX - CC + 1)
f
CLK_T16B
T16BnCCRm register setting value (0 to 65,535)
T16BnMC register setting value (0 to 65,535)
Data (W) → CC[15:0]
CNTMAXIF = 1
CMPCAPmIF = 1
Seiko Epson Corporation
CNTZEROIF = 1
CMPCAPmIF = 1
(MAX + 1)
Count cycle = — — — — — — — — [s]
f
CLK_T16B
(MAX + 1)
Count cycle = — — — — — — — — [s]
f
CLK_T16B
Data (W) → CC[15:0]
CNTMAXIF = 1
CMPCAPmIF = 1
CMPCAPmIF = 1
15 16-BIT PWM TIMERS (T16B)
MAX value
(T16BnMC register)
Comparison value
(T16BnCCRm register)
Time
CNTMAXIF = 1
(Eq. 15.1)
(Eq. 15.2)
Software operation
Hardware operation
MAX value
(T16BnMC register)
Compare buffer
value
Time
CNTMAXIF = 1
CMPCAPmIF = 1
15-9

Advertisement

Table of Contents
loading

This manual is also suitable for:

S1c17w04

Table of Contents