candy66
Newbie level 6
context save +pic
Hey guys....i try to execute this interrupt routine but it is not working.Did i save and restore my context correctly?Can anyone help?
int_serv
movwf savew ;Store the value of w temporarily
movf status,w ;w now has copy of status
clrf status ;ensure we are in bank 0 now!
movwf savestatus ;save status
receive btfss PIR1,5 ; (5) check for received data
goto receive
movf RCREG,w ; save received data in W
movlw 08H ; move it from register 1 to w.
movwf LATB ; move it to PORTB to light up the LED
intclean
movwf status ;restore status! (bank=original)
swapf savew,f ;restore w from *original* bank
swapf savew,w ;swapf does not affect any flags
retfie
Hey guys....i try to execute this interrupt routine but it is not working.Did i save and restore my context correctly?Can anyone help?
int_serv
movwf savew ;Store the value of w temporarily
movf status,w ;w now has copy of status
clrf status ;ensure we are in bank 0 now!
movwf savestatus ;save status
receive btfss PIR1,5 ; (5) check for received data
goto receive
movf RCREG,w ; save received data in W
movlw 08H ; move it from register 1 to w.
movwf LATB ; move it to PORTB to light up the LED
intclean
movwf status ;restore status! (bank=original)
swapf savew,f ;restore w from *original* bank
swapf savew,w ;swapf does not affect any flags
retfie