8/16-Bit Up/Down Counter/Timer Operation - Fujitsu MB90480 Series Hardware Manual

F2mc-16lx 16-bit microcontroller
Table of Contents

Advertisement

13.5 8/16-bit Up/Down Counter/Timer Operation

This section explains different count modes in the 8/16-bit up/down counter/timer and
the operation of the reload/compare function.
Selection of count mode
The 8/16-bit up/down counter/timer has four types of count modes. These count modes are
selected by CCRH: CMS1 or CMS0.
Table 13.5-1 Selection of count mode
CMS1
0
0
1
1
❍ Timer mode (decremented)
In the timer mode, output of the internal prescaler is decremented. The built-in prescaler
enables selection of either 2 machine cycles or 8 machine cycles with CCRH: CLKS.
❍ Up/down count mode
In the up/down count mode, counting the input of external pins AIN and BIN enables an up/
down count. AIN pin input controls increments, and BIN pin input controls decrements.
Input of the AIN pin and BIN pin indicates an edge detection for input, detection edge can be
selected by CCRH: CES1 and CES0.
Table 13.5-2 Selection of edge detection
CES1
0
0
1
1
❍ Phase difference count mode (at frequency multiplied by 2/frequency multiplied by 4)
In the phase difference count mode, to count the encoder phase difference between output
signal phases A and B, the BIN pin input level is checked for counting if the AIN pin input edge
is detected, and the AIN pin input level is checked for counting if the BIN pin input edge is
detected.
In the modes at frequency multiplied by 2 and frequency multiplied by 4, the phase difference is
checked between AIN and BIN pin inputs. If the AIN pin is advanced, it is incremented and, if
the BIN pin is advanced, it is decremented.
CHAPTER 13 8/16-BIT UP/DOWN COUNTER/TIMER
CMS0
0
Timer mode (decremented)
1
Up/down count mode
0
Phase difference count mode: frequency multiplied by 2
1
Phase difference count mode: frequency multiplied by 4
CES0
0
Edge detect prohibit
1
Falling edge detect
0
Rising edge detect
1
Both falling and rising edges detected
Count mode
Detect edge
277

Advertisement

Table of Contents
loading

Table of Contents