Figure 9.8 Error On Starting Counter Operation; Notes On Using 16-Bit Timer/Counter - Fujitsu F2MC-8L MB89620 Series Hardware Manual

8-bit microcontroller
Table of Contents

Advertisement

8
9.

Notes on Using 16-bit Timer/Counter

This section lists points to note when using the 16-bit timer/counter.
n Notes on Using 16-bit Timer/Counter
Error
l
When using the interval timer function, activating the counter by program is not synchronized
with the start of counting-up using the internal count clock. Therefore, the time until a counter
overflow occurs may be shorter than the theoretical time by a maximum of one instruction cycle.
Figure 9.8 shows the error that occurs on starting counter operation.
Timer count register (TCR) value
Count clock
Notes on setting by program
l
Write to the TCR register when counter operation is stopped (TMCR: TCS = "0"). Reading
can be performed during counter operation, but always use word transfer instructions (such
as MOVW A, dir).
Stop the counter (TMCR: TCS = "0"), disable interrupts (TCIE = "0"), and clear the interrupt
request flag (TCEF = "0") before modifying the counter operating mode selection bits
(TMCR: TCS1, TCS0).
Interrupt processing cannot return if the interrupt request flag bit (TMCR: TCEF) is "1" and
the interrupt request enable bit is enabled (TMCR: TCIE = "1"). Always clear the TCEF bit.
The interrupt request flag bit (TMCR: TCEF) is not set if the counter is cleared (TMCR: TCR
= "0") at the same time as the counter value overflows.
MB89620 series
Set value: n
n+1
One cycle
Cycle of
Error
set value n
Counter activate

Figure 9.8 Error on Starting Counter Operation

n+2
n+3
CHAPTER 9 16-BIT TIMER/COUNTER
n+4
193

Advertisement

Table of Contents
loading

Table of Contents