Jump to main content

##

# 2.3.32 ADC_ConversionSequenceSet Function

## C

    void ADC_ConversionSequenceSet (ADC_CHANNEL *channelList, uint8_t numChannel)
    void ADC_ConversionSequenceSet (ADC_CHANNEL_NUM *channelList, uint8_t numChannel)

## Summary

Sets the user sequence of the channel conversion

## Description

This function sets the order in which channels are converted.

## Precondition

ADC_Initialize() must have been called first for the associate instance. Conversion should not be ongoing while changing the sequence.

## Parameters

Param | Description
--- | ---
*channelList | pointer to the list of the channels which describes the order of conversion
numChannel | Number of enabled channels in the list

## Returns

None.

## Example

    ADC_CHANNEL seq_order[4] = {ADC_CH3, ADC_CH5, ADC_CH1, ADC_CH2};
        ADC_Initialize();
        ADC_ConversionSequenceSet(seq_order, 0x4);
        ADC_ChannelsEnable(ADC_CH0_MASK | ADC_CH1_MASK | ADC_CH2_MASK | ADC_CH3_MASK);

    ADC_CHANNEL_NUM seq_order[4] = {ADC_CH3, ADC_CH5, ADC_CH1, ADC_CH2};
        ADC_Initialize();
        ADC_ConversionSequenceSet(seq_order, 0x4);
        ADC_ChannelsEnable(ADC_CH0_MASK | ADC_CH1_MASK | ADC_CH2_MASK | ADC_CH3_MASK);

## Remarks

Conversion order is set in this function and remains valid until user configures new conversion sequence order or reinitializes the peripheral. Array pointed to by *channelList must be valid during the call to this function. This function copies the array data into ADC HW registers.