# 24V into PIC12F629 pin is ok?

Discussion in 'Microcontrollers, Programming and IoT' started by eem2am, Aug 20, 2012.

1. ### eem2am

414
0
Aug 3, 2009
Hello,

We have a circuit in which 24V will be connected to a PIC pin, but there will be a 100K resistor in series with the pin. Will this be OK?
Here is the basics of the circuit...showing the pin with the 100K attached to it.

http://i47.tinypic.com/n3t5pk.jpg

(Doing it like this saves us a lot of circuitry)

By the way, we already do this but with 12V, and we've had no problems....will it be ok with 24V?

2. ### BobK

7,682
1,688
Jan 5, 2010
No, if you look at the datasheet you will see that the max voltage on any pin is Vdd+0.3V.

All you need an another resistor to ground to make a divider that will put no more than Vdd on the pin.

Bob

3. ### eem2am

414
0
Aug 3, 2009
i cant do that because then i would never be able to detect a high on that pin with the 100k in front of it.

4. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,480
2,827
Jan 21, 2010
Is it the one labelled "To LED driver"?

Place a 180k resistor in series. That will (with the 51k resistor already there) make a voltage divider that will convert 24V to something very close to 5V.

The high series resistance means that even if some small current does flow through the protection diodes, it is likely to do no damage.

This solution means a logic high will need probably 15V or more or it may not register.

5. ### Harald KappModeratorModerator

11,153
2,547
Nov 17, 2011
You should add at least the series resistor, as you already do, plus
- either a zener diode from the PIC's pin th ground
- or a Schottky diode from the PIC's pin to Vcc.

When you don't limit the voltage on the pin (e.g. by one of the above methods) you rely on the IC's protection diode to limit the voltage to Vcc+Vdiode (internal). While this will work in many cases, it is not what these diodes are meant for. You're abusing them and there is no guarantee that the same circuit will work e.g. if the manufacturing process of the PIC is changed.

File size:
1.9 KB
Views:
223
6. ### eem2am

414
0
Aug 3, 2009
24V would be connected to P3 and indeed P4.

We are already doing this , but with 12V...and there are no problems.

But is it ok with 24V......

Whats the max curent that an pic esd protection diode can take..........microchip have app notes recomending using the esd diodes like this in mains zero crossing detectors, so its legitamate use, but they dont say what is the max current that the esd diode can take.

I have very little room for any extra components, even the extra diode or zener mentioned above.

This is a small product which sits in a small place

Also, i do not wat to increase the 100k as i may get more noise

7. ### BobK

7,682
1,688
Jan 5, 2010
Yes it will. Assuming a Vdd of 5V, you would size the divider to put 5V on the pin when the signal was at 24V. Why would you think it would not read as high?

Bob

8. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,480
2,827
Jan 21, 2010
That would be an issue if the resistor was some distance from the pin. if it's close to it, not so much.