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); } }
Think about JIUYA as a response to Please read the manual, it will come to you.
naah, I cant, however, except for the 'J' I can make a guess based on the general rudeness of your post.
Erik
"... provided the reason ..."
You are right...no reason, just a solution.
Thanks.
Andy did little more than what He Xi had already done.
That page isn't an explanation of 'what's going on', it contains a sentence about how b or B are optional characters to specify char types. Please explain how this information is new and more revealing than He's information.
This wasn't a question about ANSI c, or a general programming question. It was a question posted in a Keil forum about a Keil specific implementation. I searched the forum first and didn't find any pertinent posts.
Why even have a forum? Let's just let Andy reply to all posts with Please read the manual.
Maybe Andy was trying to be helpful, but he lost me at Please read the manual.
I do find it's important to understand what's going on...it has yet to be presented here.
Actually no reason was provided; only one of two solutions and that one was C51-specific, not a general solution.
Andy, specifically stated "To understand what's going on"
then you post Please read the manual? How about JIUYA?
He Xi kindly provided the reason, no need for you to be a keyboard cowboy.
two questions 1) do you find it unimportant "To understand what's going on", in which case I sincerely pity you. 2) what is JIUYA
Please read the manual? How about JIUYA?
To understand what's going on, see: http://www.keil.com/support/man/docs/c51/c51_printf.htm
Pay particular attention to the bullet-point Notes below the table of format specifiers...
try this: printf("%bx\n", i);
View all questions in Keil forum