Building a quadrature generator with a PIC10F222

I need to start my new project with my digital RTJ gage and in order to do so I need to use the quadrature decoder chip LS7166. I could use the actual encoder I’m going to use for the project but it is large and unwieldy so I decided to build a generator for it.

The concept is simple, have a knob that produces no waveform in the middle of it’s stroke and as the pot deviates from the center, the speed of the signal increases also changing direction based on which side the knob id turned to. I couldn’t use a PIC10F200 much to my chagrin because it doesn’t have an ADC module built in, the PIC10F222 does however. It still works within my concept of low-end mcu’s doing valuable jobs since they’re still only 55 cents in quantity, from digikey of all places.

Overall, it’s a pretty simple design.

  • GP3 -> unconnected
  • GP2 -> Channel B out (Digital output)
  • GP1 -> Channel A out (Digital output)
  • GP0 -> 10k Potentiometer in (Analog in)

Dead simple. I did program a bit of a dead spot in the middle so that one can stop the quadrature from advancing quite easily. I put 2 LEDs on it to indicate that it is in fact working. Anyways, here’s the source (again it’s in Oshonsoft BASIC)

10f222 quadrature src.zip

I didn’t bother drawing up a circuit diagram since it’s such an easy circuit but here’s an additional image if you’re really curious. keep in mind that the board I’m using is Stripboard (aka Veroboard) so the traces run along one direction

Now for the fun challenge of making a simple serial interface MCU to the LS7166.