|
|
View previous topic :: View next topic |
Author |
Message |
xpercad Guest
|
Interrupt handling |
Posted: Thu Jun 24, 2004 5:53 pm |
|
|
I am using PIC18F452 and PCWH 3.202 and two interrupt sources (INT_EXT0 and TIMER_0).
INT_EXT0 is used for servicing an SPI interfaced decoder, and TIMER_0 is used for timing functions. My application requires that the service routine for TIMER_0 should be interrupted if INT_EXT0 becomes active. The service routine for INT_EXT0 is not "very" fast and a bit complex. From what I have read, using the FAST directive is a dangerous matter.
Can anybody shed some light as to how to handle this situation ???
Any kind of help will ge highly appreciated !!!
Aaron |
|
|
Ttelmah Guest
|
Re: Interrupt handling |
Posted: Fri Jun 25, 2004 2:37 am |
|
|
xpercad wrote: | I am using PIC18F452 and PCWH 3.202 and two interrupt sources (INT_EXT0 and TIMER_0).
INT_EXT0 is used for servicing an SPI interfaced decoder, and TIMER_0 is used for timing functions. My application requires that the service routine for TIMER_0 should be interrupted if INT_EXT0 becomes active. The service routine for INT_EXT0 is not "very" fast and a bit complex. From what I have read, using the FAST directive is a dangerous matter.
Can anybody shed some light as to how to handle this situation ???
Any kind of help will ge highly appreciated !!!
Aaron |
FAST, is OK, _provided you have a recent chip_. The problem is that there is a hardware fault with the first couple of years production of the chips, which prevents fast interrupts from reliably working where the source is asynchronous (an external event is).
Also when using fast, you become responsible for saving and restoring the registers.
Given the event is not 'very' fast, can't you just rely on the normal handling?. If you use the priority statement, the external interrupt can be set to be handled 'ahead' of the timer interrupt. Alternatively, assuming your interrupt routines are well written (_short_), perhaps only setting a flag, then add a test at the end of the timer routine, and if the external interrupt has occured set the flag for this here, and clear the interrupt flag, which avoids the time delay involved in exiting this routine before the second interrupt handler is called.
Best Wishes |
|
|
xpercad Guest
|
|
Posted: Fri Jun 25, 2004 8:25 am |
|
|
Thanks a lot for your advise and best wishes to you too !!! |
|
|
|
|
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
|