Josh Koffman wrote: > At the start of my ISR, I save WREG, STATUS, and BSR (this is a > PIC18F) to temporary registers. I then restore them on exit. I've been > tracking a bug that seems to be manifesting itself due to incorrect > bank selection. Here's why I think this is happening, look at the > addresses of the following registers: > > W_Temp 0x080 > PORTA 0xF80 > > The other registers have similar overlapping low byte addresses. > So...going into my ISR I might not be in the correct bank. But if I > change the bank, I've upset the current state and things won't get > restored correctly. > > I'm not really sure what to do on this one. There is a lot I could say about banking on PICs, but I won't under the current conditions. However, there is code freely available on my web site that solves exactly this issue. > I suppose I could use a > lot of banksel commands (and that's likely what I'm going to try while > waiting to see what everyone else thinks), but is there a better way? Absolutely, especially considering that this way won't work. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist