Wagner Lipnharski of UST Research Inc. says:
An easy way to have a key and a indicator led connected to a single microcontroller port pin is connect the LED (anode) with a resistor (330 Ohms) to +VCC (+5Vdc) and the cathode to the port pin, the key goes to the same port pin to ground via another resistor (100 Ohms). By this way, whenever you want to read the key, just flip the port pin to up level and read it. The LED can serve as an indicator of the function selected by the key. Suppose the LED is off (port pin high), pressing the key will turn on the LED (3/4 brighness) and will drop the port pin level, reading the port pin would indicate a low level, so it would means "key pressed", then your software will "latch" that information flipping the port pin to low level (LED goes to 100% brightness) indicating key was read as "pressed". A 49ms low level and 1ms high level to read the key is enough to keep the LED as brigh as possible and run the debounce routine. After the debounce, pressing the key again would signal the software to deactivate the LED. It would works as a flip-flop switch with indicator, with a single port pin. The 100 Ohms resistor (that creates the 3/4 LED intensity) is to inform you when the software effectivelly read the key pressed and confirmed the "pressed" status by bypassing the 100 Ohms resistor to ground.
Questions:
file: /Techref/io/1wledsw.htm, 1KB, , updated: 2007/6/15 11:11, local time: 2024/11/24 09:17,
3.144.235.138:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/techref/io/1wledsw.htm"> Hardware Input/Output 1 wire LED and switch</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.