We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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); } }
"WHAT IS WRONG?"
1) The code is lousy!
2) You still haven't learned what BCD numbers are!
Try one more time to google for BCD numbers. How can you know when a solution works or not, if you don't even know what the expected output result is?
By the way: Please post your address, and you'll get a visitor that will rip the caps-lock key from your keyboard - and every keyboard within a 100m radius... Upper-case text represents shouting, as already told a number of times in this thread. Are you dense?