This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Simulator issue with printf?

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);
    }
}

Parents
  • "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."

    But you obviously hadn't read the manual.

    "Why even have a forum? Let's just let Andy reply to all posts with Please read the manual."

    When a post asks a question that is clearly and specifically addressed in the Manual, surely "Please read the manual" is the entirely appropriate response.
    I even gave you the specific page, and pointed you to the specific section.

    Surely, the purpose of the forum is to answer those questions that go beyond what is already spelled-out in the manuals?

Reply
  • "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."

    But you obviously hadn't read the manual.

    "Why even have a forum? Let's just let Andy reply to all posts with Please read the manual."

    When a post asks a question that is clearly and specifically addressed in the Manual, surely "Please read the manual" is the entirely appropriate response.
    I even gave you the specific page, and pointed you to the specific section.

    Surely, the purpose of the forum is to answer those questions that go beyond what is already spelled-out in the manuals?

Children
No data