Hello. I have recently tried reading in a quadratuer input with the ardunio uno. I wrote software which sucessfull was able to read the A,B inputs and convert them to the amount of clicks the encoder had traveled. However, I have a problem in that the uno only has two interupts. My software requires two intrupt pins. Now, I want to read two encoders which requires four interupt pins.

I have decided that instead of upgrading the control, I was going to try and implement a hardware version. Although, I might take the first route, I found a few circuits online that implented a hardware version which would only require one interupted per encoder. I anaylzed the circuit in the excel spread sheet using state tables and output tables. I wanted to know if anyone had any experience with these type of hardware implementation and wheather or not it would work. Attached is an excel file

After anaylzing the circuit, theorectical and logically it does work, but I'm not sure practically. I'm just concerned because the flops will need there own clock which will be different from the uno's.

[I'm just concerned because the flops will need there own clock which will be different from the uno's./quote]why is that a worry, a clock is just the name of a flip flop signal, you don't need anything special.

I think your confusion might arise from the fact that if you only go the one interrupt per encoder, you don't get the full benefit of quadrature encoding as your count only increments or decrements when the A line changes. If you use interrupts on both channels you get 4 events out of every "count" on your encoder.

With two interrupts you can catch the rising and falling edge of each pulse, and the two lines are out of phase, so four interrupts per physical stripe on a photo interrupter for example, each of which can either increment or decrement the encoder count depending on the state of the channel that did not cause the current interrupt.

If you go with one interrupt per encoder you only get twice as many encoder ticks as pulses if you are watching for both the rising and falling edge of your pulses which is still good enough for most uses.

Depending on how fast you CAN get pulses from the encoder its not totally crazy in my mind to do away with external interrupts entirely and just poll the state from a timer overflow ISR at a higher frequency than you can see encoder changes. Of course if you have high resolution encoders this is impractical, but if you don't you can do full quad decoding without worrying about only having two external interrupt pins.