MPC5744P-ADC-analog watchdog interrupt question

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

MPC5744P-ADC-analog watchdog interrupt question

1,054 Views
大大许
Contributor III

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);
}
 

Labels (1)
Tags (1)
0 Kudos
1 Reply

624 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, if it helps, I have example code for this feature (even though written for different device, ADC module and the principle of usage of analog watchdog is the same:

https://community.nxp.com/docs/DOC-333894 

If I undertand your issue well, I think you have swapped low and high thresholds.