While using the simulator, the values of i in the serial window are shifted by left 8 bits.
#include "stdlib.h" #include "stdio.h" #include "reg51.h" void main (void) { unsigned char i; SCON = 0x50; TMOD |= 0x20; TH1 = 221; TR1 = 1; TI = 1; for (i = 0; i < 8; i++) { printf("%x\n", i); } }
YOU WANT ME TO FAIL?
Yes, yes and yes again IF
.... the only way you can not fail is by someone providing you with answers to a thing as simple as this. Should someone be stupid enough to 'help' you get a diploma under false pretenses, I pity the poor employer that hires you based on a diploma you have receieved without even having a gist of the knowledge the diploma specifies that you have.
Erik