glt
100+ Head-Fier
- Joined
- Oct 24, 2004
- Posts
- 203
- Likes
- 4
Quote:
If you set the interrupt to detect only rising of one channel then you only read one interrupt per detent.
Originally Posted by cobaltmute /img/forum/go_quote.gif Detented encoders can get ugly. I've got my own working Arduino code that drives a PGA2311 from a rotary encoder on interrupts. I used a 24 PPR, 24 detent encoder as my first test. The problem is that if you actually look at the maps, 1 pulse != 1 detent. Over 1 detent on that encoder, 1 would be getting 4 interrupts using both encoder channels. I've made it work so that one detent equals 1 step, but the code drops alot of readings. Working with interrupts, there was no way I could can spin the encoder fast enough that the Arduino couldn't keep up. Now that was a $2 mechanical encoder. It works well enough, but there is a nice 32 detent, 8 PPR optical encoder at Mouser for $20 that I'm going to order for when my PCBs come in. The datasheet shows that it should not have that issue. |
If you set the interrupt to detect only rising of one channel then you only read one interrupt per detent.