OPTO ENCODER INTERFACE USING A PIC
Some PICaSTAR users are using the Avago, or similar, rotary opto encoders. These typically output a two bit Grey code which must be converted into "direction" and "pulse" outputs to use with the PICaSTAR transceiver. Various means are available to do this, however an elegant solution might be to use one of the small 8 pin PIC micro-controllers.
Chris, from the UK, has in fact, done this already:-
"The intention was to improve on the resolution obtainable from D-type decoders by generating a clock pulse on every transition of the input code. I wrote the first one (Quad) to convert two-bit Grey code into the "Direction and Pulses" format required by the PnM. It's simple and seems to work fine for optical encoders. Runs on a 12F508/12F509 which is available in an 8-pin dip package. The second one (Quad1) is intended for mechanical encoders (which tend to exhibit contact bounce and jitter). It is for 12F510 (also 8-pin dip) and has an adjustable de-bounce timer set by a pot on an ADC input. There is a trade-off between keeping-up with high-speed input (spinning the dial) and preventing jitter when turning the knob slowly. I have been looking into a more sophisticated program with self-adjusting de-bounce thresholds but it's not quite there yet!" Regards Chris
Assembler Code example "quad"
Assembler Code example "quad1"
Here’s the latest in the series of quadrature decoders. I think it’s the best so far. Info in the header explains the principle. Regards Chris
Assembler code example "quad2" 270308
No PCB available but its simple to make on Vero etc.
Last updated on March 27, 2008
Created on 25th March, 2008