Hi, Nadia,
Pls refer to the thread:
https://community.nxp.com/t5/LPC-Microcontrollers/LPC54018-Reading-Multiple-ADCs/m-p/1256343#M44521
BTW, we have example code for ADC in SDK package, pls download SDK package from the link:
If you still have issue, pls post your code so that we can have a review or test.
Hope it can help you
BR
Xiangjun Rong
Hi,
I think the line is incorrect. Because the ADC0_0 channel is multiplexed with internal temperature and extrnal pin PI0_10.
/* Use the temperature sensor input to channel 0. */
ADC_EnableTemperatureSensor(DEMO_ADC_BASE, true);
As you know that the ADC channel0 is multiplexed with temperature sensor output.
it should be:
ADC_EnableTemperatureSensor(DEMO_ADC_BASE, false);
Secondly, you should configure the PIO0_10 as ADC0_0 with the code:
/* Enables the clock for the IOCON block. 0 = Disable; 1 = Enable.: 0x01u */
CLOCK_EnableClock(kCLOCK_Iocon);
IOCON->PIO[0][10] = ((IOCON->PIO[0][10] &
/* Mask bits to zero which are setting */
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_MODE_MASK | IOCON_PIO_DIGIMODE_MASK)))
/* Selects pin function.
* : PORT0_10 is configured as ADC0_0. */
| IOCON_PIO_FUNC(PIO016_FUNC_ALT0)
/* Selects function mode (on-chip pull-up/pull-down resistor control).
* : Inactive.
* Inactive (no pull-down/pull-up resistor enabled). */
| IOCON_PIO_MODE(PIO016_MODE_INACTIVE)
/* Select Analog/Digital mode.
* : Analog mode. */
| IOCON_PIO_DIGIMODE(PIO016_DIGIMODE_ANALOG));
Pls have a try.
Anyway, even if you do not connect the ADC0_0 pin(float), you will get a ADC sample, it is possible that the sample is not zero.
Hope it can help you
As a test, I suggest you connect the pin(ADC0_0) to GND or VDD via a serial 5K resistor as a test.
BR
XiangJun Rong
BR
XiangJun Rong
There is no code attached covering the pin initialisation, usually done in pin_mux.c by the SDK code.
I suggest the get the proper SDK (if you haven't already), select a proper example for your MCU/board in MCUxpresso, and build it.
I would recommend one of the ADC examples in driver_examples/adc. The lpc_adc_dma and lpc_adc_interrupt examples worked for me out of the box. I used a LPC54628.