MOTOROLA
10-10
MAIN TIMER AND REAL-TIME INTERRUPT
M68HC11
REFERENCE MANUAL
The following register and paragraphs explain the prescaler select bits, PR1 and PR0,
which are in the timer mask register 2 (TMSK2). The other bits in this register are not
related to the timer prescaler.
PR[1:0] — Timer Prescaler Select
These two bits select the prescale rate for the main 16-bit free-running timer system.
Table 10-1
shows the relationship between the prescale factor and the value of these
control bits. A prescale factor of one corresponds to an E divided by one rate for the
main timer; whereas, a prescale factor of 16 corresponds to a timer count rate of E
divided by 16. In normal modes, this prescale rate can only be changed once within
the first 64 bus cycles after reset, and the resulting count rate stays in effect until the
next reset.
Table 10-1 Crystal Frequency vs. PR1, PR0 Values
10.2.1.2 Overflow
In cases where periods greater than the range of the timer counter have to be mea-
sured or produced, the timer overflow must be used, which is similar to measuring
times greater than 60 seconds by using the seconds display of a digital clock. The
minute and hour displays can be thought of as software counters, which extend the
range of the seconds counter. Each time the seconds counter overflows (goes from 59
to 0), the minutes counter is incremented. If a period less than 60 seconds is desired,
add (modulo 60) the desired number of seconds to the starting time to get the ending
time.
In the MC68HC11A8, the timer overflow flag (TOF) status bit is set each time the timer
counter overflows from $FFFF to $0000. This bit can optionally generate an automatic
interrupt request each time it is set by setting the timer overflow interrupt (TOI) enable
bit in the timer mask register 2 (TMSK2). Software must acknowledge that it has seen
the overflow condition by clearing the TOF status indicator. The free-running counter
continues to run even if the TOF status indicator is not cleared. If overflow indications
are not important to a particular application, they may be ignored. The following regis-
ters and paragraphs describe the TOF status bit and the TOI interrupt enable. The oth-
TMSK2 —
Timer Interrupt Mask Register 2
$1024
BIT 7
TOI
0
6
5
4
3
0
0
2
0
0
1
BIT 0
PR0
0
RTII
0
PAOVI
0
PAII
0
PR1
0
RESET:
PR1
PR0
Prescale Fac-
tor
Crystal Frequency
8 MHz
2
23
Hz
One Count (Resolution)/Overflow (Range)
477 ns/31.25 ms
191
μ
s/125 ms
3.81
μ
s/250 ms
7.63
μ
s/.05 s
8
μ
s/524.3 ms
2.1 MHz
2 MHz
Bus Frequency (E Clock)
4 MHz
0
1
1
1
0
0
0
1
1
4
8
16
500 ns/32.77 ms
2
μ
s/131.1 ms
4
μ
s/62.1 ms
1
μ
s/65.54 ms
4
μ
s/262.1 ms
8
μ
s/524.3 ms
16
μ
s/1.049 s
1 MHz