Coding for a quadrature detector. Scroll wheel stuff etc.
The two inputs are PinA and PinB
START:
DO
IF PinA% = 0 then EXIT DO
LOOP
DO
IF PinA% = 1 and PinB% = 0 then scroll% = 1 : GOTO START
IF PinA% = 1 and PinB% = 1 then scroll% = - 1 :GOTO START
LOOP
****
scroll% is updated on the transition of PinA = 0 to PinA = 1
The code also detects transition of PinA = 1 to PinA = 0