Bob, how did you deal with the possibility of more than one switch being pushed at a time? Did you just verify the math to make sure that there is no overlap in the output voltage ranges? - Marcel On 8/14/06, Bob Axtell wrote: > > I have a standard design that handles up to 7 pushbutton switches (as in > membrane switch) on just ONE PIC analog input pin. It works very > well, maintains a good input impedance, so needs NO special analog > input processing. > > I was asked to share the design with another PIC engineer, so I might as > well share it with anyone that wants it. It will be in ZIP form, and will > contain PDF schematics and ASCII TEXT code for the PIC16F876A > with easily ports to just about ANY PIC with an A/D converter.. > > Each switches contacts to GND a point within a resistor array. The > A/D seems a voltage of 0.0V, 0.7V, 1.4V, 2.1V, 2.8V, 3.5V, and 4.2V. > 5V means no switches are pressed. A small software window is built > around each value, so an amount of error is tolerated; for example, > rubber button switches normally measure 100 ohms when closed. > > Please note that this works for 7 pins PER ANALOG PIN. That means > for the 8-pin analog switching of the PIC16F877A, up to 56 switches > can be handled with ease. > > I read the switches every 1mS but that is because the design is a serial > keypad. > For most applications, reading every 10-30mS should be fine. > > If anyone wants a copy, just ask. > > --Bob > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist