Michael Rigby-Jones wrote : > >Let the TMR1IF generate an interrupt (as now). Then in the ISR > >just set your own "PID-flag" saying that your PID routine has > >to be run now (or rather "soon"). Then leave the ISR and let > >your main-loop detect your PID-flag and run the PID code. > >During that time, you are able to service other interrupts > >like the UART receive interrupt. > > Note that there is no need to even have an interrupt if it's > only purpose is to set a flag. Simple using the TMR1IF flag > in the main loop will work fine without the extra interrupt > overhead. Correct. Maybe I was thinking of one project of my own where I did something similar. In that case I actulay had *some* processing in the TMR-ISR. Such as updating an secondary counter and, if *that* also overflowed, set an second flag for another task to be run and re-initalized that counter. Then I leaved the ISR to let the mail code process one (or sometimes two) tasks. Anyway, my main point is that stuffing to much into the ISR, doesn't make you PIC run faster, it just prevents *other* interrupts to be serviced timely... Jan-Erik. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu