0
\$\begingroup\$

I am using an external pullup resistor on my input pin, and a switch connected to GND. It is like in the picture below. In the below picture, when the switch is open, the MCU input pin will see a logical high. I want to reverse this condition and see a logical high when the switch is closed. Should I use an internal pull up or pull down resistor to accomplish this? Also, what will happen if I use a pull-up? What will happen if Vcc is connected to Vcc or GND is connected to GND. I am really confused.

Regards, Karan.enter image description here

\$\endgroup\$
1
\$\begingroup\$

To reverse your logic you just need to reverse the pull up and make it a pull down.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
1
\$\begingroup\$

For almost all applications there should be no reason to need to change the way the switch connection works in the initial posted schematic. The sense of the input signal can be simply inverted in MCU software.

If you think you need to have the "activate high on switch press" behavior because some internal interrupt or enable to an I/O function on the MCU requires a a high level then you should definitely be thinking about an alternate solution. The reason is that simple switch connections will require debouncing. That process can easily be done with any MCU using a periodic time interrupt to sample the input. Once the sampled input is debounced and qualified by the software the high / low sense of the input can also be managed easily.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.