Karthik Sukumar

infinite loop inside an interrupt

Discussion created by Karthik Sukumar on Apr 11, 2010
Latest reply on Apr 12, 2010 by bigmac

Hi guys,

 

I was experimenting with my QG8 micro the other day and was using the ADC. So below is a piece of code i used to make a VCO(voltage controlled oscillator) which increases the frequency of blinking of the LED.  I got the result I wanted for low frequencies but at higher frequencies the pattern is not right. So I wanted to know what sort of effect an infinite loop in an interrupt has on the MCU?

 

Any advice will be much appreciated. Thanks guys

 

 

__interrupt void isrVadc_complete(void)

{
 unsigned int set_time; 

 unsigned int ADC_val; 

 unsigned int count = 0;

 

for( ;; ) 

{                

ADC_val = ADCRL;   

set_time = ADC_val * 256;                              

 

if(count == set_time)

  {PTAD_PTAD0 = ~PTAD_PTAD0; }

 

else if( count > set_time) 

  {count=0; }

 

       count++;        

}

 

}

Outcomes