bourns encoder
Archiver
Posts: 46,084
Hello all!
I've got an encoder that (according to me) could switch clockwise or
counterclockwise.
I can't make an program that distincts between these two rotations.
I've read stamp application number 8, still couldn't figure it out.
This site displays info about the decoder.
http://www.bourns.com/cat/ecw1j.htm
could anyone please help?
thanks in advance pieter-jan
I've got an encoder that (according to me) could switch clockwise or
counterclockwise.
I can't make an program that distincts between these two rotations.
I've read stamp application number 8, still couldn't figure it out.
This site displays info about the decoder.
http://www.bourns.com/cat/ecw1j.htm
could anyone please help?
thanks in advance pieter-jan
Comments
ACJacques
'Program to read a rotary encoder thru a BS2 Basic Stamp
'Writed by ACJacques - January 2001
'direction could be reversed by simply changing A B inputs
new var nib
old var nib
direction var bit 'variable to store direction
n var word 'variable to count positive or negative
new.bit0 = in7 'input quadrature A on pin 7
new.bit1 = in5 'input quadrature B on pin 5
start:
old = new
loop:
new.bit0 = in7
new.bit1 = in5
if new = old then loop: 'if not any change 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 ofcode ===============
Bernadette van Diepen wrote:
>
> Hello all!
>
> I've got an encoder that (according to me) could switch clockwise or
> counterclockwise.
>
> I can't make an program that distincts between these two rotations.
> I've read stamp application number 8, still couldn't figure it out.
> This site displays info about the decoder.
>
> http://www.bourns.com/cat/ecw1j.htm
>
> could anyone please help?
>
> thanks in advance pieter-jan
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed with. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/