esp8266模块执行不了stc8单片机发送的at指令

stc8单片机串口2与esp8266连接 我给模块发at指令的字符串 模块闪了蓝灯,应该是发送到了 但是模块并没有执行想要的at指令,求救

#include "stc8.h"
#include "intrins.h"

#define FOSC            11059200UL
#define BRT             (65536 - FOSC / 115200 / 4)
sbit LED1=P5^5;

bit busy;
char wptr;
char rptr;
char buffer[16];

void Uart2Isr() interrupt 8 using 1
{
    if (S2CON & 0x02)
    {
        S2CON &= ~0x02;
        busy = 0;
    }
    if (S2CON & 0x01)
    {
        S2CON &= ~0x01;
        buffer[wptr++] = S2BUF;
        wptr &= 0x0f;
    }
}

void Uart2Init()
{
    S2CON = 0x50;
    T2L = BRT;
    T2H = BRT >> 8;
    AUXR = 0x14;
    wptr = 0x00;
    rptr = 0x00;
    busy = 0;
}

void Uart2Send(char dat)
{
    while (busy);
    busy = 1;
    S2BUF = dat;
}

void Uart2SendStr(char *p)
{
    while (*p)
    {
        Uart2Send(*p++);
    }
}
void delay(unsigned int m)        //????
    {
      int  a=0,b=0;
      for(a=0;a<500;a++)
      for(b=0;b<m;b++);

    }
void main()
{
    Uart2Init();
    IE2 = 0x01;
    EA = 1;
      delay(2000);
    Uart2SendStr("AT+CWMODE=2");
      Uart2Send('\r');
      Uart2Send('\n');
      LED1=0;
      delay(5000);
    Uart2SendStr("AT+CWSAP=\"521\",\"123465789\",1,4");
        Uart2Send('\r');
      Uart2Send('\n');
      delay(5000);
      Uart2SendStr("AT+RST");
        Uart2Send('\r');
      Uart2Send('\n');
    while (1)
    {
              LED1=1;

    }
}
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问