When I step through this code I get the error message above
//Write an 8051 C program to read the P1.0 and P1.1 bits and issue an //ASCII character to P0 according to the following table. //P1.1 P1.0 //0 0 send ‘0’ to P0 //0 1 send ‘1’ to P0 //1 0 send ‘2’ to P0 //1 1 send ‘3’ to P0 //Solution: #include <reg51.h> void main(void) { unsigned char z; z=P1; z=z &0x300; switch (z) { case(0): { P0='0'; break; } case(1): { P0='1'; break; } case(2): { P0='2'; break; } case(3): { P0='3'; break; } } }
IF you're stepping, you should be able to see where the error happens...
Hint: what do you suppose will happen when your main() returns...?
Have you looked at the first examples in the Keil Manuals which address this point?
http://www.keil.com/support/man/docs/uv4/uv4_examples.htm
the '51 aint no PC
what do you suppose will happen when your main() returns...?
Erik
Thanks for the heads up this should have been obvious to me; embarassing.