Mouse Shaft Encoders
Since many Stampers have asked about the circuit I am posting it here.
I have reduced at maximum the graphics file.
'Program to read a rotary encoder
'Writed by ACJacques - January 2001
'direction could be reversed by simply changing A B inputs
new var nib
old var nib
direction var bit
n var word
new.bit0 = in7 'input A on pin 7
new.bit1 = in5 'input B on pin 5
start:
old = new
loop:
new.bit0 = in7
new.bit1 = in5
if new = old then loop:
direction = new.bit0 ^ old.bit1 'XOR to determine direction
if direction = 1 then left:
if direction = 0 then right:
goto start:
left:
n=n+1
goto printa:
right:
n=n-1
goto printa:
printa:
debug home
debug sdec5 n," ", cr
goto start:
'================end of program=========================
> AC Jacques wrote:
>
> > I have recently dismantled an old mouse and cutted the two shaft optical
> > encoders, rewired the photodiodes thru a buffer transistor, and
> > now I have 160 conts/revolution encoders for less $10. BS2 Software is
> > very simple. Let me know if you want a copy.
> > ACJacques
> >
> > P.S. Sorry for re-posting this, but date was very incorrect first time.
I have reduced at maximum the graphics file.
'Program to read a rotary encoder
'Writed by ACJacques - January 2001
'direction could be reversed by simply changing A B inputs
new var nib
old var nib
direction var bit
n var word
new.bit0 = in7 'input A on pin 7
new.bit1 = in5 'input B on pin 5
start:
old = new
loop:
new.bit0 = in7
new.bit1 = in5
if new = old then loop:
direction = new.bit0 ^ old.bit1 'XOR to determine direction
if direction = 1 then left:
if direction = 0 then right:
goto start:
left:
n=n+1
goto printa:
right:
n=n-1
goto printa:
printa:
debug home
debug sdec5 n," ", cr
goto start:
'================end of program=========================
> AC Jacques wrote:
>
> > I have recently dismantled an old mouse and cutted the two shaft optical
> > encoders, rewired the photodiodes thru a buffer transistor, and
> > now I have 160 conts/revolution encoders for less $10. BS2 Software is
> > very simple. Let me know if you want a copy.
> > ACJacques
> >
> > P.S. Sorry for re-posting this, but date was very incorrect first time.