ADC callback for KE02

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC callback for KE02

624 Views
adam_zhou
Contributor I

I want to read values from the multiple ADC channels in interrupt mode. From the kexx_drv_lib, ADC_SetCallBack() sets the callback function and ADC_SetChannel() sets ADC channel. Can I set the multiple channels and then know which channel the value with ADC_ReadResultReg() is from in callback function?

Code example:

...

    ADC_SetCallBack(ADC_CallBack);
    ADC_Init(ADC, &sADC_Config);

    ADC_SetChannel(ADC,ADC_CHANNEL_AD2)

    ADC_SetChannel(ADC,ADC_CHANNEL_AD3)

    ADC_SetChannel(ADC,ADC_CHANNEL_AD4)

...

void ADC_CallBack( void )

{

    //Which ADC channel is this result from? Any function can be used?

    uint16_t result = ADC_ReadResultReg(ADC);

}

2 Replies

446 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

Sorry for the late reply!

This MCU doesn't have such a Register which include Channel Conversion Complete Flag.

Have you try to use the ADC_FIFO_demo in KEXX_DRIVERS_V1.2.1_DEVD.

ADC_FIFO_demo.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

446 Views
adam_zhou
Contributor I

Robin, you're right. ADC_FIFO_demo can work for me. Thanks.

0 Kudos