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?
Your code is wrong.
You need to correct the code so that it correctly represents what you want it to do.
You have a basic 'C' language problem - it is nothing specifically to do with Keil or the 8051.