PIC A/D inputs can be connected directly to the analog source. You don't
need any voltage dividers unless the analog input is greater than Vcc.
PIC A/D inputs can be connected directly to the analog source. You don't
need any voltage dividers unless the analog input is greater than Vcc.
So I can just connect one part of the pot to the pic pin and the other to ground?
Or if using a photocell, one lead to pin the other to ground?
I was laboring under the notion that there had to be that voltage divider that I've seen in some books where one pot pin goes to +5, the other to ground and the middle pin to the pic ADCIN pin.
Tony
If you have an analog signal from some external device, say, a temperature
sensor or something else, that outputs an analog voltage, then you can
connect this analog source directly to the PIC A/D input.
If you're using a potentiometer to simulate the external analog signal, then of
course you'll want one end to Vcc, the other to ground, and the wiper to the
PIC A/D input.
Without one leg of the potentiometer to Vcc you wouldn't have anything but
ground on the PIC A/D input.
AND be sure you POT or ELSE analog source meet the maximum A/D input impedance.
If you plan to use a PhotoResistor, you will need to pass the PhotoCell trhough an OPAmp or else method.
look the PIC datasheet (once again) to know the maximum PIC A/D impedance
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Ok, thanks for the info.
So RCTIME is just measuring the time for a cap to discharge, but the voltage source is coming from the pic pin itself, when it goes from low to high. In this case you would just hook the pot up like what's described for using the POT command? (None of the pots pins to Vcc)
Thanks again,
Tony
RCTIME and POT command are just 'usefull' when your PIC don't have any AD converter. While it's just a pain and real waste of time to do some intelligent calibration, forget them. Choose a PIC with internal AD or use an external one. If you use an external one you'll discover really fast that it just don't worth the investement while a PIC with internal AD are not really much expensive than others without.
Your POT is connect between VCC and GND, the wiper can go directly or through a low value resistor to your PIC AD input.
If your software don't provide any noise cancelation, i suggest to add a ~0.1uF between PIC input and GND to filter the signal a little bit.
If you use the above method, your POT impedance must meet the maximum PIC AD impedance too. Look into your PIC datasheet under the AD section, you'll fiond it there.
BUT if you don't have any POT that meet it, you can even place a buffer between your POT and the PIC. almost any decent op-amp will do the job.
ADCIN is easy to use and work really fine even if you can do it simply by writing/reading directly to the internal registers. That will also provide tighter code.
Last edited by mister_e; - 16th April 2006 at 09:37.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I see. So the POT and RCTIME are useful if your pic doesn't have an a/d convertor.
Thanks for the info on the circuit, using a resistor before the pin and the cap for filtering. I appreciate it.
I'm looking in one of the books for A/D conversion. They show a 50K pot, the wiper going directly into the pic pin, but there is a 15K "pull-up" resistor connected from the +5V to the pot. Is this recommended?
Last edited by TonyA; - 16th April 2006 at 15:54.
Bookmarks