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.
Does anyone know why this doesn't work:
#define x 5;
...
if(state == x){... }
Does anyone know why I can't do the above comparison?
Yes - because it's wrong!
See Andy's Handy Hint for Debugging Preprocessor Problems: www.8052.com/.../29152
Note that this is a general (and quite common) 'C' mistake - nothing specifically to do with Keil or ARM or 8052/8051...
Thanks that definitely solved the issue.
"I think I wasn't clear. I am getting a compile error. If I replace the x with an actual number, the code compiles correctly."
You were plenty clear. And I thought I was plenty clear when I asked you to manually replace "x" with "5;" - does this look like "good" text-book C code?
if(state == 5;){... }