This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Wierd code problem.

Hi guys,

I've been stucked for hours. It is a project for CORTEX-MX, the compiler I am using is KEIL in PRO mode.

Here is a segment of C code:

================================================================== case COMMAND_STATE_WAIT_WAVELENGTH: Request.wavelength = val; datacount++; if (Request.wavelength>128) { *cmderr = COMMAND_ERROR_DATALENGTH; command_state = COMMAND_STATE_ABORT; } else if (Request.wavelength ==0) { command_state = COMMAND_STATE_WAIT_CHECKSUM; } else { command_state = COMMAND_STATE_WAIT_DATA; }

break;
==========================================================

After compile,it turns into something else and it doesnt work.

I I changed "Request.wavelength>128" to "Request.wavelength+1>128+1", and it worked a bit better. >_<!

Please HELP.
what a miracle~~

Parents
  • The functionality of your code all depends on what's happening to the "val" variable which is outside the scope of your code snippet: the value is "val" is stored in Request.wavelength which then determines the path through teh rest of the code snippet.

    Have you tried checking the code that writes to "val"?

Reply
  • The functionality of your code all depends on what's happening to the "val" variable which is outside the scope of your code snippet: the value is "val" is stored in Request.wavelength which then determines the path through teh rest of the code snippet.

    Have you tried checking the code that writes to "val"?

Children
No data