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.
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...?
I use this function to initialize the serial port but it automatically sends 2 bytes to the PC and I see no reason why.Could you help me to solve this problem?How do I fix my fault?
void init() { PCON |= 0x80; TMOD |= 0x20; SCON=0x52; TH1=0xF3; TR1=1 }
What happens when you try the following:
void init() { PCON |= 0x80; TMOD |= 0x20; SCON=0x52; TH1=0xF3; TL1=0xF3; TR1=1 }