On Thursday, July 10, 1997 9:08 AM, pic microcontroller discussion list On Behalf Of Mike Harrison wrote: > Dear All, > I'm working on an interrupt handler and I'd like to use some more general > procedures in the handler, ie call these other procedures. Does anyone know > how this might affect the stack and if this is allowed? > the problems I see are: > 1, If interrupt context stored in general call stack - futher calls may > overflow stack. Yes, if you exceed the number of calls exceeds the hardware stack space in the PIC -- Obviously only the return address part of the context is saved. > 2, If interrupt context stored in interrupt context stack - any calls may > corrupt normal call stack > As long as you don't exceed the stack space with return addresses, you won't corrupt the hardware stack. > Anyone have any guidance on where the interrupt context is saved before > entry to a handler and caveats on calling procedures from a handler? > > cheers > Mike Follow the routines located in the Microchip Data manuals, but add save and restore for PCLATH -- if you use this at all, it is very sneaky if corrupted. Any regs you use in your interrupt routines. In general, I make the Interrupt routines as short as possible and set indicators that are used in the general program flow when time is less critical. If you want specific examples, let me know. Tom