
186
CHAPTER 6 8/16-BIT UP/DOWN COUNTER/TIMER
■
Count direction flag
The count direction flag (UDF1 and UDF0) indicates at the time of up/down counting whether
the counting operation preceding the current operation was counting up or down. Based on the
counter clock signal from the input of the AIN and BIN pins, this value of this flag changes for
each count. By checking this flag, the current rotation angle can be determined.
Table 6.6-2 "Count direction flag" summarizes how the count direction flag works.
■
Count direction change flag
The CDCF is set when the counting direction changes between up and down. Simultaneously to
setting this flag, an interrupt request to the CPU can be generated. By referencing the interrupt
and count direction flag, the direction to which counting is changed can be determined.
However, note that when the period of direction change is short and multiple direction changes
are performed in succession, the direction that the flag indicates after the direction change may
return to the original direction so that it appears as if the counting direction has not changed at
all in between.
Table 6.6-3 "Count direction change flag" summarizes how the count direction change flag
works.
■
Compare detection flag
The CMPF is set when the values of UDCR and RCR match during counting. This flag is set for
a match during counting up, match by occurrence of a reloading event, as well as when the
values already match when counting started.
However, a match during counting down (other than a match by compare during reload due to
an underflow) is not regarded as a match, and this flag is not set.
■
Operations for 8 bits x 2 channels and 16 bits x 1 channel
This module can be used as an 8-bit up/down counter for two channels or a 16-bit up/down
counter for one channel. Setting the M16E bit of the CCRH0 register to 0 sets 8 bit mode for two
channels. Setting the bit to 1 sets 16 bit mode for one channel.
For operation in 16 bit mode for one channel, the registers CSR0, CCRL0, CCRH0 are valid and
the CSR1, CCRL1, and CCRH1 registers are invalid. In addition, the AIN0, BIN0, ZIN0 pins are
enabled as input pins, while the AIN1, BIN1, and ZIN1 pins are disabled.
Table 6.6-2 Count direction flag
UDF1, UDF0
Count direction
01
B
Down count
10
B
Up count
11
B
Up/down occurs simultaneously (no counting operation is performed).
Table 6.6-3 Count direction change flag
CDCF
Count direction detection
0
No direction change
1
Counting direction has changed (at least once).
Summary of Contents for MB91150 Series
Page 1: ......
Page 2: ......
Page 3: ...FUJITSU LIMITED FR30 32 BIT MICROCONTROLLER MB91150 Series HARDWARE MANUAL ...
Page 4: ......
Page 10: ...vi ...
Page 112: ...96 CHAPTER 3 MEMORY SPACE CPU AND CONTROL UNIT ...
Page 178: ...162 CHAPTER 5 I O PORTS ...
Page 214: ...198 CHAPTER 7 16 BIT RELOAD TIMER ...
Page 240: ...224 CHAPTER 8 PPG TIMER ...
Page 310: ...294 CHAPTER 13 8 10 BIT A D CONVERTER ...
Page 318: ...302 CHAPTER 14 8 BIT D A CONVERTER ...
Page 362: ...346 CHAPTER 15 UART ...
Page 420: ...404 CHAPTER 19 PERIPHERAL STOP CONTROL ...
Page 428: ...412 CHAPTER 20 CALENDAR MACROS ...
Page 503: ...487 INDEX INDEX The index follows on the next page This is listed in alphabetic order ...
Page 510: ...494 INDEX ...
Page 512: ......