
Originally Posted by
smitty505000
...I need it to count up to 36 in one direction until one revoluton where it returns to 1...
Smitty
As you know, usually in rotary encoders, it won't return to 1. It will always give you ticks as long as it rotates and you count the ticks. You need to use "Reference" signal out of the encoder which gives you a single tick only at the exact same point per revolution. When you get this tick then you know that "one revolution" is complete.
As you see, you need to also count or check this tick. The safest way, I think, would be to use TMR0 to count reference signal, and TMR1 to count one of the other signals (this is where you do not need to know the direction). The reason why I point out Timer modules is that they work in the background.
If you had a choice in which your encoder turned one direction and it was enough for you, then you could solve your problem here. But, you say you need both directions. In this case, you will have to use a PORT to read the encoder.
I added some links to some posts in this forum. Pls check them and see what kind of problems others encountered and how they approach to the similar issues.
1. http://www.picbasic.co.uk/forum/show...rotary+encoder
2. http://www.picbasic.co.uk/forum/show...rotary+encoder
3. http://www.picbasic.co.uk/forum/show...rotary+encoder
4. http://www.picbasic.co.uk/forum/show...rotary+encoder
mister_e has a clever approach to a similar encoder issue (Item 4).
Regards.
Edit: What you say kind a sounds that you may actually not need the direction.
------------
Last edited by sayzer; - 9th September 2006 at 20:03.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks