Craig Anderson wrote: > I'm designing an application in which i would really like to have > two interrupt sources. One of the interrupts is highly time > critical (A) and the other (B) is not. It will be running on a > 16f628. Interrupts A and B will occur at regular, but effectively > random intervals. > > While servicing the interrupt for B i need to be able to process > an interrupt for A and then return back to where i was in the > interrupt service routine for B. > > Is this practical? or should i redesign the application to avoid > having to do this? If it's ok, then how do i deal with context > saving? Craig: Write your "A" interrupt service routine normally (i.e., do whatever you have to do when the "A" event occurs, then return from interrupt). In your "B" interrupt service routine, just set a flag and return from interrupt. Check that flag in your main (non-interrupt) loop and handle the "B" event there. -Andy P.S. Actually... Depending on your application, you can probably dispense with the "B" interrupt service routine altogether; instead of setting your own flag and checking it in the main loop, just disable the "B" interrupt and check the "B" interrupt flag (which will still be set, but will not generate an interrupt) in the main loop. === Andrew Warren -- aiw@cypress.com === Principal Design Engineer === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.