Sorry all, I posted a followup for this yesterday but it didn't seem to make it to the post.
I am receiving warnings about arithmetic overflow in constant expression. No doubt, this is due to some of the variables using unsigned chars, rather than an integer. In our situation the size provided by a char is fine.
The code of one of the problematic functions is below:
Code:
unsigned char TwoASCIICharsToHex(unsigned char* str)
{
unsigned char result;
//
// get higher byte value
if(str[0]<=0x39)
result=(str[0]-0x30)*0x10;
else
result=(str[0]-0x37)*0x10;
// get lower byte value
if(str[1]<=0x39)
result+=(str[1]-0x30);
else
result+=(str[1]-0x37);
// return result
return result;
}
There is a state machine in the code to send out data by pulsing one of the pins of the micro. It seems it gets partway through and the watchdog kicks in and resets the micro. I am not sure why, but I am in the process of doing further debugging today. There are the same warnings "arithmetic overflow in constant expression" occuring in the state machine.
Is it possible that if a value overflows the processor may end up in an infinite loop and the watchdog kicks in? Seems unusual that the original code that was compiled on v7.44 seems to be working fine.