{"id":9438,"date":"2014-10-29T10:49:44","date_gmt":"2014-10-29T14:49:44","guid":{"rendered":"http:\/\/embedded-lab.com\/blog\/?p=9438"},"modified":"2014-10-29T11:10:49","modified_gmt":"2014-10-29T15:10:49","slug":"access-15-tact-switches-with-one-input-pin","status":"publish","type":"post","link":"https:\/\/embedded-lab.com\/blog\/access-15-tact-switches-with-one-input-pin\/","title":{"rendered":"Access 15 tact switches with one input pin"},"content":{"rendered":"<p>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 <strong><a href=\"http:\/\/embedded-lab.com\/blog\/?p=4040\" target=\"_blank\">resistor-divider network<\/a><\/strong> 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 <a href=\"http:\/\/embedded-lab.com\/blog\/?p=1812\" target=\"_blank\"><strong>2-wire keypad interface using 555<\/strong><\/a> 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.\u00a0<a href=\"http:\/\/www.edn.com\/design\/analog\/4436451\/Monitor-15-contacts-with-one-PIC-input\" target=\"_blank\"><strong>Benabadji Noureddine&#8217;s recent design idea<\/strong><\/a> 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&#8217;s internal comparator module. The other terminal of the comparator is connected to\u00a0the internal voltage reference V<sub>REF<\/sub>, which is selectively varied through software. He wrote a\u00a0comparator interrupt routine which executes every time a pushbutton is pressed, and cycles through V<sub>REF<\/sub>\u00a0values until the comparator output is flipped, which will indicate which pushbutton has been pressed.<\/p>\n<div id=\"attachment_9439\" style=\"width: 560px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/?attachment_id=9439\" rel=\"attachment wp-att-9439\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-9439\" class=\"size-medium wp-image-9439\" alt=\"Multiple tact switches on a single I\/O pin\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/10\/keyPress-550x535.png\" width=\"550\" height=\"535\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/10\/keyPress-550x535.png 550w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/10\/keyPress.png 600w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/a><p id=\"caption-attachment-9439\" class=\"wp-caption-text\">Multiple tact switches on a single I\/O pin<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>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.\u00a0Benabadji Noureddine&#8217;s recent<\/p>\n","protected":false},"author":1,"featured_media":9439,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,183],"tags":[976,977,978],"class_list":["post-9438","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pic-tutorials","category-tips-and-tricks","tag-multiple-tact-switches","tag-pic-adc","tag-pic-comparator"],"_links":{"self":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/9438","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/comments?post=9438"}],"version-history":[{"count":2,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/9438\/revisions"}],"predecessor-version":[{"id":9442,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/9438\/revisions\/9442"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media\/9439"}],"wp:attachment":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media?parent=9438"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/categories?post=9438"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/tags?post=9438"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}