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);
}
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.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Robin, you're right. ADC_FIFO_demo can work for me. Thanks.