Continuous ADC application with completion interrupt [ADC of STM32]
This program is an introduction to the combination of AD conversion and interrupts; interrupts are supposed to be generated each time AD conversion is completed, and as it is, the frequency of interrupts is too high to be practical, but please understand interrupts as a learning tool.
This program generates an interrupt when AD conversion is completed, acquires the conversion value in the process in the interrupt handler, and monitors and displays the acquired value in 100ms cycles The interrupt handler for ADC1 is ADC1_2_IRQHander().
This program shows an example of using an interrupt when a conversion is completed.
The sample program uses ADC_GetITStatus() to check the status of the conversion completion flag ADC_IT_EOC to see the cause of the interrupt.
Execution Example of Interrupt Status
if(ADC_GetITStatus(ADC1, ADC_IT_EOC) != RESET){
ADC_ClearITPendingBit(ADC1, ADC_IT_EOC);
[Interrupt processng]
}
The first argument specifies the ADC to be set.
■ Setting target ADC : ADC1 – ADC3
The second argument specifies one of the following macros for the interrupt to be enabled.
The third argument specifies whether it is enabled or disabled.
■ ENABLE: enable
■ DISABLE: disable
The sample program introduces a combination of AD conversion and interrupts; interrupts are generated each time AD conversion is completed, and as it is, the frequency of interrupts is too high, so some modification is needed to reduce the frequency of interrupts to make it practical.