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.
I having problems with the C51 v6.2 not compiling certain lines of codes. I tried doing a search on previous posts but didn't see anything related. here are the C statements:
if (msg_inbuf!=0) // check if message waiting */ { ack_flag=1; // next received character should be ack*/ Write_S(); // Send to tx buffer */ }
; if (msg_inbuf!=0) // check if message waiting */ ; SOURCE LINE # 1562 MOV DPTR,#msg_inbuf MOVX A,@DPTR JNZ ?C0363 INC DPTR MOVX A,@DPTR ?C0363: JZ ?C0242 ; { ; SOURCE LINE # 1563 ; ack_flag=1; // next received character should be ack*/ ; SOURCE LINE # 1564 ; Write_S(); // Send to tx buffer */ ; SOURCE LINE # 1565 ; } ; SOURCE LINE # 1566
Just a guess... Could the parser be getting confused by the old-style closing comment sequence "*/" at the end of the new-style comments for some lines? Try either changing "//" to "/*", or eliminating the "*/" sequences altogether. --Dan Henry
Thanks for the response Dan but it didn't help.
Try creating a preprocessor listing file to see what the compiler is actually compiling. Since you didn't post the entire source, it's hard for anyone to try to compile it. It's possible that the problem is found in code your didn't post. Jon
if (msg_inbuf!=0)
Hello, maybe there is something that will be optimized to nothing? May be the well known hint "did you keep in mind the 'volatile'?", which helps in about 50 % of all strange behaviour phenomena in situations with interrupts and hardware variables? Is Write_S() existent? Or does it write to a variable that is never read again by software (I mean a hardware register) and therefore optimized to nothing?
Tried everything without success. The section was part of a if-else statement. Being desperate, I swapped the if-else sections and it worked. So now it reads:
if (msg_inbuf==0) { code } else { ack_flag=1; Write_S(); }