Communication Processor Module
MOTOROLA
MPC823 USER’S MANUAL
16-27
RISC
COMMUNICATION
16
PROCESSOR
MODULE
16.2.7.8 RISC TIMER INTERRUPT HANDLING EXAMPLE. The following sequence
shows what is normally written in an interrupt handler for the RISC timer tables:
1. Once an interrupt occurs, read the RTER to see which timers have caused interrupts.
The RISC timer event bits are usually cleared by this time.
2. Issue any additional SET TIMER commands now or later, whichever you prefer. You
do not have to do anything if the timer is automatically being restarted for a repetitive
interrupt.
3. Clear the R-TT bit in the CPM interrupt status register.
4. Execute the rfi instruction.
16.2.7.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.7.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 should 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 should 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 should take this under consideration when comparing
timer counts.