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.
Hii all.This time I'm struck with the ADC problem.My code is running successfully.I'm using a ready-made board of LPC2148 which has a potentiometer connected with its pin 13 of the MCU i.e., AD0.1.The potentiometer is used to supply various analog voltage to the pin 13. Now the problems are -- 1:->the result of the ADC conversion of a predefined voltage is not coming in the AD0DR1 register..but its coming in the global result register i.e., in the AD0GDR. I dont know why this is happening 2:->I'm sending the result of ADC conversion to P1.16 to P1.23 which has LED connection to it..and the pattern of LED blinking is rightfully going with the ADC result.If i power up the development board with a predefined analog volatage(say 2V) the result is coming accordingly..but now if i change the value of the potentiometer(say to 3V) then the new result isn't coming..and the result of 2V continues to blink at the LEDs.If I reset the board or switch on the board after switching it off then the right value of 3V is showing up..what should i do
We are still waiting for any answer to this: "Have you verified that all your voltages are perfectly stable?"
Whenever an ADC produce weird measurements, the first thing to do is to grab the oscilloscope and look at all relevant signals. If the measured signal isn't stable, in relation to the speed of the ADC, your ADC will have problems. If the reference voltage isn't stable, your ADC will have problems. If the VCC isn't stable, your ADC will have problems. If the GND isn't stable, your ADC will have problems. If other signals to an external ADC or the processor does funny things (such as an output switching high currents or an input receiving an overvoltage into the body diodes), your ADC will have problems. If the input signal can't handle the load of the ADC input, your ADC will have problems. If the processor runs at max load, the switching of all internal transistors may give the ADC problems. You get the idea? Almost anything can result in bad ADC readings, so you really have to check that everything is ok. The external signals are easy to look at. If that isn't enough, then it will be time to try to do something about noise from inside the processor.
The first six or maybe eight bits of the ADC output are relatively easy to get to produce reasonable values. But every extra bit will be harder.
Yes i have checked my board..my reference voltage is not being constant.It increases when I increase the supply voltage to the board.For example when the supply voltage is 4.8V the reference voltage becomes 3.3V which changes to 3.5V when the supply voltage to the board becomes 5.1V or 5.06V. As (the voltage input to the microcontroller)Vcc=Vref so that also change in accordance to the supply voltage. Now what should I do.. P.S. I'm sorry for the delay in providing the data.
Sounds like you have measured the signal with a multimeter.
Have you also checked it with an oscilloscope and seen if it - besides changing value with the input voltage - also has noise?
For the DC problem, you normally buy a dedicated voltage reference. You could see it as a "super-zener". You may get a 2.0V, 2.048V or maybe a 2.5V voltage reference.
The next thing is that you may look at using capacitors and inductors to filter away noise.
Having a voltage reference with a lower voltage than what you want to mesure would mean that you need to add a voltage divider to make sure that the input voltage is within range. Big enough resistance values that they don't load down the voltage source. But low enough resistance that the input impedance of the ADC doesn't affect the divider significantly.
Yeah sir u r rite...i have used a multimeter to chck teh values...
LPC2148 has internal voltage reference..so whats the use of a dedicated external sorce..and moreover how to use it.I'l check it using the oscilloscope and let u knw about the noise part
"LPC2148 has internal voltage reference..so whats the use of a dedicated external sorce..and moreover how to use it."
What do you mean by that?
The 2148 has Vref, Vssa, Vdda signals.
Vssa: Analog Ground: 0 V reference. This should nominally be the same voltage as VSS, but should be isolated to minimize noise and error.
Vdda: 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 ADC(s).
Vref: A/D Converter 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 convertor.
The only bad thing is that NXP seems to have a hard time to decide what voltages that are allowed on Vref.
6.8.1 of product datasheet (Rev 04 17 nov 2008) says: Measurement range of 0 V to VREF (2.0 V <= VREF <= VDDA).
8 of product datasheet says: Min 2.5V, Typical 3.3V, Max Vdda
yeah u r rite what i mean to say is that in my development board the Vref pin is internally connected with Vcc
One thing you have not told us before, is that you are using a development board. Or more explicitly which board. But now we know that it isn't a Keil MCB2140.
I have said that I'm using a board in my very first posting..i guess u missed it.Its from robokits a cmpany from rajasthan(india) and its written in their website about the board that...Designed as per keil MCB2130 dropping some features.
I have checked the connection with the oscilloscope there are some noise signal creeping into the ADC pin.
Yes, I did suspect you did use a board. But in the original post, you only said "ready-made board" which might include a custom-designed board. And from what you say now, it is a customization based on a MCB2130.
What parts of the MCB2130 design did you drop? The MCB2130 has a strap J11 to select if VREF should be connected to +3.3V or not, so it does allow the use of a separate voltage reference.
One thing with the MCB2130 is that it is a bit "light" when it comes to filtering the Vref, Vdda and Vssa. It works fine if you have very little noise on the board. More filtering should be added if you have hardware that pulses high currents on the PCB.