Monitor 15 contacts with one PIC input

Several previously published Design Ideas and appnotes [1-4] show how to use many pushbuttons with a minimum number of inputs. They require an RC circuit where the timing can be measured to identify which pushbutton has been pressed, or an ADC input, with resistors forming a divider for each pushbutton pressed.

The following Design Idea shows another simple way to use up to 15 pushbuttons with only one I/O. The microcontroller chosen must contain an internal comparator with selectable values for the internal voltage reference VREF. The majority of 8-bit PIC microcontrollers in the mid-range family feature one or two internal comparators with just this.

Monitor 15 contacts with one PIC input

As a simple and practical example, the circuit in Figure 1 uses an 8-bit PIC controlling a 4-bit LED display to show which button has been pressed. A comparator interrupt routine reacts immediately to any pushbutton pressed. The routine cycles through VREF values until the comparator output COUT returns high, which will indicate the pushbutton pressed.

The fully commented assembler source code takes less than 100 words. It is not overly optimized, so as to simplify understanding and make translation to other controllers easy.

 

For more detail: Monitor 15 contacts with one PIC input


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

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

Scroll to Top