This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem in ADC initialization

Hello everyone,
I am using lpc2378, I had initialized ADC0 for channel 1 at pin P0.24 in polling. But it is not working. I have given 1V to the pin but it reads only 0. Please check this initialization code

void init_ADC0(void)
{ PCONP |= (1<<12); PINSEL1 |= (1<<16);

AD0CR = ((1<<1) | (1<<21) | (5 << 8));
}

uint16_t read_ADC()
{ uint32_t ADC_data;

AD0CR |= (1<<24); while(!(AD0DR1&0x80000000)); AD0CR &= ~(1<<24); ADC_data = AD0DR1; ADC_data = (ADC_data>>6)&0x3FF; return (uint16_t)ADC_data;
} Is there anything wrong in my code ?

Iqbal

0