This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS570LS1224: Problems with scinotification() and global variables using HalCogen and CCS

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN,

Tool/software: Code Composer Studio

Hi,

I've been having some trouble with an issue I can't really understand. I'm using Halcogen and CSS to create a program in which the TMS570LS1224 receives some messages via RX pin using interrupts. That seems to work well, but then I wanted to use some variable to keep track of how many messages the TMS570LS1224 receives, so I created a global value (declared outside any function) which I called j  for this purpose. The problem is everytime I enter scinotification(), that variable somehow changes its value for seemingly no reason so it doesn't work as expected (it should be incremented by one everytime a new message is received). Can someone help me with this? 

This is my code:

#include "sci.h"
#include "stdlib.h"
#include "sys_common.h"

static unsigned char npulses;
uint8_t j = 0;

int main(void)
{

_enable_IRQ();

sciInit();

sciReceive(sciREG,9,(unsigned char *)&npulses);

while(1);

}

void sciNotification(sciBASE_t *sci, unsigned flags)
{
 j++;
sciSend(scilinREG, 9, (unsigned char *)&npulses); 

sciReceive(sciREG,9,(unsigned char *)&npulses);

return;

}

void esmGroup1Notification(int bit)
{
return;
}

void esmGroup2Notification(int bit)
{
return;

}