CHAPTER 9 8-BIT TIMERS 30 AND 40
User’s Manual U14826EJ5V0UD
117
(2) Count value if external clock input from TMI pin is selected
When the external clock signal input from the TMI pin is selected as the count clock, the count value may
start from 01H if the timer is enabled (TCE40 = 0
→
1) while the TMI pin is high. This is because the input
signal of the TMI pin is internally ANDed with the TCE40 signal. Consequently, the counter is incremented
because the rising edge of the count clock is input to the timer immediately when the TCE40 pin is set.
Depending on the delay timing, the count value is incremented by one if the rising edge is input after the
counter is cleared. Counting is not affected if the rising edge is input before the counter is cleared (the
counter operates normally).
Use the timer being aware that it has an error of one count, or take either of the following actions A or B.
<Action A> Always start the timer when the TMI pin is low.
<Action B> Save the count value to a control register when the timer is started, SUB the count value with the
count value saved to the control register when reading the count value, and take the result of
SUB as the true count value.
Figure 9-25. Counting Operation if Timer Is Started When TMI Is High
TCE40
flag
TMI
H
Rising edge
detector
Counter
Clear
Increment
(3) Setting of 8-bit compare register n0
8-bit compare register n0 (CRn0) can be cleared to 00H.
Therefore, one pulse can be counted when the 8-bit timer operates as an event counter.
Figure 9-26. Timing of Operation as External Event Counter (8-Bit Resolution)
TMI input
CR40
00H
TM40
count value
00H
00H
00H
00H
Interrupt request flag
Содержание PD789860
Страница 2: ...User s Manual U14826EJ5V0UD 2 MEMO ...