MCUXpresso SDK API Reference Manual  Rev 2.16.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ADC16 Peripheral and Driver Overview

Content including 1) features; 2) driver design logic and use method; 3) typical use case. More...

Peripheral features and how this peripheral works

Analog-to-Digital Converter function

For the chip-specific implementation details of this module's instances see the chip configuration information.The 16-bit analog-to-digital converter (ADC) is a successive approximation ADC designed for operation within an integrated microcontroller system-on-chip.For the chip specific modes of operation, see the power management information of the device.

Features

How does this peripheral work

Before the ADC16 module can be used to complete conversions, an initialization procedure must be performed. A typical sequence is:

  1. Get ADC16 default Configuration.
  2. Update select the input clock source and the divide ratio used to generate ADCK. This register is also used for selecting sample time and low-power configuration.
  3. Update select the conversion trigger, hardware or software, and compare function options, if enabled.
  4. Update select whether conversions will be continuous or completed only once and whether to perform hardware averaging.
  5. Update registers to enable or disable conversion complete interrupts. Also, select the input channel which can be used to perform conversions.
  6. Initialization ADC16 Configuration,Calibrate the ADC by following the calibration instructions in Calibration function.
  7. Turn on the ADC16 conversion.

How this driver is designed to make this peripheral works

The adc16 driver provides a structure adc16_config_t, which contains the main options of the adc16 function. The ADC16_Init() function uses adc16_config_t type parameters, this function can be used for configuration In addition to clock selection, frequency setting, sampling time, trigger mode, interrupt enable, DAM enable, hardware trigger configuration, the main features of the ADC16 module.After the ADC16_Init() function is called when the relevant converter is powered on,exist The software starts or is triggered by the hardware, and starts according to the configured options.

How to use this driver

Typical Use Case

This function initializes the converter configuration structure with available settings. The default values are as follows.

  1. ADC16_polling initialize
    * adc16_config_t adc16ConfigStruct;
    * ADC16_GetDefaultConfig(base,&adc16ConfigStruct);
    * adc16ConfigStruct.eChannelInput = kADC16_Input17Channel;
    * adc16ConfigStruct.u32GroupId = 0U;
    * adc16ConfigStruct.bEnableInterruptOnConversionCompleted = false;
    * ADC16_Init(base,&adc16ConfigStruct);
    *
  2. ADC16_interrupt initialize
    * adc16_config_t adc16ConfigStruct;
    * ADC16_GetDefaultConfig(base,&adc16ConfigStruct);
    * adc16ConfigStruct->eChannelInput = kADC16_Input17Channel;
    * adc16ConfigStruct->u32GroupId = 0U;
    * adc16ConfigStruct.bEnableInterruptOnConversionCompleted = true;
    *
  3. ADC16_continuous_dma initialize In this type of use case. Note the continuous mode must be selected,turn on the dma.If the application wants to use interrupt, please remember to enable related interrupts.The prototype of this type of use case is shown below.
    * adc16_config_t adcUserConfig;
    * ADC16_GetDefaultConfig(&adcUserConfig);
    * adcUserConfig.bEnableContinuousConversion = true;
    * adcUserConfig.bEnableLowPower = true;
    * adcUserConfig.u32GroupId = 0U;
    * adcUserConfig.bEnableInterruptOnConversionCompleted = false;
    * adcUserConfig.bEnableDMA = true;
    *