Skip to main content

Timeline for AVR switch best practice

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Jul 27, 2015 at 14:04 comment added Rev @gabi: When the switch is closed, the current will already be limited by the pull-up resistor. There is (nearly) no current sourced from the IO pin when it is configured as an input. Be careful though, that if you would accidentally set the pin as output and close the switch, you could damage the controller.
Jul 27, 2015 at 13:50 comment added gabi Is it ok (in terms of efficiency) to connect permanent on/off toggle to pulled up INPUT pin ? The issue is that the pin will be HIGH and connected to GND permanently. will it be better to use 10K resistor between the GND and the toggle? Example: GND--10K--/-AVR
Jul 27, 2015 at 13:42 vote accept gabi
Jul 27, 2015 at 12:57 comment added Golaž @gabi Yes. You can activate the internal pull-up by setting the pin as INPUT and setting it HIGH. Something like this(with your port/pin values ofcourse): DDRA &= ~(1<<PINA0); PORTA |= (1<<PINA0);
Jul 27, 2015 at 12:42 comment added gabi Thanks for the detailed answer, So just to clarify - If I am using AVR (which has internal pull-up) I can drop the external resistor?
Jul 27, 2015 at 11:15 history edited Rev CC BY-SA 3.0
Some additions.
Jul 27, 2015 at 11:07 history answered Rev CC BY-SA 3.0