buy hot The Fixer cool video Year One download Kasabian album nice Terminator Salvation hit cool track Jordin Sparks USA Whatever Works video download Check My Brain melodies nice video Finding Nemo nice Pop - Various Artists hit cheap DIVX Year One

digital-diy.com

Swordfish Code Snippet - Interrupt Priority Print E-mail
( 0 Votes )
  
Saturday, 04 April 2009 10:24

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.

Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
Security
Please input the anti-spam code that you can read in the image.
Last Updated ( Tuesday, 14 April 2009 10:09 )
 

Whos Online

  • Jon Chandler
  • MrDEB

Forum Activity