Hi! Thank you all for your help! Int handling is quite simple to understand in PIC, I guess. PIC does very little. 8) I know what I wanted: on a int, the GIE is disabled, and then will be enabled by RETFIE. All other flags, all the registers and whatever cleaning is needed, must be done in SW. Regarding Stack Manipulation, someone suggested me to use C. 8) Well, I'd love to, but the PIC needs to complete certain tasks in less than 64us in my project. So, since they are simple, I stood by assembly. It's not that difficult...I just comment each line, so I don't forget what it does. ;) Have a nice weekend! Nuno Pedrosa. > The response below is correct, but there is one more matter > of interest that must be taken into account. Before performing > the RETFIE you must Clear the appropriate interrupt flag bit. > Failure to do so will cause the interrupt to re-assert itself > over and over again. The "appropriate" flag bit to Clear is > the one associated with the interrupt action taken. In many > programs the user may only have enabled a single form of > interrupt, but often the user will enable multiple interrupt > sources, and in that case the ISR (Interrupt Service Routine) > must poll the interrupt flags, perform the appropriate action, > and then Clear the appropriate interrupt flag just prior to > executing the RETFIE instruction. > > >I think this question is misunderstood. > > > > > >I think Pedro likes to know, what irq-flag is set if e.g. > > >tmr0-irq appears, what flags ar reset/cleared with the retfie > > >instructions. > > > > The GIE flag is the only one that is automatically operated. It is > > always cleared when an interrupt starts (after the last instruction in > > the interrupted program executes, but before the first instruction in the > > ISR executes). This prevents the ISR from being interrupted. The RETFIE > > instruction sets GIE before returning. (The set of GIE is the only > > difference between RETFIE and RETURN.) If an interrupt is still pending > > when the RETFIE executes, the PIC will start again at the top of the ISR > > before executing any of the main program. -- .^. _,^,_ /\ ___( | )_____ Nuno Filipe Freitas Pedrosa __________ o(`} | , __/\/ /__ /*\\|//*\ SIEMENS S.A. Portugal (]| /' \ \/\ \(\\V//)/ mailto:Nuno.Pedrosa@oen.siemens.de (]|`% (") \/\ \ ` -=- ' Tel. :00351-1-4242454 (") /`/ / /\/ __B//|\\P___________________________________________\' / `/______\/____ `-' "Try and leave this world a little better than you found it..."