lpcware

LPC11A14 problem with ADC

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by LucaCorradi on Sat Feb 08 18:24:40 MST 2014
I have a big problem with lpc11A14 and ADC reading. I try to exlplain it:

This is my peace of code where I'm trying to read something from ADC.

uint16_t dataADC1;

    Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 7, IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_MODE_INACT);

    ADC_CLOCK_SETUP_T adcClockCfg;

    Chip_ADC_Init(LPC_ADC, &adcClockCfg);
    Chip_ADC_EnableChannel(LPC_ADC, ADC_CH1, ENABLE);

    while(1) {

/* Start A/D conversion */
Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);

/* Waiting for A/D conversion complete */
while (Chip_ADC_ReadStatus(LPC_ADC, ADC_CH1, ADC_DR_DONE_STAT) != SET);

/* Read ADC value */
Chip_ADC_ReadValue(LPC_ADC, ADC_CH1, &dataADC1);
    }


I can see in the variable "dataADC1" only 0 or 1023, in particular 0 for about Vin<1,5Volt and 1023 for about Vin>1,5Volt.

I tried to read the internal temperature sensor, reference voltage and internal voltage core, but ADC read only 0.

Has someone this problem with this microcontroller?

(I'm using the LPCOpen libraries and lpcxpresso development suite (red-code and LPC-Link debugger) Whit debugger I have just check the ADC registers and the values seems correct.)


Thanks at all,
Luca Corradi from Italy

Outcomes