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~~
yay. crazy forum.
================================================================== 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; } ==========================================================
Please elaborate. The mere "it doesn't work" won't cut it.
I think you'll find that pretty much every other forum has a similar behaviour...
hey. have you tried compiling it again? i got a strange problem last week. getting loads of errors and it didnt work properly. but it got better at the finish.
Self-modifying code??!!
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"?