Darkstar64
New Member
Hey everyone once again this is related to the Cube project im working on im trying to do some switch inputs to run some code and have been following a few tutorials for debounce of a switch and the assembly code to read the bit of a pin here is what I have so far should it work fine or can I make improvments ?
Code:
;******** Main Code
start
movlw b'101000' ; Configure only GP3 and GP5 as a input
tris GPIO
loop
waitdn btfsc GPIO,3 ; Wait untill button is pressed on GP3 ( GP3 low )
goto waitdn
call Cycle ; Cycle Rubroutine
movlw .2
pagesel delay10
call delay10 ; Delay of 20ms to debounce GP3 ( GP3 low )
pagesel $
waitdn2 btfsc GPIO,5 ; Wait untill button is pressed on GP5 ( GP5 low )
goto waitdn2
call Rain ; Rain Subroutine
movlw .2
pagesel delay10
call delay10 ; Delay of 20ms to debounce GP5 ( GP5 low )
pagesel $
goto loop