I’m thinking about this from a long time but still I couldn’t do.
When RB0 interrupt occurred its going to org 0004h & updating Select register.
When returning from interrupt I want to goto to the updated line of Select register not from the last save value (before going to ISR)
Ex: when Select Register = 1 it must go to PAT1 (pattern 1 is in the main routine)
Any method to do? Please help me.
When RB0 interrupt occurred its going to org 0004h & updating Select register.
When returning from interrupt I want to goto to the updated line of Select register not from the last save value (before going to ISR)
Ex: when Select Register = 1 it must go to PAT1 (pattern 1 is in the main routine)
Any method to do? Please help me.
Code:
org 0000h
goto Main
org 0004h
incf Select,F ;increment the Select register on each press
movf Select,W
bcf STATUS,Z
xorlw .1 ;if it is press once?
btfsc STATUS,Z
goto PAT1 ;YES,then goto Pattern1
movf Select,W
bcf STATUS,Z
xorlw .2 ;if it is press twice?
btfsc STATUS,Z
goto PAT2 ;YES,then goto Pattern2
movf Select,W
bcf STATUS,Z
xorlw .3 ;if it is press thrise?
btfsc STATUS,Z
goto PAT3 ;YES,then goto Pattern3
retfie
Main bsf STATUS,RP0
movlw b'00000001'
movwf TRISB
bsf INTCON,GIE
bsf INTCON,INTE
bcf STATUS,RP0
clrf PORTB
clrf Select
goto PAT1
********
Patterns
********
PAT1 --
---
call Delay
goto PAT1
PAT2 ---
---
call Delay
goto PAT2
PAT3 ---
---
call Delay
goto PAT3
*****
Delay
*****
Delay decfsz Del0, f
goto $-1
decfsz Del1, f
goto $-3
return
end