Rotary Encoder Help
ADZ_916
Posts: 30
Hey all!
I'm having a tough time figuring out how to read my rotary encoder to the propeller as is is not the common 2-bit type.
Data Sheet : http://www.alps.com/WebObjects/catalog.woa/E/HTML/Encoder/Incremental/EC11/EC11EH224403.html
If any one could clue me in as to how to read this "ABC Switch"? type of encoder it would be of great help as I would like to use this as the interface for a Tesla coil driver I am building based around the propeller.
Thanks in advance for any help
-ADZ
I'm having a tough time figuring out how to read my rotary encoder to the propeller as is is not the common 2-bit type.
Data Sheet : http://www.alps.com/WebObjects/catalog.woa/E/HTML/Encoder/Incremental/EC11/EC11EH224403.html
If any one could clue me in as to how to read this "ABC Switch"? type of encoder it would be of great help as I would like to use this as the interface for a Tesla coil driver I am building based around the propeller.
Thanks in advance for any help
-ADZ
Comments
http://obex.parallax.com/objects/666/
http://obex.parallax.com/objects/24/
So far I have written some simple code that checks the input pins and displays the binary output through the serial terminal as expected i see:
CW
%010
%001
%100
CCW
%010
%100
%001
with only a one bit change between detents.
If you could include some simple code that dispays a value in the serial terminal that is manipulated by the knob I would be very gratefull
Thanks Again!
-ADZ
Thanks!
-ADZ
Again any help would be greatly appreciated as i am currently stumped.
The other thing to do is to manually enter the code I posted. It looks like you may have cut and pasted it and it is possible some non printable characters got inserted.
The input variable however changes as expected. Still cant figure out exactly what I'm doing wrong here.
Thanks again for being so patient and helpful.
-ADZ
Thanks again!
-ADZ
gets me the result of one click cw and the number continually counts up and if i move it once ccw it continually counts down. I think I'm close!
EDIT : it seams that turning th knob has this result, one click cw and it continually counts up, next click in the same direction and it continually counts down, on the next click in the same direction the count stops. Not sure whats going on here. Ideally the count would increment by 1 for every forward click and decrement by 1 for reverse.
"Got to input case 001"
However the counter is still not incrementing. I also posted this on the propeller 1 forum and got some useful code that with a few small changes does exactly what I was looking for, a counter that increments and decrements one per detent and resets with the pushbutton: the thing with this is that I had to wire pullups for each switch pin as apposed to one pullup to 3.3v
EDIT: Code will not paste correctly, file is attached.ABC_Encoder.spin
Thanks again for all your help!
If you have break before make sensor, you will go via 000, and your present state structure will fail.
You can either cover all states, or pull in the old := input line, to be inside only the valid states.(as below)
This means old can now only have one of three values - before it could have 8 possible values.
It will take a couple of clicks for the state engine to 'grabs' the right phase, but from there it should ignore 000 and 111, and other states, and
edge-act only on the valid three.
Regarding post 23: The most popular method of connecting this type of encoder is to have the switch common connected to ground and 3 pullup resistors to V+ on the switch outputs. The alternative is to have the common go to V+ and pulldown resistors to ground. The resistors are required to avoid floating inputs.