"Aubrey McIntosh, Ph.D." wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I was looking at page 16 of 30292c.pdf, the PIC 16F87x Data Sheet. Figure > 2-4, the 16F874/73 register map shows two banks of General Purpose > registers, 0x20 -- 0x7F and 0xA0 -- 0xFF. These same banks are also > addressed when the addresses 0x120 and 0x1A0 are addressed. It's every man for himself as far as context saving goes in this chip. If you have W_temp at address 0x7F, it appears in all RAM pages regardless of the bank select bits. (see data sheet) S_temp equ 20h W_temp equ 0x7F Now, if an interrupt occurs, just save W at W_temp org 0x0004 movwf W_temp Whatever registers your interrupt routine changes, you should save them as well, including STATUS, PCLATH, FSR etc. To preserve the Z bit in the STATUS register use the SWAPF instruction. swapf STATUS,W clrf STATUS ; ensure BANK 0 where S_temp is located movwf S_temp ; execute interrupt code swapf S_Hold,W ; restore S register movwf STATUS ; BANK bits will be restored Use the SWAPF instruction twice to recover the W data to avoid changing the STATUS Z bit. swapf W_Hold swapf W_Hold,W retfie regards Tony -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics