AnsweredAssumed Answered

MPC5744P-ADC-analog watchdog interrupt question

Question asked by 大大 许 on Oct 13, 2017
Latest reply on Oct 15, 2017 by David Tosenovjan

Hi,

I meet a ADC analog watchdog problem ,I want to make the result of analog watchdog monitoring ADC conversion in the threshold area I set.

If it is not in the range, the interrupt function is used to process the data . But now the ADC_0.WTISR.B.WDG1H or ADC_0.WTISR.B.WDG1L position is 1, and the program does not interrupt 

follow is my setting

 

 ADC_Init(0,CH5Smask,0,SCAN);   //ADC0 clk is 80MHZ enable adc0_CH5 scan mode,
 ADC_SetThldForChannel(0,5,1);    //setting ADC0 THreshold register 1 add to channel5

 

 ADC_SetThldRegister(0,1,0x800,0xAAA,0x0C);   //enable wdg1H and WDG1L  setting Threshold

 

 ADC_StartNormalConversion(0,CH5Smask);  //start conversion
 for(;;) {   
  
  volt = ADC_GetChannelValue(0, 5);          //auto clear flag 
  volt = volt*3300/4095;     
  if(ADC_0.WTISR.B.WDG1H ==1)      //check interrupt flag
   cnt++;
  if(ADC_0.WTISR.B.WDG1L ==1)      //check interrupt flag
   cnt++;
  
 }

void ISR498_ADC0_WD(void)    //WD interrupt deal
{
   volatile uint32_t volt = 0;
   volt = ADC_GetChannelValue(0, 5);
   volt = volt*3300/4095;      //将结果放大1000倍
   ADC_ClearThldFlags(0);
}
 

Outcomes