3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

How to interpret the direction of rotation from a digital rotary switch with a PIC

Step 2Hardware Interface

Hardware Interface
A "simple" solution would be to have a "single pole-16 throw" switch with 16 connections to the microcontroller. Each switch output would then be tied to a pin on the microcontroller so that every dial position can be checked by the microcontroller. This is an excessive use of I/O pins. Things get even worse if we want more than 16 positions (detents) available to us on the switch. Each extra position on the switch would require an extra input to the microcontroller. This quickly becomes a very inefficient use of inputs on a microcontroller.

Enter the beauty of the rotary switch.

The rotary switch has only two outputs to the microcontroller listed as A and B on the data sheet. There are only four possible logic levels that these lines can take: AB = 00, 01, 10 and 11. This greatly reduces the number of input lines you must use in connecting the switch to the microcontroller. So, we've cut the number of input lines down to just two. Now what? It seems like we really need 16 different states but this new switch has only four. Have we shot ourselves in the foot? Nope. Read on. We'll cover a little bit of the theory behind the rotary switch operation to explain.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
0
Followers
1
Author:hw640