
UM10800
All information provided in this document is subject to legal disclaimers.
© NXP Semiconductors N.V. 2016. All rights reserved.
User manual
Rev. 1.2 — 5 October 2016
438 of 487
NXP Semiconductors
UM10800
Chapter 30: LPC82x ROM API ADC drivers
error_code
: ADC error code
num_channel
: In interrupt mode, number of ADC channels that have been converted.
Depending on the driver mode, the ADC_CALLBAK_T is either invoked in the ADC
overrun, threshold compare interrupt handler, or DMA interrupt handler.
In the overrun and threshold compare interrupt mode, the error code and the number of
ADC channels are passed to the callback function. In DMA mode, the callback functions
indicates the completion of the DMA transfer.
30.4.12.6 ADC_DMA_SETUP_T
This function defines the ADC DMA channel set-up function type.
typedef ErrorCode_t (*ADC_DMA_SETUP_T) (ADC_HANDLE_T handle, ADC_DMA_CFG_T *dma_cfg);
When the driver mode is DMA, this DMA set-up callback is invoked.
To set up the DMA channel, the source address, destination address, and the DMA
transfer length, the DMA request information must be retrieved from the driver structure,
which is originally passed from ADC_PARAM_T structure.
30.5 Functional description
30.5.1 Example
Perform a simple analog-to-digital conversion with the ADC0 in interrupt mode (sequence
A done) using a hardware trigger (ADC0_PINTRIG0). Triggering the sequence once starts
the conversion. All 12 channels are sampled. Use the ADC API as follows:
Remark:
For this example, burst mode must be disabled.
1. Assign the ADC0_PINTRIG0 function to a pin in the switch matrix.
2. Global defines:
#define rom_drivers_ptr (* (ROM **) 0x03000200)
ADCD_API_T * pAdcApi ; //define pointer to type API function addr table
ADC_HANDLE_T* adc_handle_0; //handle to ADC0 API
ADC_PARAM_T param;
ADC_CONFIG_T adc_cfg;
#define RAMBLOCK_H 60
uint32_t start_of_ram_block0[ RAMBLOCK_H ] ;
#define BUFFER_SIZE 100
uint32_t adc_buffer[BUFFER_SIZE];
3. Initialize pointer to the ADC API:
pAdcApi = (ADCD_API_T *) (rom_drivers_ptr->pADCD);
4. Initialize ADC0:
size_in_bytes = pAdcApi->adc_get_mem_size() ; //size_in_bytes/4 must be