_incr Alias Portb.1 'pin 1 of IC Ud Alias Portb.0 'pin 2 of IC Cs Alias Portb.2 'pin 7 of IC Config Pinb.0 = Output 'output Config Pinb.1 = Output 'output Config Pinb.2 = Output 'output Portb.3 = 1 ' activate pull up registers for Encoder Portb.4 = 1 Set Cs 'disable chip Set _incr 'ready for clock pulse Dim B As Byte 'we have dimmed a byte because we need to maintain the state of the encoder Do B = Encoder(pinb.3 , Pinb.4 , Links , Rechts , 1) ' ^--- 1 means wait for change which blocks programflow ' ^--------^---------- labels which are called ' ^-------^---------------------------- port PINs Waitms 10 Loop End Links: Reset Ud 'count down gosub Sendpulse Return Rechts: Set Ud 'count up Gosub Sendpulse Return Sendpulse: Reset Cs 'enable chip Reset _incr 'generate pulse Delay 'wait a little Set _incr 'high again Set Cs 'disable chip and store value Return End