2015-09-19 10:25 AM
Hi Every one, I am trying to establish AWD Interrupt when the voltage value exceedsADC_ITConfig(ADC1, ADC_IT_AWD, ENABLE); I dont know for what reason Is my interrupt not triggering, I try to turn on LED if the interrupt occurs but it is not, Kindly help me out.
ADC_Init(ADC1, &ADC_InitStructure);
ADC_RegularChannelConfig(ADC1, ADC_Channel_11, 1, ADC_SampleTime_480Cycles);
ADC_AnalogWatchdogSingleChannelConfig(ADC1, ADC_Channel_11);//PC1
ADC_AnalogWatchdogThresholdsConfig(ADC1, 100, 5);
ADC_ClearFlag(ADC1, ADC_FLAG_AWD);
ADC_AnalogWatchdogCmd(ADC1, ADC_AnalogWatchdog_SingleInjecEnable);
ADC_ITConfig(ADC1, ADC_IT_AWD, ENABLE);
// ADC IS working fine, I can read values exceeding this threshold.
// Interrupt
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = ADC_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 7;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// Interrupt Handler
void ADC_IRQHandler(void)
{
STM_EVAL_LEDOn(LED3);
if (ADC_GetITStatus(ADC1, ADC_IT_AWD))
{
ADC_ClearITPendingBit(ADC1, ADC_IT_AWD);
// ADC_ITConfig(adc, ADC_IT_AWD, DISABLE);
STM_EVAL_LEDOn(LED4);
}
}
2015-09-19 01:06 PM
The analog channel is configured as regular, but the watchdog command is injected.
Cheers, Hal2015-09-19 04:19 PM
Perfect Perfect Perfect :) Thanks thanks thanks