AnsweredAssumed Answered

SP debug info incorrect

Question asked by Ondrej Machek on Jan 17, 2009
Latest reply on Jan 28, 2009 by Ondrej Machek
Hello I have this code:


int n = 0;
void interrupt 38 receive_can(void){

unsigned char count;

Rx_Table[n].DLC=(CAN0RXDLR & 0x0F); /*prijata delka*/

for(count = 0; count < Rx_Table[n].DLC; count++){
Rx_Table[n].Data[count] = *(&CAN0RXDSR0 + count); /*kopirovani dat*/
}

CAN0RFLG = 0x01; /*nastaveni RXF dalsi zprava muze byt prijata*/
n++;
}

/******************************************************/
but if I would like debug there is warming SP debug info incorrect...
But if I arrange code (where int n = 0; is inside the function):
/*****************************************************/
void interrupt 38 receive_can(void){

unsigned char count;
int n = 0;

Rx_Table[n].DLC=(CAN0RXDLR & 0x0F); /*prijata delka*/

for(count = 0; count < Rx_Table[n].DLC; count++){
Rx_Table[n].Data[count] = *(&CAN0RXDSR0 + count); /*kopirovani dat*/
}

CAN0RFLG = 0x01; /*nastaveni RXF dalsi zprava muze byt prijata*/
n++;
}

It work properly without warmings but I need "n" as global. Is it mistake if I have "n" as global? Can I Switching off this optimization? Or I have mistake in code?

Thank you very much.

Outcomes