AnsweredAssumed Answered

Is it possible to use an " if- statement"  in an interrupt service routine ?

Question asked by rschoop on Apr 4, 2010
Latest reply on Apr 23, 2010 by SeanM

Hello all,

 

I am writing some code to get familiar with VDSP and the  EZ lite board.   Attached you can find a zip file with the project files.

 

In this  ISR code,   if  I include the  commented out part , the system will halt otherwise it will work fine.  I am testing everything on a oscilloscope.

Is there a problem for using  a n if statement in an  ISR  ??

 

 

EX_INTERRUPT_HANDLER(DMA2_ISR)

{
  *pDMA2_IRQ_STATUS = 0x1;
 
  b = b + 8;
  b = b % 32;
 
  /*
  if ( b == 24 )
  {
     c = c + 0x00004000;
     c = c % 0x00010000;
  }
  */
 
  b = b + c;
   
  *pDMA2_START_ADDR=   b ;

}

 

I have another question about the received warnings.  See zip file.    I  realized that I cannot use  pointer arithmetics. 

 

Instead of this code that works fine:

 

// channel 1
a = CH1_START_ADDRESS;
  ip = a;
  for ( n=0 ;n < 4 ; n++ )
  {
  *ip = buffer1[n];
  a = a + 4;
  ip = a;
  *ip = buffer2[n];
  a = a + 4;
  ip = a ;
}

 

I cannot put this code work properly:

 

// channel 1

  ip = CH1_START_ADDRESS;
 

  for ( n=0 ;n < 4 ; n++ )
  {
  *ip = buffer1[n];
 

  ip  + =4;
  *ip = buffer2[n];
 

  ip += 4 ;
}

 

Can some explain this a little bit ??

 

Thanks,

 

rschoop

Outcomes