I try both variants, presented in code, but without major improvements.
Code:
;==============
;reading buttons on row 0 (pseudo-encoder)
PortA.1 = 0
; pause 10
@ nop
newState = PortA & %00011100 ; this is for my hw : 11100 = 28
PortA.1 = 1
If newState <> 28 THEN
If newState <> oldState THEN
Select Case oldState
Case 12
If NewState = 24 THEN
dir=up
endif
If NewState = 20 THEN
dir=dn
endif
Case 20
If NewState = 12 THEN
dir=up
endif
If NewState = 24 THEN
dir=dn
endif
Case 24
If NewState = 20 THEN
dir=up
endif
If NewState = 12 THEN
dir=dn
endif
END SELECT
oldState = newState
GOSUB UpOrDn
pause 100
endif
ENDIF
Bookmarks