We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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~~
is that your problem is due to you not reading instructions (e.g. "Place source code source code between ...")
Erik
Well, any tool would be pretty pointless if its output were just identical to its input - wouldn't it?!
As already noted, you would do well to pay more attention to instructions: www.danlhenry.com/.../keil_code.png
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"?