Rotary Binary Switch

The switch shown in the photo here is rotary in nature and spits out a three-bit binary number. Ergo, it must have eight positions. I picked it up surplus over thirty years ago thinking it might be useful for some exotic pickup switching on an electric guitar. That never panned out, but it sure is useful with the PIC16F88. I feel certain you can buy similar units nowadays.

Bit of trivia: the surplus house I bought this from back around 1980 was called Diamondback Electronics. Anyone remember it? They were in Florida as I recall.

You might note that unlike many of the switch arrangements you see elsewhere, this is one is set up with positive logic. Hence, the commutator is driven by +5V and develops voltages across the pull-down resistors on the switch's outputs.

In the demo, the binary number selected by the switch is illuminated on the LEDs. In fact, that's really all there is to the code: the switch is read on Port A, and the binary number is transfered to the LEDs on Port B. Simple!

Click to get the source code.
Click to get the schematic PDF.

Next Project: Gray Code Encoder

No comments:

Post a Comment