CHAPTER 6 8/16-bit Up/Down Counters/Timer and U-Timers
Figure 6.1-9 Timing of UDCR Clearing when Counting is Stopped
If reloading or clearing occurs while the counter is stopped, reload and clear are performed when the
event occurs (the figure shows the state when 080
Figure 6.1-10 shows the timing of UDCR reloading and clearing when counting is stopped.
Figure 6.1-10 Timing of UDCR Reloading and Clearing when Counting is Stopped
Clear by compare is performed when the values of the UDCR and the RCR match and while counting up.
Even when the values of RCR and UDCR match, clearing is not performed if down counting occurs or
counting is stopped after a match or if up counting occurs after the value of RCR is rewritten.
As for the timing of clearing and reloading, the clear operation follows the above timing for all events other
than reset input, and reloading also uses the above timing for all events.
When the events for clearing and reloading occur at the same time, the clear event takes priority.
■ Writing Data to the Up/Down Count Register (UDCR)
Data cannot be written to the UDCR directly from the data bus. To write arbitrary data to the UDCR,
follow the procedure below.
1. Write the data that is to be written to the UDCR first to the RCR (Note that this means that the original
data in the RCR will be lost).
2. By setting the CTUT of the CCR to "1", data is transferred from the RCR to the UDCR.
Perform the above operation while counting is stopped (when the CSTR bit of the CSR is "0"). If "1" is
written to the CTUT bit by mistake during counting, the value of the RCR is transferred to the UDCR at the
timing for a write.
Besides the above procedure, the following procedure can also be applied to clear the counter.
Clearing by reset input (initialization).
Clearing by edge input through the ZIN pin.
Clearing by writing "0" to UDCC of the CCR.
Clearing by compare.
The above can be performed regardless of the status of the counter (regardless of whether counting is
performed or stopped).
Enable (counting permitted)
Disable (counting prohibited)