Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Diode as Pull-down

Status
Not open for further replies.

Iomega

New Member
It's well known to not have floating pins as inputs to a microcontroller, and pull-up or pull-down resistors should be used.

My question is whether a diode attached to ground would accomplish the same thing. I know that a diode with current flowing through it has a ~2V drop across it.

Will it be a robust pull-down in the attached circuit when the switch is open?

Thanks.
 

Attachments

  • Diode Pull-down.PNG
    Diode Pull-down.PNG
    15.7 KB · Views: 1,201
No. I'd suggest moving R2 to the top of R1 and then use another resistor to pull the pin low. The other problem you have with your circuit is that the switch won't pull the input pin all the way high. It'll pull it up to roughly 4v which will likely be enough for the PIC to register it as being high, but I don't like it.
 
Can you use a pin on Port B and use the Port B internal pull ups instead? And re-work the circuit around that?
 
Last edited:
It's well known to not have floating pins as inputs to a microcontroller, and pull-up or pull-down resistors should be used.

My question is whether a diode attached to ground would accomplish the same thing. I know that a diode with current flowing through it has a ~2V drop across it.

Will it be a robust pull-down in the attached circuit when the switch is open?

Thanks.

Are you just wanting to use the led to show if you have pressed the switch
I do my switches like this saves power
 

Attachments

  • sw.png
    sw.png
    24.7 KB · Views: 1,865
My question is whether a diode attached to ground would accomplish the same thing. I know that a diode with current flowing through it has a ~2V drop across it.

Will it be a robust pull-down in the attached circuit when the switch is open?

That circuit will be very poor.

LEDs do not conduct electricity once the voltage gets below 1.2 volts or so. That is just about the threshold voltage for PIC inputs, so it will act as a floating input. Also, LEDS generate voltage when exposed to light, so the circuit's function will depend on ambient light conditions, which will make things even worse.

Put a real pull-down resistor in there.
 
It's well known to not have floating pins as inputs to a microcontroller, and pull-up or pull-down resistors should be used.

Actually, no it's not 'well known' - there's really no problems associated with leaving PIC inputs floating.

If you're wanting to actually use it as an input, then it's obviously important to ensure that both high and low states are accurately defined, and pullup resistors are most commonly used for that purpose.
 
Iomega,

An LED and its current limiting resistor should work fine as a pull-up or pull-down.

In the circuit below I sample the switches periodically by switching the pins to inputs then I switch them back to outputs to illuminate the LEDs. A switch press does illuminate the LED but in the circuit below each switch press toggles the LED so you can't really tell that the switch is lighting the LED.

Regards, Mike

dual-pin-function-png.33460
 

Attachments

  • Dual Pin Function.PNG
    Dual Pin Function.PNG
    12 KB · Views: 3,214
Actually, no it's not 'well known' - there's really no problems associated with leaving PIC inputs floating.

If you're wanting to actually use it as an input, then it's obviously important to ensure that both high and low states are accurately defined, and pullup resistors are most commonly used for that purpose.


I think it is fairly well know. At least that is what I have been taught. If you want a pin to float it should be an output. Or I may be wrong.
 
If it is an output, then its not floating. If it is a floating input, it can draw a few extra milliamps
 
Actually, no it's not 'well known' - there's really no problems associated with leaving PIC inputs floating.
...

Really? I thought with the earlier PICs that used TTL digital inputs there was a problem with latchup, and that was part of Microchips decision to start changing all the digital inputs to schmidt triggers in the mid 90's??

I know the PIC schmidt type digital inputs are pretty immune to latchup, you can leave them floating.
 
If it is an output, then its not floating. If it is a floating input, it can draw a few extra milliamps

That happened on CMOS 4000 logic chips, it's not a problem with PIC's - there's been much discussion over the years about what option is best.

Personally, and if I think about it, I set unused pins as outputs, but I'm not obsessive about it :D
 
Well, I'm not going to argue with you about it, it won't do either of us any good. I will accept what you say as an unsubstantiated fact, but with a grain of salt, and continue setting my pins unused pins to output.
 
Well, I'm not going to argue with you about it, it won't do either of us any good. I will accept what you say as an unsubstantiated fact, but with a grain of salt, and continue setting my pins unused pins to output.

As do I - but if you ever feel the urge, monitor the current and try different methods.
 
Why you don' put a 50k or higher between GND and RD2 to be shore ? The LED will not act as a reliable pull down.
 
On floating pins see Beginners checklist for pic Microcontrollers at

Not saying it is not out of date, but the piclist has a lot of experts on it.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top