sim800 gprs发送数据的AT流程

时间:2021-11-02 03:46:06

switch(send_flag)
{
case 1:
uart_send(&huart4,"AT\r\n",4); //AT
break;

case 2:
uart_send(&huart4,"ATE1\r\n",sizeof("ATE1\r\n")-1); //回显
break;

case 3:
uart_send(&huart4,"AT+CSCLK=0\r\n",sizeof("AT+CSCLK=0\r\n")-1); // 开启慢时钟
break;

case 4:
uart_send(&huart4,"AT+CGCLASS=\"B\"\r\n",sizeof("AT+CGCLASS=\"B\"\r\n")-1); //GPRS 移动台类别 B,CG,CC
break;

case 5:
uart_send(&huart4,"AT+CIPSTART=\"TCP\",\"115.198.143.250\",7878\r\n",sizeof("AT+CIPSTART=\"TCP\",\"115.198.143.250\",7878\r\n")-1);
break;

case 6:
uart_send(&huart4,"AT+CIPSEND=6\r\n",sizeof("AT+CIPSEND=6\r\n")-1); //GPRS发送数据
break;

case 7:
uart_send(&huart4,"123456789",sizeof("123456789")-1);//获取本地IP地址
// UART4->DR=0x1A;
// while((UART4 ->SR & 0X40)==0);
break;

}