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.

PIC analog input protection

Status
Not open for further replies.

Peet19

Member
Hello!
Should the analog input of the PIC be protected with a resistor? In this case, does the current flow into the PIN?
I want to measure the voltage at the center terminal of a potentiometer.
Thanks in advance for your help!
 
It is a good idea to take the manufacturer's word as gospel, otherwise, you have nobody to blame if things go poorly,

The datasheet, in section 20.7, says:

Since the analog input pins share their
connection with a digital input, they have reverse
biased ESD protection diodes to VDD and VSS. The
analog input, therefore, must be between VSS and VDD.
If the input voltage deviates from this range by more
than 0.6V in either direction, one of the diodes is
forward biased and a latch-up may occur.


In other words, echoing what rjenkinsgb wrote in post #8: Good design means always keep voltages within the correct limits. Use an external means of limiting input voltage on this chip. rjenkinsgb also wrote: That's an example of why you should never rely on the input diodes as part of the overall circuit function.

So forget the maximum I/O current and just keep the voltage within limits as discussed above.

There are microcontrollers out there that specify the maximum current that can be injected into the protection diodes without causing SCR latchup, but this is not one of them.
 
Hello!
Should the analog input of the PIC be protected with a resistor? In this case, does the current flow into the PIN?
I want to measure the voltage at the center terminal of a potentiometer.
As long as the voltage at the input can never exceed the PIC supply range, you do not need a limiting resistor.

If it could possibly exceed supply or go below ground, use external schottky protection diodes.

Outputs and their current restrictions are a totally different thing to inputs.
 
Thanks to everyone for their help. I understand things now. Sorry to answer so late, but unfortunately I work a lot. I want to make a development panel for myself that I can use to practice PIC programming. I'll put the wiring diagram tomorrow.
 
Hello!
I designed this circuit. I think it's all understandable, I won't describe it separately.
What are your opinions?
Képernyőkép 2022-06-05 13-17-54.png
 
My opinion is that it would be better if you mentioned what aspect of the circuit you are asking for comments on and then at least called out the major components in that part of the circuit, and (one would hope) explain what you expect them to do. Some of us are pretty good at doping out how circuits work, but a description never hurt either.

For example: if Q1 were rotated so it's collector "looked" more positive than the emitter (was higher on the page than the emitter) and the signal flowed from left to right it would be recognized and an inverter driving a speaker much more quickly. Is that the kind of feedback you are looking for? I doubt it.
 
Forget the coin cells! They will not run a circuit such as that with LEDs etc., as they cannot stand significant current without the voltage dropping off extremely quickly.

They can run a low current circuit such as an MCU with no display or a non-backlit LCD for extreme periods, as long as the MCU is only woken when required - but not anything that needs tens of milliamps.

Other than that, a full description of the intended function and what may be connected to the port connectors is really needed.

See the graph below for the effects of low vs high load current:

Discharge%20capacity%20Panasonic%20CR2032.png
 
Thanks for the suggestion on CR2032. I try it for now, then edit it into a normal outlet.
My further question would be, can the PIC drive the LED display like this?
I don't understand how to rotate Q1.
I set up a beep to play certain frequencies on the output.
 
My further question would be, can the PIC drive the LED display like this?

Yes, check my tutorial hardware page:


That uses common anode rather than common cathode, but is essentially the same - and as it only has two digits (I happened to have a dual-LED at hand) it only needs a single I/O to switch between them.

Have you considered using plugs and sockets rather than building everything on one board? - as I did in my tutorials, it makes it much more versatile, and if you can use only 8 pins (as in my LED example above) you can plug it in any full 8 bit port.

This is a board I've been using recently for 28 pin devices - J1 is external power in, PL1 allows selection of 3.3V or 5V regulators. PL3 and PL4 are specifically for the connection of FTDI serial converters (no power required - so only 3 pin), and J2 and J3 for SPI devices etc. that need three I/O plus power. I double up the ten pin sockets because I use one for Molex (as per my original tutorial boards) and the other for XH-2.5mm connectors, the smaller ones are XH-2.5mm as well.

28Pin_DevBoard.png
 
With that chip there is no real need for an external crystal as it has very useful internal oscillators that have several common frequencies up to16mhz.
 
With that chip there is no real need for an external crystal as it has very useful internal oscillators that have several common frequencies up to16mhz.
Notice that my board above doesn't include an external crystal, and my 'pic of choice' is the 18F27K42 which runs internally at 64MHz maximum, and has huge amounts of memory.

I would suggest that with any devices of this era, you use the MCC to setup the oscillator options :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top