单片机串口通信问题,求个大佬帮忙看看

图片说明
图片说明

这个为proteus仿真图

仿真之后按下A机的按键,结果只有A机的灯反弹,B机的灯灭掉
感觉就是B机没有接收到A的指令。。应该是这样吧?

可是要咋做才能让这两个同步?串口我也按老师的提示写了啊

以下为主代码

#include <reg51.h>
sbit K1 = P2^0;
sbit K2 = P2^1;
void Delay(unsigned int c);   //延时10ms

void main(void)
{
    unsigned char LED;
    LED = 0x01;
    K1 = 1;
    K2 = 1;

    TMOD=0x20;
    PCON=0x80;
    TL1=0xF3;
    TH1=0xF3;
    TR1=1;

    SCON=0x50;
    EA=1;
    ES=1;

    while(1)
    {
            SBUF=P1;
            while(TI!=1);
            TI = 0;
            while(1)            
            {
                LED = LED<<1;
                P1 = ~LED;
                Delay(50);
                if(K1 == 0)
                {
                    if(LED == 0x80)
                        break;
                    else
                        LED = 0x00;
                }
            }
            while(1)            
            {
                LED = LED>>1;
                P1 = ~LED;
                Delay(50);
                if(K2 == 0)
                {
                    if(LED == 0x01)
                        break;
                    else
                        LED = 0x00;
                }
            }
    }
}

https://zhidao.baidu.com/question/750946461268345012.html