microcontroller I/O

Discussion in 'Embedded Systems and Microcontrollers' started by abduljarif, Feb 20, 2013.

  1. abduljarif

    Thread Starter New Member

    Feb 20, 2013
    Hello All,

    I am new to microcontroller. I have connected a 3 legged switch to 2 output pin and 1 to input pin. My Q are following

    1. if give logic1 to output pin1 and 0 to output pin2. what will happen when the switch is pressed?
    2. Will there be a short ckt between 2 output pins?
    3. o i/p will have logic 1?
  2. thatoneguy


    Feb 19, 2009
    Center pin and one will be shorted when switch isn't pressed. Center pin and the other will be shorted when the switch IS pressed. When switch is pressed, opposite pin goes back to floating.

    Why would you connect a switch in this fashion, out of curiousity? It could fry your uC if you have the 3 pins set to outputs and not all at the same logic level.
  3. abduljarif

    Thread Starter New Member

    Feb 20, 2013

    1. when the switch is open, there will be no connection between the three terminals of the switch.

    2. when the switch is pressed all the three terminals get connected at one juction.

    so my Q's are.

    1. if i apply 1 logic level to 1st output pin. 0 to another output pin. and the 3rd terminal which is input to mc is having logic 1. how would the current frm the contact junction if switch is pressed?

    2. the two output pins current would add up and flow to input pin? or since the two output becomes shorted at junction would it harm the mc?

  4. thatoneguy


    Feb 19, 2009
    If you have two outputs, one with a high signal (5V), and one with a low signal (0V), then connect them together, you are shorting the power supply through the pins of the controller.

    Most controllers can only source/sink a maximum of 25mA specified, however, that isn't always limited, more of a rule for loads. What happens if you take a fine piece of wire, say, 30 gauge, and put it across your power supply V+ and GND? What voltage will you measure on the wire? What happens to the power supply?
  5. Brownout

    Well-Known Member

    Jan 10, 2012
    I think he wants to connect V+ to the switch pin, which he is calling 'output' and ground to the other side. Then switch the center pin between the two. I could be wrong, it's hard to know....? A simple drawing would be worth a thousand words.
  6. tgil

    New Member

    May 18, 2011
    The input pin can be configured as a high-impedance input. This means only a small amount of current will ever flow in or out of the pin.

    If the input pin is using internal pulling resistors, other things will happen.

    However, if you drive the same node with two output pins at different voltages, the voltage at that node is not specified. Even if it doesn't damage anything immediately, over time the microcontroller is more likely to fail.