CHAPTER 9 TIMER/COUNTER FUNCTION
313
User’s Manual U15195EJ5V0UD
(2) Operation in UDC mode
(a) Overview of operation in UDC mode
The count clock input to TM10 in the UDC mode (CMD bit of TUM0 register = 1) can only be externally
input from the TIUD10 and TCUD10 pins. Up/down count judgment in the UDC mode is determined
based on the phase difference of the TIUD10 and TCUD10 pin inputs according to the PRM10 register
setting (there is a total of four choices).
Table 9-8. List of Count Operations in UDC Mode
PRM10 Register
PRM12 PRM11 PRM10
Operation
Mode
TM10 Operation
1
0
0
Mode 1
Down count when TCUD10 = high level
Up count when TCUD10 = low level
1
0
1
Mode 2
Up count upon detection of valid edge of TIUD10 input
Down count upon detection of valid edge of TCUD10 input
1 1 0
Mode
3
Up count upon detection of valid edge of TIUD10 input when
TCUD10 = high level
Down count upon detection of valid edge of TIUD10 input
when TCUD10 = low level
1
1
1
Mode 4
Automatic judgment upon detection of both edges of TIUD10
input and both edges of TCUD10 input
The UDC mode is further divided into two modes according to the TM10 clear conditions (a count
operation is performed only with TIUD10 and TCUD10 input in both modes).
•
UDC mode A (TUM0 register’s CMD bit = 1, MSEL bit = 0)
The TM10 clear source can be selected as only external clear input (TCLR10), a match signal
between the TM10 count value and the CM100 set value during up count operation, or the logical sum
(OR) of the two signals, using bits CLR1 and CLR0 of the TMC10 register. TM10 can transfer the
value of CM100 upon occurrence of a TM10 underflow.
•
UDC mode B (TUM0 register’s CMD bit = 1, MSEL bit = 1)
The status of TM10 after a match of the TM10 count value and CM100 set value is as follows.
<1> In the case of an up count operation, TM10 is cleared (0000H), and the INTCM100 interrupt is
generated.
<2> In the case of a down count operation, the TM10 count value is decremented (
−
1).
The status of TM10 after a match of the TM10 count value and CM101 set value is as follows.
<1> In the case of an up count operation, the TM10 count value is incremented (+1).
<2> In the case of a down count operation, TM10 is cleared (0000H), and the INTCM101 interrupt is
generated.