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

LPC2148 ADC not working properly.

Hello,

i am using LPC 2148. and configured the hardware for taking the analog signal at P0.28 which is ADC0 channel 1.

i am using following code but the output stays 0 or 1023 only.

i have connected 3.3v reference on the Vref pin. & that is verified on the controller's pin also.

kindly check and help for my problem..

thanks

void AdcInit(void)
{ AD0CR |= 0x07 << 8; // Clck to ADC = 30MHz / 0x07 AD0CR |= 0x01 << 21;// ADC Operational AD0CR &= ~(0x07 << 17); PINSEL1 |= 0x01 << 24; // Convert P0.28 as AD0.1. AD0CR |= 0x02;
} void Read_ADC(void)
{ AD0CR |= 0x01000000; // Start AD conversion NOW on AD0.1 (P0.28) Delay(); while ((AD0DR1 & 0x80000000) == 0); // until bit 31 is high (DONE) val=AD0DR1; adc_val = (val>>6) & 0x3FF; // Extract AD result
}