Swordfish will also handle the priority of your Interrupt Service Routines (ISR's). 18F PIC's support twp different Interrupt priority routines. These are known as High and Low Interrupts.
If you require an interrupt that needs priority over everything else (including other interrupts), then you must let the compiler know by setting its priority, eg,
Const ipLow = 1, ipHigh = 2 Interrupt OnTimer1(ipLow) // code statements here End Interrupt Interrupt OnTimer3(ipHigh) // code statements here End Interrupt
Notice that a value of 2 gives a higher priority to OnTimer3. Now if a OnTimer3 interrupt occurs during OnTimer1 interrupt, then the program will stop what it is doing, and go directly to the OnTimer3 handle. When it has finished, it will return to OnTimer1, and continue like nothing happened. Handy.
Note: If you try to Enable(Interrupt_Name) to two interrupt of the same priority, a compiler error will occur. By leaving the Interrupt_Name( ) blank (ie, no 1 or 2 in the brackets), the compiler will assign the priorities automatically.
No comments.
Please login first.
