View previous topic :: View next topic |
Author |
Message |
frustrated Guest
|
a/d reading jumping |
Posted: Thu Apr 22, 2004 10:09 am |
|
|
Folks, seem to be having a spot of bother with the A/D on my 16f877
on the development i am using they have a pot connected to A0, i have tried my program on this and it works,
then i tried connected an external input to A1 from a amp to it and it jumps....alot the Vin is staying at 3.217v (its a very accurate multimeter#) however the reading is jumping between 123-167
by my calculations it shoud read 5/256=2omv =>3.217*.02= 160
intially it was jumping more, but i figured that it was become they hadn't a commom ground, so i connected the 2 grounds and this brought down the level of jumps.
Any idea whats going on????? |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Thu Apr 22, 2004 10:19 am |
|
|
Are you switching between A0 and A1? Are you allowing enough settling time after selecting the channel and before starting the conversion? Are you getting crosstalk between channels?
Just a few thoughts. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
Guest
|
|
Posted: Thu Apr 22, 2004 10:44 am |
|
|
nono,
i am only using one channel.
i was just saying that i have teste dit on Ao and it works, so the code i think is ok,
any other ideas. |
|
|
fonta Guest
|
|
Posted: Fri Apr 23, 2004 3:14 am |
|
|
Hello frustrated.What is your Vref+ and Vref-?.Your Vref must be a stable and precise voltage, for example 5.00V.You must use a LM4040-5.0, REF02 ,etc.. for your Vref.
Bye. |
|
|
Gerrit
Joined: 15 Sep 2003 Posts: 58
|
|
Posted: Fri Apr 23, 2004 3:37 am |
|
|
If you use internal ref. did you measure (with a scope) the voltage
on the controler.
are you flashing some light (LED) during conversion ?
are there other loads on the ouitput pins that are pulsed ?
is there an other pulsinf load on your powersuply ?
Gerrit |
|
|
frustrated Guest
|
|
Posted: Fri Apr 23, 2004 4:13 am |
|
|
Hi again,
thanks for your help so far.
i am using the internal Vref.
it s just wrecking my head that the program works on Ao (using pot on development board)but not on A1 with an input not from the development board.
i'll try connecting Ao to A1, and take the reading from A1, this way i should be able to see if it is a problem with that port.
mean while, keep the suggestions coming.
thanks |
|
|
frustrated Guest
|
|
Posted: Fri Apr 23, 2004 7:02 am |
|
|
ok,
i connected the A0 and A1, when taking the reading from A1 it worked the way it was suppose to,.
i know have my desired input connected to A1 an it is jumping, (i have it running off the same power supply aswell , so there shouldn't be problem with the supply)
i really need this sorted asap,
so come on people any ideas.
do i need a resistor before my input? |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Fri Apr 23, 2004 8:18 am |
|
|
The signal you are bringing onto the board, what is producing it? Is its impedance less than 10K Ohm (100 Ohm or less would be great)? How are you making the connection? 27 feet of randomly choosen wire from the trash heap? Or a neat and tidy connection?
Just looking with a DMM doesn't mean much because they don't have bandwidth. Use an oscilloscope to check your signal for noise. What you are describing is a very common symptom of 60Hz (50Hz) hum riding on your desired signal. If you have much cable length at all between your source and the ADC and there is too much impedance.
You mentioned a missed ground connection before. Are you sure you made the ground connection properly and didn't get one hole/pin off on the connector (I've done that too many times to count).
Are you allowing sufficient time for the ADC reading in your code? If the on-board potentiomenter is working ok then you are probably fine codewise but just checking. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Fri Apr 23, 2004 8:43 am |
|
|
If you bring the input signal to the PIC pin through a 1K resistor and place a ceramic 10uF cap between the input pin and ground that should eliminate noise above 100Hz. An easier first step would be to add just the capacitor. Are you using twisted pair wiring? |
|
|
|