Access 15 tact switches with one input pin

A while back I posted two articles on reading multiple tact switches using a minimal number of I/O pins of PIC microcontroller. One of them uses a resistor-divider network to create an unique range of analog voltages for each keypress. The voltage is then measured through an ADC input channel to detect which key has been pressed. Another approach was a 2-wire keypad interface using 555 timer IC configured as an astable multivibrator. The 555 timer is configured to generate a specific frequency of oscillation for each key press. However, these are not the only methods out there. Benabadji Noureddine’s recent design idea posted on EDN shows how to monitor the input logic status of 15 push switches through one input pin of PIC12F683 microcontroller. The trick is to use the I/O pin that connects to one of the inputs of PIC’s internal comparator module. The other terminal of the comparator is connected to the internal voltage reference VREF, which is selectively varied through software. He wrote a comparator interrupt routine which executes every time a pushbutton is pressed, and cycles through VREF values until the comparator output is flipped, which will indicate which pushbutton has been pressed.

Multiple tact switches on a single I/O pin

Multiple tact switches on a single I/O pin

Related Posts

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *