On Mon, 31 Jan 2005 16:20:31 +0100 (MET), Jan-Erik Soderholm wrote: > On Sun, 30 Jan 2005 22:13:40 -0700, Robert Rolf wrote: > > > In my application I have a half dozen interrupts going > > at once, so I have to poll the receive flag multiple > > places in the ISR to ensure I don't miss any characters. > > In "multiple places" ?? > > Are you saying that you have some part of your IST taking > to long time to finish, so you have to check other flags and, > if needed, "call" another part of the ISR temporarily ? > > Or, in other words, you are normaly (when not inside the ISR) > letting the interrupt system do it's stuff, but while inside > the ISR, you are actualy polling the receive flag ? > > I'm sure you have thought of moving some of the larger > parts of the ISR out of the ISR, right ? (So it could be > "interrupted" the normal way by the receive interrupt...) > Why didn't that work ? I have an application like that. There are 2 sources of interrupt, an incoming RS232 message at 115,200 baud and a PID control loop at 2Khz. The PID calculations MUST be in the ISR to reduce timing jitter as much as possible (the code originally had the TMR1 interrupt setting a flag that was used in the main loop to start the PID calculations, but the timing jitter was too noticable, and so the calculations were moved into the ISR). And more than 2 characters can come in during the PID calculations, so characters could be lost. The solution was to check the RCIF flag in several places in the ISR and buffer the incoming queue. The extra microsecond or two in strategic locations did not give significant timing jitter in the PID calculations, and no characters were lost. Bill -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist