Periodic Interrupt Timer and Real Time Interrupt (PIT_RTI)
MPC5510 Microcontroller Family Reference Manual, Rev. 1
Freescale Semiconductor
28-11
Preliminary
28.4.3.1
Real-Time Interrupt
The PIT_RTI generates a real-time interrupt when the selected interrupt time period elapses. The RTI
interrupt is disabled locally by setting the RTIE bit to 0. The real time interrupt flag (RTIF) is set to 1 when
a timeout occurs, and is cleared to 0 by writing a 1 to the RTIF bit.
28.4.3.2
Timer Interrupts
The PIT can also generate timer interrupts on all eight timer channels when the timer’s selected interrupt
period elapses. Timer interrupts are disabled locally by setting the TIE bits to 0. The timer interrupt flags
(TIF) are set to 1 when a timeout occurs on the associated timer and are cleared to 0 by writing a 1 to that
TIF bit. To activate a timer interrupt it must also be switched from trigger mode into interrupt mode, using
the PITINTSEL register.
The timer interrupts are general-purpose interrupts.
28.5
Initialization and Application Information
28.5.1
Example Configuration
In the example configuration:
•
The PIT clock has a frequency of 50 MHz
•
The RTI clock has a frequency of 10 MHz
•
The RTI timer shall be set up to create a wakeup interrupt every 500 ms
•
Timer 1 shall create an interrupt every 5.12 ms
•
Timer 8 shall create a trigger event every 30 ms.
First the PIT module needs to be activated by writing a 0 to the MDIS bit in the PITCTRL register.
The 50 MHz clock frequency equates to a clock period of 20 ns and the 10 MHz frequency equates to a
clock period of 100 ns. Therefore the RTI timer needs to trigger every 500 ms/100 ns = 5000000 cycles,
timer 1 needs to trigger every 5.12 ms/20 ns = 256000 cycles, and timer 8 needs to trigger every
30 ms/20 ns = 1500000 cycles. The value for the TVAL register trigger would be calculated as (period /
clock period) –1.
This means that TVAL0 will be written with 004C4B3F hex, TVAL1 with 0x0003_E7FF, and TVAL8 with
0x0016_E35F.
Table 28-10. PIT Interrupt Vectors
Interrupt Source
Local Enable
Real-time interrupt
RTIE
Timer interrupts
TIE8:1