I tried to ad a second check of direction :
Code:
loop:
PortA.1 = 0
newState = PortA & 011100 ; this is for my hw : 11100 = 28
pause 50 ; no matter what I put here : none, @ nop , pause 100 !
newa = PortA & 011100
PortA.1 = 1
If newState <> 28 THEN
If newState <> oldState THEN
Select Case oldState
Case 12
If NewState = 20 THEN
if newa = 24 then dir=up
endif
case 12
If NewState = 24 THEN
if newa = 20 then dir=dn
endif
Case 20
If NewState = 24 THEN
if newa = 12 then dir=up
endif
Case 20
If NewState = 12 THEN
if newa = 24 then dir=dn
endif
Case 24
If NewState = 12 THEN
if newa = 20 then dir=up
endif
Case 24
If NewState = 20 THEN
if newa = 12 then dir=dn
endif
END SELECT
oldState = newstate
GOSUB UpOrDn
endif
ENDIF
But, in this way, any direction I rotate, the command is always "Dir Up" ?! Never goes "down" ...
Bookmarks