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

problem about putchar and puts functions

I have a sub
void init()
{
PCON |= 0x80;
TMOD |= 0x20;
SCON=0x52;
TH1=0xF3;
TR1=1
}
void main()
{
init();
while(1)
{
}
}
I see no reason why when I call init() it automatic send two bytes to my PC because I run my program on PC it receives "||" or "o'".Could someone help me to solve this problem?
Thanks.

Parents
  • 1. please read the instructions about how to post code - it was right there above the box where you typed you post, and here:
    http://www.keil.com/forum/tips.asp

    "I see no reason why when I call init() it automatic send two bytes to my PC because I run my program on PC it receives "||" or "o'"."

    This is probably just junk resulting from the glitch when you change the UART from its initial, undefined state to your proper config!

    Are you sure that all your buffers, etc, are properly initialised...?

Reply
  • 1. please read the instructions about how to post code - it was right there above the box where you typed you post, and here:
    http://www.keil.com/forum/tips.asp

    "I see no reason why when I call init() it automatic send two bytes to my PC because I run my program on PC it receives "||" or "o'"."

    This is probably just junk resulting from the glitch when you change the UART from its initial, undefined state to your proper config!

    Are you sure that all your buffers, etc, are properly initialised...?

Children