At 09:54 PM 6/25/01 -0400, Drew Vassallo wrote: >> org 4 >>int >> movwf W_TEMP ; "W_TEMP" in Banks 0 and 1 >> movf STATUS, w > >Ouch, Myke. I just realized that this is wrong. > >You can't use "movf STATUS, W" because it can (and will) change the Zero bit >and affect the initial STATUS value. Actually, the above works just fine. What happens is that the original value contained in STATUS gets moved to W. Only after it is in W does STATUS get updated, by which time you don't care anymore because you have a good copy sitting there in W. My normal sequence is: (14 bit core devices) movwf W_SAVE ;save W on whatever page we happen to be in movfw STATUS ;good copy of status in W, status reg now trashed clrf STATUS ;now select ram page 0 movwf S_SAVE ;save status Exiting the ISR is just the reverse: movfw S_SAVE ;get save copy of status movwf STATUS ;status now restored, including current ram page swapf W_SAVE,F ;pre-swap saved copy of W swapf W_SAVE,W ;swap saved copy again, now putting it into W Again, note that you have to reserve W_SAVE on each ram page, at the same offset as page 0. I use W_SAVE1, W_SAVE2, W_SAVE3 to avoid assembler errrors. dwayne Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 17 years of Engineering Innovation (1984 - 2001) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.