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.

No resistors on inputs?

Status
Not open for further replies.

Dan East

New Member
This should be a fundamental question for you PIC experts.

I would like to use PIC inputs with a switch without requiring a resistor. If I make the inputs high when the switch is pressed then I need an external pull down resistor to keep the inputs from floating. So I thought I could instead pull the inputs low when the switch is pressed and use the internal pull up. However I'm afraid I've already damaged a couple PICs in this way.

Can an input be taken low safely without a resistor? It seems that could be problematic, because when the PIC first starts up if the output is high then it will exceed 25 mA.

Thanks!

Dan East
 
Dan East said:
Can an input be taken low safely without a resistor? It seems that could be problematic, because when the PIC first starts up if the output is high then it will exceed 25 mA.

Yes, you can safely take a PIC pin low without a resistor, obviously you need to use PortB with the internal pullups enabled (or there's nothing to pull it high when the switch isn't pressed). You can't short the pin out unless your program sets the pin to be an output, and sets it high - the powerup default settings are all pins as inputs, and in any case, your first action should be to set the TRIS and PORT registers accordingly.

If you check my tutorials, the switch ones work in this way, although I use external pullups so the board can be used on any port.

BTW, PIC's are extremely hardy devices, they take a lot of abuse without suffering damage!.
 
:idea:

As a precaution, I always use a 1K resistor between the pic and the switch, this is to prevent damage from ESD, this can (and does) happen.

If you are using this as a "hobby" or "development" device, then these are not needed, although it does offer protection from setting the ports as outputs (by accident) in your code.....

Hope this helps!
 
Okay, I found my problem that led me to believe something was wrong with the PIC. I switched my inputs on an 12F629 from GP3 and GP4 to GP0 and GP1. However I wasn't disabling the comparator, so GP0 and GP1 were always indicating a low input.

I made the change from GP3/4 to GP0/1 at the same time I switched from external pull downs to the internal pull ups, so I was a bit suspicious I damaged something.

Dan East
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top