Hi all
Im having problems sorting out a subroutine.
Im trying to increase a time displayed on an lcd by pressing a button, I can get the time to increase from 0 to 23 but at the next press it increases to 30 instead of reseting to zero and I cant figure out how I can reset the file to zero.
any help would be much appreciated,
this is the code that I have so far
Im having problems sorting out a subroutine.
Im trying to increase a time displayed on an lcd by pressing a button, I can get the time to increase from 0 to 23 but at the next press it increases to 30 instead of reseting to zero and I cant figure out how I can reset the file to zero.
any help would be much appreciated,
this is the code that I have so far
Code:
INC_HOURS
BANKSEL HOURSUNIT
INCF HOURSUNIT,F ;INC UNITS BY 1
MOVF HOURSUNIT,W
SUBWF TIME,W
BTFSS STATUS,2 ;CHECK IF UNITS ARE 9/3
RETURN ;NO, GO BACK
MOVLW 30H ;YES SO...
MOVWF HOURSUNIT ;RESET UNITS TO 0
BANKSEL HOURSTEN ;AND
INCF HOURSTEN,F ;INC HOURS BY 1
MOVF HOURSTEN,W
SUBLW 32H
BTFSS STATUS,2 ;CHECK IF HOURS ARE 2
RETURN ;NO, GO BACK
BANKSEL TIME
MOVLW 34H ;YES SO...
MOVWF TIME ;SET MAX UNITS TO 3
RETURN