[sdiy] Logic for rotary encoders
Neil Johnson
nej22 at hermes.cam.ac.uk
Tue Jan 21 11:20:40 CET 2003
Leif,
Interesting problem.
1) I like Paul's idea, and it gets the chipcount down.
2) Here's my stab at the problem:
Split the 40 rotary encoders into four groups of 10. Now you have 20
signals to scan and process, which you could fit into a 28-pin PIC or
Atmel AVR, together with a pin for a serial output pin that spits out a
message byte whenever one of the 10 encoders changes value. And
you'd have a few pins spare for switch inputs.
So, here's the pin budget:
2 for power
2 for Xstal
20 for 10 encoders
1 for serial output
3 for switch inputs
You may have to lose one of the button inputs for RESET or additional
ground (e.g. analogue ground) depending on which device you use.
A message byte is sent out whenever one of the following happens:
- an encoder rotates +ve
- an encoder rotates -ve
- button pressed
- button released
(you may or may not need the button released message).
Does this fit into one byte? We have, say, 23 devices (20 encoders + 3
buttons), so round that up to the next binary number, 32. That needs 5
bits to represent. Now use one bit to represent inc/dec or on/off. So we
only need 6 bits per message. If you're being really clever you can use
the remaining 2 bits to encode which of the four groups the message is
from (either in the microcontroller or adding the extra info in the serial
driver in the DSP).
Total chip count: 4 microcontrollers
As you already have a DSP in your system it would not be too onerous a
task to receive 4 asynchronous serial streams, and its not as if they need
to be fast either (e.g. serial mice used to work at 1200 baud).
Hope this helps,
Neil
--
Neil Johnson :: Computer Laboratory :: University of Cambridge ::
http://www.njohnson.co.uk http://www.cl.cam.ac.uk/~nej22
---- IEE Cambridge Branch: http://www.iee-cambridge.org.uk ----
More information about the Synth-diy
mailing list