![](http://datasheet.mmic.net.cn/270000/MC68HC11A8_datasheet_16036735/MC68HC11A8_277.png)
M68HC11
REFERENCE MANUAL
MAIN TIMER AND REAL-TIME INTERRUPT
MOTOROLA
10-11
er bits in these registers are not associated with the timer overflow.
TOI, TOF — Timer Overflow Interrupt Enable, Timer Overflow Flag
The TOF status bit is automatically set to one each time the free-running 16-bit counter
rolls over from $FFFF to $0000. This status bit is cleared by writing to the TFLG2 reg-
ister with a one in the corresponding data bit position (bit 7). The TOI control bit allows
the user to configure the timer overflow for polled or interrupt-driven operation but
does not affect the setting or clearing of the TOF bit. When TOI is zero, timer overflow
interrupts are inhibited, and the timer overflow is operating in a polled mode. In this
mode, the TOF bit must be polled (read) by user software to determine when an over-
flow has occurred. When the TOI control bit is one, a hardware interrupt request is
generated whenever the TOF bit is set to one. Before leaving the interrupt service rou-
tine, software must clear the TOF bit by writing to the TFLG2 register (see
10.2.4 Tips
for Clearing Timer Flags
).
10.2.1.3 Counter Bypass (Test Mode)
In special modes of operation (test and bootstrap), there is a counter bypass function
to simplify testing of the main timer functions. This function is activated by writing a one
to the counter bypass (CBYP) control bit in the TEST1 control register, which can only
be written in the special modes. When CBYP is one, the main timer counter is recon-
figured so that the prescaler is bypassed and the upper and lower halves of the 16-bit
counter are simultaneously driven by the internal PH2 clock. This dramatically reduces
testing time for the main timer.
The functions that are tapped off of the main timer would have erroneous timing while
the CBYP function is enabled. Since this configuration is only possible in special test
modes, it does not interfere with any use of the systems in normal modes.
10.2.2 Real-Time Interrupt (RTI) Function
The RTI function can be used to generate hardware interrupts at a fixed periodic rate.
A common software practice is to organize the routines that compose the software for
an application into a sequence of major subroutine calls. The length of time required
to execute all of the routines is a variable, which depends upon how much each routine
had to do, but the worst-case time to execute the entire sequence of routines should
be known. After completing a pass through all the routines, software enters a delay
mode until a time reference signal is detected. Upon detecting this signal, a jump is
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:
TFLG2 —
Timer Interrupt Flag Register 2
$1025
BIT 7
TOF
0
6
5
4
3
0
0
2
0
0
1
0
0
BIT 0
0
0
RTIF
0
PAOVF
0
PAIF
0
RESET: