News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

12F629 Input pin

Started by joesaliba, May 04, 2022, 02:58 PM

Previous topic - Next topic

joesaliba

Hi,

I have a 12F629 operating at 5v. Then I have 1 pin that must receive a RX signal with peak of 7.4v. Usually the signal will between 1ms to 2ms high, 18ms to 19ms low.

If I add a 1K resistor with this pin, will it be ok?

Regards

Joe 

Frizie

I think that's no problem as long it's not port GP3.
Ohm sweet Ohm | www.picbasic.nl

midali

Use a transistor , is the best and safe way . It's wrong if you add only 1k resistor ! You can add a resistive divider but only if your signal is alltime more than 5V .

midali

Using 1 transistor, the signal is inverted. If you want non-inverted, use 2 transistors . Usually I use resistor equiped transistor, like PDTD 113 or BCR505 .

shantanu@india

No problem, as Frizie says. Pic inputs are diode protected, you just need to limit the current.
Regards
Shantanu

top204

midali.

The single transistor emitter follower will not invert the signal. A high on the transistor's base will set its collector high, so what goes in, will come out the same. :-)

However, I agree a single series resistor will do the job nicely, but I tend to go for 2.2K Ohm resistors when the voltage is quite a bit higher than required, because the internal microcontroller diodes are easily damaged.

midali

In past I tested  10F202 with 2k2 resistor with 12V peak pulse and PIC burned . Now I realize that I may have used the input on gpio3 which has no diode protection.

Top204,
A single transistor emitter will invert the signal . A high on transistor's base will set the low the collector :) .



top204

Yes. Sorry. I was thinking of it as a switch. :-)

John Lawton

Quote from: midali on May 05, 2022, 08:26 AMIn past I tested  10F202 with 2k2 resistor with 12V peak pulse and PIC burned . Now I realize that I may have used the input on gpio3 which has no diode protection.
Generally, consider what happens when a higher than Vdd voltage is applied to a protected input. The protection diode(s) start to conduct and current then flows into the Vdd circuit, but note that this will raise the voltage level depending on what other circuitry is present. You need to consider this aspect when selecting an input series resistor. If the response time is not critical, use a much higher value series resistor and if overall current consumption isn't critical, maybe put an LED running from Vdd as a current sink for any diverted input currents, so the level of Vdd isn't significantly affected.


Pepe

 An emitter follower can also work

tumbleweed

QuoteThe protection diode(s) start to conduct and current then flows into the Vdd circuit,
They (Microchip) frown on exceeding the IO pin voltage specs and just limiting current into the pins with a resistor these days.
There are a number of app notes/tech bulletins that outline some of the bad things that can happen, esp with many of the newer devices.

They've pulled most of the old app notes that used this practice.
 

John Lawton

Like this: App Note 93013a.pdf

So it's still a valid technique but can cause internal offsets for instance on on ADC inputs.

tumbleweed

Or stop the internal oscillator.

joesaliba

Thanks for the replies.

It is not GP3 and it will be always be 7.4v or less.

The boards have been ready many moons away, and I always sold them to operate at 5v, or 6v and a series diode on the supply made the trick and never had an issue.

But this one customer wants it yo work at 7.4v, so I had to modify this only one board. I managed to add a voltage regulator at the supply, and have only this sort of PWM input pin.

I will add a 2K2 resistor as suggested. Have no room where to add a transistor.

Thank you
Regards

Joe 

John Lawton

Quote from: tumbleweed on May 05, 2022, 05:11 PMOr stop the internal oscillator.
Wow, could you give me a link to an App note or other document that states this please?

John Lawton

Quote from: joesaliba on May 05, 2022, 07:14 PMBut this one customer wants it yo work at 7.4v, so I had to modify this only one board. I managed to add a voltage regulator at the supply, and have only this sort of PWM input pin.

I will add a 2K2 resistor as suggested. Have no room where to add a transistor.
In the App note I linked to in post #11, on page 3 gives three methods to interface to an input voltage higher than Vdd. To avoid pumping up the PIC Vdd line, much higher series resistor values than 2k2 can be used, Microchip suggests 100k which will be fine unless you need high speeds because of the effect of input capacitance on the pin.

tumbleweed

Quote from: John Lawton on May 06, 2022, 08:41 AM
Quote from: tumbleweed on May 05, 2022, 05:11 PMOr stop the internal oscillator.
Wow, could you give me a link to an App note or other document that states this please?
One place is on page 2 of document you linked to (TB3013) under "Oscillator"

There's also all the cautions in TB3009 about passing current through the ESD diodes, esp. the ones on page 4.
http://ww1.microchip.com/downloads/en/AppNotes/93009A.pdf

John Lawton

Quote from: Pepe on May 05, 2022, 11:51 AMAn emitter follower can also work
It may not work very well because the base-emitter diode alone can pass overvoltage through to the PIC.

Pepe

Quote from: John Lawton on May 06, 2022, 11:20 AM
Quote from: Pepe on May 05, 2022, 11:51 AMAn emitter follower can also work
It may not work very well because the base-emitter diode alone can pass overvoltage through to the PIC.
You are wrong, the collector base diode acts as clamping and the circuit does not give more than the applied voltage of 5v to the pic

John Lawton

Quote from: Pepe on May 05, 2022, 11:51 AMYou are wrong, the collector base diode acts as clamping and the circuit does not give more than the applied voltage of 5v to the pic
You are correct, I should have realised :(