Fujitsu FR81S User Manual
CHAPTER 27: UP/DOWN COUNTER
6. Operation and Setting Procedure Examples
FUJITSU SEMICONDUCTOR LIMITED
CHAPTER : UP/DOWN COUNTER
FUJITSU SEMICONDUCTOR CONFIDENTIAL
FUJITSU SEMICONDUCTOR CONFIDENTIAL
27
6.2. Operation in Up/down Count Mode
This section explains the operation in up/down count mode.
Overview
In this mode, the up/down counter counts up/down with count clocks that are external signals entered from
the AIN and BIN pins.
the AIN and BIN pins.
When the external signal is entered from the AIN pin, the up/down counter counts up. When the external
signal is entered from the BIN pin, the up/down counter counts down.
signal is entered from the BIN pin, the up/down counter counts down.
Which edge of the external signal is used to trigger counting is determined by the CES1 and CES0 bits of
the counter control register (CCR) as follows.
the counter control register (CCR) as follows.
· Falling edge (CES1, CES0=01)
· Rising edge (CES1, CES0=10)
· Both edges (CES1, CES0=11)
· Rising edge (CES1, CES0=10)
· Both edges (CES1, CES0=11)
In up/down count mode, the following three functions can be used.
· Reload function
· Compare function
· Reload compare function
· Compare function
· Reload compare function
Counting
Normal operation
When the effective edge is entered from the AIN pin while the counter is enabled to operate, the counter
counts up. When it is entered from the BIN pin while the counter is enabled to operate, the counter counts
down.
counts up. When it is entered from the BIN pin while the counter is enabled to operate, the counter counts
down.
When the counter changes its counting direction from counting up to counting down or vice versa, the
CDCF bit of the counter control register (CCR) changes to "1". At this time, a counting direction change
interrupt request occurs if the CFIE bit of the counter control register (CCR) is set to "1".
CDCF bit of the counter control register (CCR) changes to "1". At this time, a counting direction change
interrupt request occurs if the CFIE bit of the counter control register (CCR) is set to "1".
If the CGSC bit of the counter control register (CCR) is set to make the ZIN pin work for the gate function
(CGSC=1), the counter will only count while the effective level specified by the CGE1 and CGE0 bits is
entered from the ZIN pin.
(CGSC=1), the counter will only count while the effective level specified by the CGE1 and CGE0 bits is
entered from the ZIN pin.
For information on effective level setting, see "4.3. Counter Control Register (CCR0, CCR1)".
Note:
The minimum pulse width required at the AIN, BIN, and ZIN pins is 2T (T is the cycle of the peripheral
clock (PCLK)).
clock (PCLK)).
MB91520 Series
MN705-00010-1v0-E
1034