An interrupt simply clears INTCON,GIE. If you code in PIC assembler, you could try setting the bit inside the interrupt. Then another interrupt could be generated, but it would just go back to your interrupt vector. Setting a flag to keep track of "interrupt depth" and branching to appropriate interrupt routine might theoretically work, but I think it would be poor practice. I like Marco's general idea better. ---------- > From: James & Ili > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: Interrupt inside an interrupt? > Date: Thursday, March 12, 1998 4:26 PM > > Marco, > Did you read the post by Danjel ? It looks like a simpler way to go. > James > > On Thursday, March 12, 1998 11:52 AM, Marco DI LEO > [SMTP:m.dileo@SISTINF.IT] wrote: > > James & Ili wrote: > > > My idea is to have an interrupt on the start > > > bit, then load the timer with some value and wait for it to time > > > out > > > and generate another interrupt at which time I can check the data > > > line again to get the bit in. Then reset the timer with another > > > value.. etc... Is it possible to have one interrupt more or less > > > inside another interrupt? If so is there anything special that > > > needs > > > to be done? > > > > Strange... I am taking the same approach for the same problem... > > I don't think that you have to worry about an interrupt inside an > > interrupt. > > Just try to do this: > > 1. set the interrupt on the start bit and wait (do your main task) > > 2. when you receive the interrupt on pin change disable it, set the > > timer interrupt to expire in the middle of the first bit and return > > to > > your main > > 3. when the timer expire, sample the bit value, set the timer > > interrupt > > for the next bit and, again, return from interrupt > > 4. repeat step 3 for each bit you expect > > 5. goto step 1 > > > > As you can see you don't have an int in a int but just a sequence > > of > > interrupt one after the other. > > > > Good luck > > Marco > > > > ---- > > Marco DI LEO email: m.dileo@sistinf.it > > Sistemi Informativi S.p.A. tel: +39 6 50292 300 > > V. Elio Vittorini, 129 fax: +39 6 5015991 > > I-00144 Roma > > Italy