![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
cseusy
Joined: 15 Apr 2006 Posts: 12
|
Bad A/D Conversion |
Posted: Thu Mar 25, 2010 8:03 pm |
|
|
In one version of code, my 10-bit A/D readings were correct and stable. In the next version of code, the readings are erratic (+/-100). The code for A/D setup is the same and the code for reading is the same. I have tried auto acquisition times of 16 and 20 Tad and I have set auto to 000 and then manually waited 20us. Tad is 8xFosc but I have tried 16x, too. Osc. is 8MHz internal. I have verified my hardware by putting old code in the same hardware with good results. ADCON2 = 0x85, ADCON1 = 0x07, ADCON0 = 0x05 (selects channel and turns on at same time). After 10 to 20us acq. time, I set the go/done bit, poll that bit, then read ADRESH/L. I've checked all my variable types, which also haven't changed between versions. There is at least 50us between taking a reading and switching channels. I am using an 18F4550, but the A/D chapter reads pretty much the same as for other uChip parts with A/D.
What else could cause this erratic behavior? Thanks! CJ |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 25, 2010 8:29 pm |
|
|
1. Post your test program. Example:
http://www.ccsinfo.com/forum/viewtopic.php?t=42090&start=1
Make the test program be very short and compilable, just like that one.
Don't include any CCS Wizard code that disables timers that are already
disabled, etc. Test it before you post it.
2. Describe the circuit that provides the analog signal to the PIC.
3. Give the PIC a constant analog voltage (if possible) from your circuit.
Post the voltage, as measured with a scope or voltmeter. Also post
some of the ADC output values for this voltage that appear on your
terminal window.
4. Post your compiler version. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|