Scan ---- ;contains multiplexing stuff
----
return
Count ---- ;increment digits
----
Keychk ---- ;checks the four buttons
----
goto main
Main call Scan
moclw b'01111110' ;make portb,7 low
movwf PORTB
call SmallDel ;small delay to settle
btfsc PORTB,7 ;check the RB7 press or not?
goto Keychk ;no then goto keycheck
bcf STATUS,C ;yes then clear the carry bit
rlf CURSOR,f ;move cursor to left by one
btfss CURSOR,5 ;has the 5th bit cursor set?
goto Loop1 ;no then goto loop1
clrf Cursor ;yes 5th bit is set then -
goto Count ;- goto count routine
Loop1 call Scan
btfss PORTB,7 ;check the RB7 has released?
goto Loop1
goto Keychk