Jump to content
Sign in to follow this  
MarkS

Program Resetting

Recommended Posts

Here is a section of my code:

else if (msg_type[2] == 'T' && msg_type[3] == '4')
{
IQ_msg_type = IQT4;
while(print_flag != 0);
print_flag = PP;
SysSignalSemaphoreIsr(hSemaphore); 	
}
else if (msg_type[2] == 'T' && msg_type[3] == '5') // this one is the problem
{
IQ_msg_type = IQT5;
while(print_flag != 0);
print_flag = PP;
SysSignalSemaphoreIsr(hSemaphore); 	
}
else if (msg_type[2] == 'T' && msg_type[3] == '6')
{
IQ_msg_type = IQT6;
while(print_flag != 0);
print_flag = PP;
SysSignalSemaphoreIsr(hSemaphore); 	
}

There are 8 of these 'else if' statements. All of them work fine except '5'. When it executes the SyssignalSemaphoreISR call the program resets. By single stepping and watching the program counter, it totally went to the wrong place..

 

This code has been running for months.. I am making some additions to the program but I everything else works.

I'm lost. Any Ideas?

thanks,

mark

Share this post


Link to post
Share on other sites
Here is a section of my code:

else if (msg_type[2] == 'T' && msg_type[3] == '4')

{

IQ_msg_type = IQT4;

while(print_flag != 0);

print_flag = PP;

SysSignalSemaphoreIsr(hSemaphore);

}

else if (msg_type[2] == 'T' && msg_type[3] == '5') // this one is the problem

{

IQ_msg_type = IQT5;

while(print_flag != 0);

print_flag = PP;

SysSignalSemaphoreIsr(hSemaphore);

}

else if (msg_type[2] == 'T' && msg_type[3] == '6')

{

IQ_msg_type = IQT6;

while(print_flag != 0);

print_flag = PP;

SysSignalSemaphoreIsr(hSemaphore);

}

 

There are 8 of these 'else if' statements. All of them work fine except '5'. When it executes the SyssignalSemaphoreISR call the program resets. By single stepping and watching the program counter, it totally went to the wrong place..

 

This code has been running for months.. I am making some additions to the program but I everything else works.

I'm lost. Any Ideas?

thanks,

mark

 

 

I did resolve the problem by getting rid of all the 'else if' statements and converting it to a 'switch'. I'm assuming the else if was pushing to the stack?

Share this post


Link to post
Share on other sites
...I did resolve the problem by getting rid of all the 'else if' statements and converting it to a 'switch'. I'm assuming the else if was pushing to the stack?...

 

The else if construction does not use stack.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...