CHAPTER 13 8/16-BIT UP/DOWN COUNTER/TIMER
13.1 Overview
The 8/16-bit up/down counter/timer consists of six event input pins, two 8-bit up/down
counters, eight bit reload/compare registers, and their control circuits.
I Major functions of 8/16-bit up/down counter/timer
•
8-bit count register used for counting in a range of 0 to 256 (in the 16 bits x one operation
mode, counting in a range of 0 to 65535 is possible).
•
Four types of count modes can be selected for the count clock.
•
Timer mode
•
Up/down count mode
•
Phase difference decremented mode (two times)
•
Phase difference decremented mode (eight times)
•
In the timer mode, the count clock (for 16 MHz) is selected from two types of internal clocks:
•
125 ns (8 MHz: frequency divided by 2)
0.5 µs (2 MHz: frequency divided by 8)
•
•
In the up/down count mode, a detect edge of the external pin input signal may be selected:
•
Falling edge detect
•
Rising edge detect
•
Both falling and rising edges
•
Edge detect prohibited
•
The phase difference count mode is suitable for counting encoder output such as motor,
where encoder output from phases A, B, and C is used as input, thereby facilitating high-
precision counting of rotation angle and rotations.
•
The ZIN pin is used to select from two types of functions:
•
Counter clear function
•
Gate function
•
Compare and reload functions are provided, where each function or a combination of them
are available. Starting both functions allows up/down counting with any time width.
•
Compare function (an interrupt is issued during compare)
•
Compare function (an interrupt is issued and the counter is cleared during compare)
•
Reload function (an interrupt is issued and reloaded during compare)
•
Compare and reload functions (an interrupt is issued and the counter is cleared during
compare, and an interrupt is issued and reloaded when an underflow occurs)
•
Compare and reload prohibited
•
Interrupt generation is controlled individually during compare, a reload (underflow), or an
overflow.
•
The count direction flag identifies the count direction of the last counter operation
250