16
5. Interrupt Service Routines Overview:
Overview:
The 68HC12 provides a wide array of interrupts that can be used by the programmer.
Some of these are similar to interrupts found on the 68HC11, such as the RTI and
timer overflow. Others are new to the 68HC12 such as the key wakeups and A/D
converter interrupts. This section will cover all the different ISRs and how they
operate.
Interrupts on the 68HC12 are controlled in part through the D-Bug12 monitor
program. The SetUserVector routine in the D-Bug12 monitor is used to program the
ISR vector table that tells the processor where the different ISRs are located in
memory.
When using a particular interrupt the ISR must be assigned to the interrupt in the
beginning of the program. Each interrupt has an address offset to the interrupt
vector table base address, which is stored in the D-Bug12 header file. When
assigning the interrupt, SetUserVector is called and the name of the interrupt as
well as the ISR name are passed as parameters. This will store the address of the
ISR in the vector table.
For example: If you are using the Real Time Interrupt (RTI) and have it call an ISR
called RTIInt when it is triggered, the code would look like:
DB12->SetUserVector(RTI, RTIInt);
The list below is all of the interrupts and their mnemonics:
AtoD
A to D converter interrupt
PAEdge
Pulse Accumulator Edge triggered
PAOvf
Pulse Accumulator Overflow triggered
TimerOvf
Timer Overflow
Timer7
Timer 7
Timer6
Timer 6
Timer5
Timer 5
Timer4
Timer 4
Timer3
Timer 3
Timer2
Timer 2
Timer1
Timer 1
Timer0
Timer 0
RTI
Real Time Interrupt
IRQ
IRQ interrupt
XIRQ
XIRQ interrupt
The format of the ISR is show below. All ISRs follow this format.
_
_mod2_
_ void RTIInt()
{
// your code here
}
It also must include a function prototype of the format:
_
_mod2_
_ void RTIInt();
Note: There are 2 underscores both before and after the mod2.