AnsweredAssumed Answered

adc problem in LPC2148

Question asked by Jagadeshwar Reddy K on Sep 3, 2016
Latest reply on Oct 3, 2016 by Jagadeshwar Reddy K

Hi,

we are using ADC0 to measure voltage of a sensor which gives output 4 to 40mamp.

But sometimes the ADC conversion is not wokring.it is wiaitng at conversion only.

The code what we are using is 

 

PINSEL1 |= 0x01000000; // channel 0 in adc0
AD0CR &= 0xffffff00;
AD0CR |= 0x00000002; // Select ADC = AD0.1
// START = 001 = Start Conversion Now
AD0CR |= 0x01000000;

 

while((AD0DR1 & 0x80000000) == 0); // Wait ADC Conversion to Complete and Read A/D Data Register

val = (unsigned int)(AD0DR1 >> 6) & 0x000003FF;
AD0CR &= 0xF8FFFFFF;
return (val);

 

Please help us in this issue.

thank you in advance 

Outcomes