We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
iam using lpc 2138 in which the output has to be taken from the adc but at the same voltage it is giving various voltage which vary about 10% to 20%.i have checked the hardware ,there is no problem with it so if some one can help me with "ADC FILTER CODE" .so that i can make the adc output stable through software.
"i have checked the hardware ,there is no problem with it"
The LPC2138 do not give 10-20% variation in the readings if your hardware is sane. My hardware may jitter in least significant bit.
So first fix your hardware.
Have you made sure the voltage reference and the supply voltages and ground plane are stable?
You have suitable caps close close close to processor pins between supply voltage and ground? Between voltage reference and ground? You have any inductors in series on voltage reference?
Do you use VCC as voltage reference or do you use a dedicated voltage reference?
Is it your hardware or some development board you have bought somewhere?
i checked the voltage referrence and supply voltages..it is stable and no inductor is in series.
Again: how, exactly, did you "check" them?
Inappropriate measurement techniques are likely to give misleading results...
Why did I get a strong feeling that you ignored most of what I wrote? You think your problems will go away if you just ignore your hardware issues?
You think software filtering will be able to take into account disturbances on the supply or reference voltages that will change in size with the CPU load? So when your processor gets more to do, the ADC will measure more incorrect than when the CPU load is low. How did you plan to correct that in software? Measure the CPU load or current consumption and use as adaptive parameter for the correction?
How have you made sure that you fulfill the following requirement from the data sheet:
Analog 3.3 V power supply: This should be nominally the same voltage as VDD but should be isolated to minimize noise and error. This voltage is used to power the on-chip PLL.
How have you isolated it?
Or:
Analog ground: 0 V reference. This should nominally be the same voltage as VSS, but should be isolated to minimize noise and error.
What about:
ADC reference: This should be nominally the same voltage as VDD but should be isolated to minimize noise and error. Level on this pin is used as a reference for A/D and D/A convertor(s).
As you should have realized by now, you have some serious hardware or software issues if you get 10-20% variation on your readings.