Other HI-TECH Compilers & Products >> 8051 Legacy Compiler

Pages: 1
Mathew McKernan
stranger


Reged: Jul 23 2007
Posts: 2
V9.01 vs v7.44 Compiler
      #28716 - Mon Jul 23 2007 02:54 AM

Hi all,

I have inherited a project that was originally written for the v7.44 compiler. I have had to do some bugfixes and as a result have bought the latest version of the 8051 Compiler v9.01.

I have compiled the original code and loaded it onto our board. It would seem that it crashes when it gets to a certain stage in the code.

When I compiled it, I recieved some warnings regarding overflows due to constant use. The variables being loaded with the constant value are unsigned chars.

Does anyone know of any fundamental changes between the v7.44 and 9.01 that could possibly cause this and require me to make changes to the source. I have inspected the original project file for v7.44 and the required flags have been set in the new project for the v9.01 compiler/HI-TIDE.

I am a little confused with this one, as I am more experienced with other embedded micros, so any pointers would be appreciated.

Thanks all.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Mathew McKernan
stranger


Reged: Jul 23 2007
Posts: 2
Re: V9.01 vs v7.44 Compiler [Re: Mathew McKernan]
      #28728 - Mon Jul 23 2007 08:37 PM

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.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 0 anonymous users are browsing this forum.

Moderator:  ndouglas, jtemples, Dan Henry, Andrew L, mikerj, dave g, meisty, josh stevo 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 2511

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5