But I want to be more precise about what I'm trying to do. I have a 1 pole 8 position rotary switch with continuous rotation, and I need an interface (a micro?) to send pulse A for each click clockwise, pulse B for each click counterclockwise. Cannot use a rotary encoder as they have a low activation torque, and I need a strong "click" feeling. Any way to achieve this?
Two possible solutions both using micros. Currently you can get a PIC or ARM for under $2 so that is a good way to go.
a) Analog solution.
Wire a ring of resistors in series round the rotary switch.
Sense the voltage either using onboard ADC or time to charge a small cap past the schmidt trigger level of one of the inputs.
Compare 'ADC' value to previos to work out direction
b) Digital solution
Wire 8 lines to 8 inputs (even on a 20 pin TSSOP you have enough IO)
Wire the wiper to ground.
Wire pull ups from each of the 8 poles to Vcc (preferably use internal pull ups)
Set an IRQ on low to high change for any of the input pins, debounce
You can invert the sense of this wiring.
I have recently implemented a design where an ARM MCU is used as an I2C to parallel port. The solution was simpler, cheaper per pin and more flexible than any discreet logic I could find - including 74 series shift registers.
As raised by the commentators below, the switch can be coded with just sufficient states to differentiate the sense of rotation.
In the case of a switch with end stops, or with a number of states exactly divisible by three, only 3 states are required. These states are wired cyclically around the rotational switch.
In the case of a switch with continuous rotation capability, an additional state is required to avoid having two adjacent same-states or two same states separated by a different state.
The base requirement is that whatever the position and whatever the direction a new state is reached that is different from the previous state and different from the state for the alternate direction.
Coding the input increases complexity and introduces more chance for error.