Harold : I don't have the manual now neither remember the details, but the answer is there. Search for "context saving" on the manual. The C18 compiler only automatically saves the basic registers, others used as the table pointers are not automatically saved during interrupts. There is a pragma instrucction to especify whitch registers must be saved during context saving. There is also a "feature" related to a non safe return values greater than 4 bytes when using interrupts. (It's on the README file). Oscar T.=20 -----Mensaje original----- De: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU] En nombre de Harold Hallikainen Enviado el: Mi=E9rcoles, 30 de Junio de 2004 10:30 a.m. Para: PICLIST@MITVMA.MIT.EDU Asunto: [PIC:] C18 and Interrupts I think I'm running into problems with variable corruption during interrupts. This MAY be due to bank switching going in and out of interrupts (forcing the variables used in the ISR into access RAM seems to fix the problem). Generally, I want some global variables that the interrupts can change (things like ram timers that are decremented by timer interrupts, uart buffers, etc.). The Microchip C18 manual does not seem to give very thorough information on interrupts (and the manuals seem to be getting worse... the older manuals I have are more complete). So, can someone give me a definitive list of what I need to do in declaring variables in a C interrupt service routine to have them work right? Does the interrupt pragma set up and restore the bank register so my main line code still knows where its variables are? THANKS! Harold -- FCC Rules Online at http://www.hallikainen.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.