Motorola MPC823e Reference Manual page 479

Microprocessor for mobile computing
Table of Contents

Advertisement

16.2.6.8 RISC TIMER INTERRUPT HANDLING EXAMPLE. An interrupt handler for the
RISC timer tables is normally written in the following sequence:
1. Once an interrupt occurs, the RTER is read to determine which of the timers have
caused interrupts. The RISC timer event bits are usually cleared by this time.
2. Any additional SET TIMER commands are issued. You do not have to do anything if
the timer is automatically being restarted for a repetitive interrupt.
3. The R-TT bit is cleared in the CPM interrupt status register.
4. Execute the rfi instruction.
16.2.6.9 RISC TIMER TABLE ALGORITHM. The RISC microcontroller scans the timer
table once every tick. For each valid timer in the table, the microcontroller decrements the
count and checks for a timeout and if no timeout occurs, it moves to the next timer. If a
timeout does occur, the microcontroller sets the corresponding event bit in the RISC timer
event register. Then it checks to see if the timer needs to be restarted and if it does, it leaves
the R_TMV register and resets the current count to the initial count. Otherwise, it clears the
R_TMV register. Once the timer table is scanned, the microcontroller updates the TM_CNT
value in the RISC timer table parameter RAM and stops working on the timer tables until the
next tick. If a SET TIMER command is issued, the microcontroller makes the appropriate
modifications to the timer table and parameter RAM, but does not scan the timer table until
the next tick of the internal timer. If you modify the RISC timer table, execute the SET TIMER
command to synchronize the timers so that the microcontroller will operate properly.
16.2.6.10 USING THE TIMERS TO TRACK MICROCONTROLLER LOADING. The
following sequence of steps is a method for using the 16 timers to determine if the
microcontroller ever exceeds the 96% utilization level during a tick interval. Removing the
timers adds a 4% margin to the microcontroller's utilization level, but an aggressive user can
use this technique to push the microcontroller performance to its limit. You must use the
standard initialization sequence, but incorporate the following steps:
1. Program the tick of the RISC microcontroller timers to be 1,024 × 16 = 16,384.
2. Disable microcontroller timer interrupts, as required.
3. Using the SET TIMER command, initialize all 16 RISC microcontroller timers to have
a timer period of 0x0000, which equals 65,536.
4. Program one of the four general-purpose timers to increment once every tick. The
general-purpose timer must be free-running and have a timeout of 65,536.
5. After a few hours of operation, compare the general-purpose timer to the current count
of RISC microcontroller timer 15 and if the difference between them exceeds two ticks,
the microcontroller has, during some tick interval, exceeded the 96% utilization level.
Note: The general-purpose timers are up-counters, but the RISC microcontroller timers
are down-counters. You must take this under consideration when comparing
timer counts.
MOTOROLA
MPC823e REFERENCE MANUAL
Communication Processor Module
16-25

Advertisement

Table of Contents
loading

Table of Contents