Precautions; Timer Mode; Event Counter Mode - Renesas M16C Series User Manual

16-bit single-chip microcomputer
Hide thumbs Also See for M16C Series:
Table of Contents

Advertisement

M30240 Group

2.2.3 Precautions

2.2.3.1 Timer mode

(1) At reset, the count start flag is set to "0". Set a value in the Timer Ai register, then set the flag to "1".
(2) Reading the Timer Ai register while a count is in progress allows reading, with arbitrary timing, the
value of the counter. Reading the Timer Ai register with the reload timing shown in Figure 2.29 gets
"FFFF
". Reading the Timer Ai register after setting a value in the Timer Ai register with a count halted
16
but before the counter starts counting gets a proper value.
Figure 2.29: Reading Timer Ai register in Timer mode

2.2.3.2 Event counter mode

(1) At reset, the count start flag is set to "0". Set a value in the Timer Ai register, then set the flag to "1".
(2) Reading the Timer Ai register while a count is in progress allows reading, with arbitrary timing, the
value of the counter. Reading the Timer Ai register with the reload timing shown in Figure 2.30 gets
"FFFF
" by underflow or "0000
16
Timer Ai register with a count halted but before the counter starts counting gets a proper value.
(3) Please note the standards for the differences between the 2 pulses used in the 2-phase pulse signals
input signals to the TAi
(4) In the case of using "Event counter mode" as a "Free-Run type" timer, register contents may be
unknown when the counting begins. If the timer register is set before counting has started, then the
starting value will be unknown.
This issue will occur only for the "Event counter mode" operating as "Free-Run type". The value of the
timer register will be unknown during counting.
Countermeasure
• In the case where the up/down count will not be changed.
Enable the "Reload" function and write to the timer register before counting begins. Rewrite the value
to the timer register immediately after counting has started.
If counting up, rewrite "0000
If counting down, rewrite "FFFF
This will cause the same operation as "Free-Run type" mode.
• In the case where the up/down count has changed.
First set to "Reload type" operation. Once the first counting pulse has occurred, the timer may be
changed to "Free-Run type".
Rev.1.00 Sep 24, 2003 Page 169 of 360
2
Counter value (Hex.)
2
Read value (Hex.)
n = reload register content
" by overflow. Reading the Timer Ai register after setting a value in the
16
pin and TAi
pin (i = 2, 3, 4), as shown in Figure 2.31.
IN
OUT
" to the timer register.
16
" to the timer register.
16
Reload
1
0
n
n – 1
1
0
FFFF
n – 1
Time
Timer A

Advertisement

Table of Contents
loading

Table of Contents