View previous topic :: View next topic |
Author |
Message |
rhaguiuda
Joined: 05 Sep 2007 Posts: 46 Location: Londrina - Brazil
|
Service one interrupt within another |
Posted: Fri Jan 09, 2009 11:51 am |
|
|
HI.
In my application I have external interrupt enable. I also have the RDA interrupt enable, for receiving serial data from USART.
I need that the RDA interrupt keeps working (interrupting), while INT_EXT code is executing. Is that possible?
If not, any alternatives?
PIC is 16F876.
Thanks. _________________ Give a man a fish and you'll feed him for a day. Teach a man to fish, and you'll feed him for a lifetime. |
|
![](templates/subSilver/images/spacer.gif) |
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Fri Jan 09, 2009 12:01 pm |
|
|
If you use a PIC18F or PIC24F you can have multiple interrupt priorities. In this case high priority interrupts can interrupt low priority interrupts.
Failing that, you need to look at the toime you are spending in the interrupt hanlder. The serial interrupt is generally forgiving because if an interrupt even occurs inside the interrupt handler you have an entire character time to finish processing the external interrupt before the next character is received and an interrupt generated.
Does you external interrupt process take longer than a character time? If so - perhaps you should look at how to move the processing into the main bodey of code such that the external interrupt handler merely sets/clears flags for subsequent processing in the main code body.
Alternatively, you could sample the serial interrupt flag multiple times within the external interrupt handler if necessary to process a character. If you are using a ring buffer for receiving incoming data (no serial command processing in the serial interrupt handler) then this approach may be suitable. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
![](templates/subSilver/images/spacer.gif) |
|