Code:
ISR:
asm
;CONTEXT SAVING CODE HERE
T0Overflow
btfss INTCON, T0IF ; check if timer overflow flag
Goto EndInt
; PBP version
; if i<p then i=i+1
; if j<p then j=j+1
; if k<p then k=k+1
; if L<p then L=L+1
movlw _i
bcf STATUS,Z
xorwf _p,w ; p is a PBP variable and a constant with value 150. (P CON 150)
btfss STATUS,Z
incf _i
movlw _j
bcf STATUS,Z
xorwf _p,w
btfss STATUS,Z
incf _j
movlw _k
bcf STATUS,Z
xorwf _p,w
btfss STATUS,Z
incf _k
movlw _l
bcf STATUS,Z
xorwf _p,w
btfss STATUS,Z
incf _l
btfsc PORTA,0 ; Button Pressed?
Goto Finish
btfsc PORTC,0
Goto Putlow ; If it is high then pull all outputs low, goto Pull Low
btfsc PORTC,3
Goto Putlow
btfsc PORTC,4
Goto Putlow
btfsc PORTC,5
Goto Putlow
; If none is high then put all outputs high
bsf PORTC,0
bsf PORTC,3
bsf PORTC,4
bsf PORTC,5
; Writing above states to EEPROM
bsf STATUS,RP0 ; Jump tp BANK1
clrf EEADR
movlw 1
movwf EEDATA
Call SaveVal
movlw 1
movwf EEADR
movwf EEDATA
Call SaveVal
movlw 2
movwf EEADR
movlw 1
movwf EEDATA
Call SaveVal
movlw 3
movwf EEADR
movlw 1
movwf EEDATA
Call SaveVal
bcf STATUS,RP0 ; Jump to BANK0
Goto Skipp
; PBP version
; If Sw1=0 then
; if (PortC.0=0) then
; if (PortC.3=0) then
; if (PortC.4=0) then
; if (PortC.5=0) then
; High rel1 : High rel2 : High rel3 : High rel4
; write 0,1 : write 1,1 : write 2,1 : Write 3,1
; goto skipp
; endif
; endif
; endif
; endif
; Low Rel1 : Low Rel2 : Low Rel3 : Low Rel4
; write 0,0 : write 1,0 : write 2,0 : write 3,0
; Endif
;skipp:
; While PortA.0=0 : Pause 50 : Wend
SaveVal
bsf EECON1,WREN
bcf INTCON,GIE
movlw 0x55
movwf EECON2
movlw 0xAA
movwf EECON2
bsf EECON1,WR
btfsc EECON1,WR
Goto $-1
bsf INTCON,GIE
RETURN
Putlow
bcf PORTC,0
bcf PORTC,3
bcf PORTC,4
bcf PORTC,5
; Writing above states to EEPROM
bsf STATUS,RP0
clrf EEADR ; set eeprom address location - 0 in this case
clrf EEDATA ; fill data in this register - 0 in this case
Call SaveVal ; save it
movlw 1
movwf EEADR
clrf EEDATA
Call SaveVal
movlw 2
movwf EEADR
clrf EEDATA
Call SaveVal
movlw 3
movwf EEADR
clrf EEDATA
Call SaveVal
bcf STATUS,RP0
Skipp
btfss PORTA,0 ; button released?
GOTO Skipp
Finish
bcf INTCON,T0IF
clrf TMR0
EndInt
CONTEXT RESTORE CODE
endasm
(Screenshot of errors)
Bookmarks