|
|
View previous topic :: View next topic |
Author |
Message |
Radomir
Joined: 18 Nov 2005 Posts: 3
|
Interrupt Priority |
Posted: Mon Jun 12, 2006 1:14 pm |
|
|
Hello,
I am using several different interrupts in my code for PIC16F877A.
One of them is #INT_EXT.
I would like to set up this interrupt with highest priority.
It says in the C Compiler Reference Manual to use keywords HIGH and FAST, but there is no explanation how, and there is no example either.
How do I do this? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah Guest
|
|
Posted: Mon Jun 12, 2006 3:04 pm |
|
|
HIGH, and FAST, only apply to the 18 chips.
The manual does say that these only apply to the PCH compiler (which is the compiler vesion for these latter chips), but doesn't explicitly say that the ability is physically 'not there' on the older chips.
On the 16 chips, there is only one actual 'level' of interrupts, and all you can do is in the global handler, change the order in which the interrupts are actually tested.The statement for this is #priority, followed by the interrupts names in use, in the order you want them checked. Alternatively, if this statement is not present, the interrupts are scanned in the order that their handlers are defined in the code.
However you are going to find that the delays will be very significant. If (for instance), the code just enters another interrupt handler, and then the event triggers, the code has to complete the whole of this handler, return from it, including restoring all the saved registers, then execute another interrupt call, save the registers again, and finally execute the required handler...
Even on chips which support hardware priorities (which is what 'high' is designed to handle), there are caveats, since on most (all?), if high priority interrupts are enabled, INT_EXT, will always be 'high'. In your case this would not matter, but for many applications this can be a pain.
I'm afraid your only way to get hardware interrupt priorities, is to upgrade your chip (and compiler, assuming you don't have PCH), to a 18F equivalent.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|