I wrote: >> The >>microchip docs make a big deal out of STATUS and W, but they don't really >>mention about saving FSR, the current BANKx and a few other things you might >>be using. Then Bob wrote: >I think that the reason Microchip is so explicit about STATUS and W is >that's it's really tough to do *anything* without affecting them in >some way. If your interrupt routine modifies FSR, then, obviously, it >needs to be saved and restored but saving and restoring STATUS will >take care of your bank bits, won't it? This is true about the STATUS reg and the BANK as far as the main level will be ok, but the interrupt routine may not realize that it's in BANK1 when it tries to reload TMR0 and clobbers the OPTION register. :-O To be honest, I've been cheating on the side (with some other micros) and am a little rusty on the PIC minutiae right now. ;-) I was just trying to point out that there are a few more "gotcha's" than the datasheet "clearly" indicates. ;-) Regards, Bob >>Go thru your main level code and try to imagine an interrupt >>occurring between any two instructions, eventually that is what happens at >>run time. >It might be more productive to first re-check the interrupt routine >itself to ensure that it isn't modifying something that it's not >preserving across interrupts. Anything used in the interrupt routine >is suspect but can be desk-checked for being properly preserved across >the call. True again, but I still will bet on the OPTION register or jmp'ing across pages. ;-) Regards, Bob -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body