In article <32CFE892.5BEF@pacific.net>, Brooke writes >> When saving status during interrupts on the 16c74, >> Microchip recommends the following: >> movwf W_Temp ;Copy W to TEMP register, could be bank one or zero > >Note that W_Temp MUST be defined so that it appears in the same location >independent >of the RP0 (RP1, ...) bits. For example W_Temp equ h'20' AND W_Temp equ >h'A0'. I don't see anyone mentioning PCLATH context saving here! Essential if you venture into page 1 of program memory.. To do it, you would add.. > >> swapf STATUS, w ;Swap status to be saved into W >> bcf STATUS, RP0 ;Change to bank zero, regardless of current bank >> movwf STATUS_TEMP ;Save status to bank zero STATUS_TEMP register movf PCLATH,w movwf temp_lath bcf PCLATH,3 ;this line is crucial, otherwise your first ;GOTO or CALL in the ISR could jump into the ;other program page with terminal results.. ;(this is assuming your ISR resides in page 0) >> :(ISR) movf temp_lath,w movwf PCLATH >> swapf STATUS_TEMP, w ;Swap STATUS_TEMP register into W >> ;(sets bank to original state) >> movwf STATUS ;Move W into STATUS register >> swapf W_TEMP, f ;Swap W_TEMP >> swapf W_TEMP, w ;Swap W_TEMP into W -- Jim Main jim@ewcomm.demon.co.uk Visit Eastwood Communications at http://www.ewcomm.demon.co.uk Broadcast Electronics & Custom Design