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); } }
"I TRY GOOGLE AND MICROSOFT BUT CANNOT FIND ANY CODE THAT WORKS"
Hmmm ...
Not sure about Google code, but I have sometimes found myself wondering if Microsoft code works!
Oh yes ... a hint to the screamer
I think you mean packed BCD - Try a search for that!