17 16-BIT PWM TIMERS (T16B)
17-6
Seiko Epson Corporation
S1C31D50/D51 TECHNICAL MANUAL
(Rev. 2.00)
Counter status check
The counter operating status can be checked using the T16B_
n
CS.BSY bit. The T16B_
n
CS.BSY bit is set to 1
while the counter is running or 0 while the counter is idle.
The current count direction can also be checked using the T16B_
n
CS.UP_DOWN bit. The T16B_
n
CS.UP_
DOWN bit is set to 1 during count up operation or 0 during count down operation.
Operations in repeat up count and one-shot up count modes
In these modes, the counter operates as an up counter and counts from 0x0000 (or current value) to the MAX
value.
In repeat up count mode, the counter returns to 0x0000 if it exceeds the MAX value and continues counting
until the T16B_
n
CTL.RUN bit is set to 0. If the MAX value is altered to a value larger than the current counter
value during counting, the counter keeps counting up to the new MAX value. If the MAX value is altered to a
value smaller than the current counter value, the counter is cleared to 0x0000 and continues counting up to the
new MAX value.
In one-shot up count mode, the counter returns to 0x0000 if it exceeds the MAX value and stops automatically
at that point.
Counter
0xffff
0x0000
(1) Repeat up count mode
Count cycle
Time
MAX value
MAX value
Software operation
Hardware operation
RUN = 1
RUN = 1
RUN = 1
RUN = 1
MODEN = 1
PRESET = 1
PRESET = 1
RUN = 0
Counter
0xffff
0x0000
(2) One-shot up count mode
Time
Data (W)
→
MC[15:0]
Data (W)
→
MC[15:0]
Data (W)
→
MC[15:0]
Data (W)
→
MC[15:0]
Data (W)
→
MC[15:0]
MODEN = 1
RUN = 0
RUN = 0
Figure 17.4.2.1 Operations in Repeat Up Count and One-shot Up Count Modes
Operations in repeat down count and one-shot down count modes
In these modes, the counter operates as a down counter and counts from the MAX value (or current value) to
0x0000.
In repeat down count mode, the counter returns to the MAX value if a counter underflow occurs and continues
counting until the T16B_
n
CTL.RUN bit is set to 0. If the MAX value is altered during counting, the counter
keeps counting down to 0x0000 and continues counting down from the new MAX value after a counter under-
flow occurs.
In one-shot down count mode, the counter returns to the MAX value if a counter underflow occurs and stops
automatically at that point.