This coding I have inside ISR. What I need is to make the output to be low after passing the value in Minute variable. But before going low it must pass the output high section.
My problem is without clearing the Second variable it will miss 5 seconds or I have to add 65 to Second variable. Here I have cleared Second variable.
Is my coding ok?
My problem is without clearing the Second variable it will miss 5 seconds or I have to add 65 to Second variable. Here I have cleared Second variable.
Is my coding ok?
Code:
ISR decfsz COUNT,F
goto Away
movlw .100 ;
movwf COUNT ;generating 1 sec part
incf Second,F
movf Second,W ;has it reached 5 sec?
xorlw .5
btfss STATUS,Z
goto Away1
btfss Enable,1 ;check the Enable bit?
goto Away1
[COLOR="Red"]bsf PORTB,0[/COLOR] ;turn ON after 5 seconds
nop
bcf Enable,1 ;turn off enable bit
[COLOR="Red"]clrf Second [/COLOR]
Away1 movf Second,W
xorlw .60
btfss STATUS,Z
goto Away
clrf Second
incf Minute,F
movf Minute,W
xorlw .5 ;has it reached 5 min?
btfss STATUS,Z
goto Away
clrf Minute
[COLOR="Red"]bcf PORTB,0[/COLOR] ;turn off after 5 mins
bsf Enable,1