> Is it generally ok to have about 30 lines of code inside the interrupt > routine? Stephen, hi, you can have as many lines of code as you like inside an ISR. The only proviso is that, generally, if you are expecting another interrupt, the current interrupt processing is finished. Or at least left in a state that you can return to if, for example, a higher priority or other interrupt/event needs processing first If an interrupting source is re-enabled before ISR completion then it's possible to interrupt back into an uncompleted ISR. In that case you'd have to look at something like POPping the stack For example, if you had only one interrupt, say a 1 second timer IRQ, then you could have code inside the ISR that took almost 1 second to complete. And that's a lot of code execution time I think what most people would do is make the ISR short and, if possible or necessary, pass information from the ISR to the main loop. But there's nothing to say that an ISR can't be an entity in itself which completes a task without help from the main loop However, apart from the h/w side of things, which is important of course, an ISR is basically only a sub-routine. The question is not what happens inside the ISR, it's the overall s/w flow management. You, the coder, are in charge, not the chip -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist