Another problem bring up is that:
When I tried to use the following instrution to write the code for my 89C51 chip. It can be compiled successfully. But it does not work in 8051 when I burn the code. here is the code: If(c!='A' | c!='B' | c!='O' | c!='P') { send_serial("Invalid command"); send_serial(crlf); } Look like it does not take it when I write the format like above. Why ? I cannot understand. I think Keil C Uvison can take care it.
However, if I use only one if (c!='A') { send_serial("Invalid command"); send_serial(crlf); } if (c!='B') { send_serial("Invalid command"); send_serial(crlf); } if (c!='O') { send_serial("Invalid command"); send_serial(crlf); } if (c!='P') { send_serial("Invalid command"); send_serial(crlf); } The 89C51 will recognize and run my code properly. Can you expalin what is happening?
"Look like it does not take it ..."
What does that mean, precisely?
Anyway, you're using bitwise-OR, not logical-OR operators.
And you probably want logical-ANDs, not logical-ORs.