Monitor 15 contacts with one PIC input

Summary of Monitor 15 contacts with one PIC input


The article describes a method to monitor up to 15 pushbuttons using a single microcontroller input by leveraging an internal comparator with selectable internal voltage reference (VREF). By arranging resistors and switches so different button presses produce distinct voltages compared against VREF, the PIC mid-range family’s built-in comparators can uniquely identify which contact is closed, reducing required I/O pins.

Parts used in the Monitor 15 contacts with one PIC input:

  • PIC microcontroller with internal comparator and selectable VREF
  • Resistors forming a resistor network/divider
  • Up to 15 pushbutton switches (contacts)
  • Power supply for the PIC and resistor network
  • Wiring or PCB to connect resistors, switches, and 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.

Monitor 15 contacts with one PIC input

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.

 

For more detail: Monitor 15 contacts with one PIC input

Quick Solutions to Questions related to Monitor 15 contacts with one PIC input:

  • How many pushbuttons can be monitored with this method?
    Up to 15 pushbuttons can be monitored using one I/O and the comparator technique described.
  • What PIC feature is required for this method?
    An internal comparator with selectable internal voltage reference VREF is required.
  • Does this method need an ADC or RC timing?
    No, this method uses the internal comparator and resistor network voltages rather than ADC or RC timing measurement.
  • How are different buttons distinguished?
    Each button produces a distinct voltage via a resistor network that the comparator compares against VREF to identify which is pressed.
  • Is special hardware beyond resistors and switches needed?
    No special hardware beyond the PIC with comparator, resistors, switches, power, and wiring is required as described.
  • Which PIC family commonly includes the needed comparator?
    The majority of 8-bit PIC microcontrollers in the mid-range family include one or two internal comparators suitable for this method.

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