This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EK-TM4C1294XL: ADC

Part Number: EK-TM4C1294XL

Dear Sir/Madam,

I am using EK-TM4C1294XL board. In my application I am using ADC input AIN1,AIN2,AIN3,AIN5,AIN6,AIN7.

I want to read all the ADC data in interrupt.

I have installed TI-SDK and checked the sample below,

ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\adc_udma_pingpong

ti\TivaWare_C_Series-2.2.0.295\examples\peripherals\adc

from that I got DCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0 | ADC_CTL_END | ADC_CTL_IE); - based on ADC_CTL_CH0  it will select channel

IntEnable(INT_ADC0SS0); - common to enable the all ADC0 interrupt

ADCSeq0Handler() - single handler for all ADC0 interrupt.

if it is a single handler how to identify which channel the interrupt arrived.

Kindly help.

Thanks

  • Hello Thalapushpam,

    You will need to configure a Step Sequence for each of your ADC channels. Then you will be able to read all of the data after the interrupt fires. Here is how you would do this for AIN1, AIN2, AIN3, AIN5, AIN6, AIN7.

        ADCSequenceStepConfigure(ADC0_BASE,0,0,ADC_CTL_CH1);
        ADCSequenceStepConfigure(ADC0_BASE,0,1,ADC_CTL_CH2);
        ADCSequenceStepConfigure(ADC0_BASE,0,2,ADC_CTL_CH3);
        ADCSequenceStepConfigure(ADC0_BASE,0,3,ADC_CTL_CH5);
        ADCSequenceStepConfigure(ADC0_BASE,0,4,ADC_CTL_CH6);
        ADCSequenceStepConfigure(ADC0_BASE,0,5,ADC_CTL_CH7|ADC_CTL_IE|ADC_CTL_END);

    if it is a single handler how to identify which channel the interrupt arrived.

    The interrupt will trigger after the last sequence, and so you would read each channels data at that time.

    Use an API like this to read all the channels into one buffer:

    ADCSequenceDataGet(ADC0_BASE, 0, pui32ADC0Value);

    Make sure to define the buffer large enough to hold all samples:

    uint32_t pui32ADC0Value[6];

    Once you get the results, the [0] index of the buffer will correspond to Step 0 which will be AIN1, and the [5] index of the buffer will correspond to Step 5 which will be AIN7.

    Best Regards,
    Ralph