AT架构代码举例一、 代码举例(中断方式) 下面几条AT是常用的,是很多复杂应用的基础,暂且举例如何发送下面的AT: l AT l ATE0 l AT+CMEE=0 l AT+IPC=0,0 l AT+CPIN? l AT+CSQ 请大家结合前面架构二:中断方式结构图思路一起看代码.1 GPRS模块开机 2 GPRS模块同单片机同步,验证串口可以正常通信。 3 同步成功后,把要发送的AT放入队列: charGprsCommonAT_Init(void) { char At_Cmd_Buff[30] = {0}; char At_Name_Buff[20] = {0};
//ATE0 strcpy(At_Name_Buff, "ATE"); strcpy(At_Cmd_Buff, "ATE0\r\n"); AT_InTo_Queue( At_Name_Buff, At_Cmd_Buff, NULL);
//AT+CMEE=0 memset(At_Cmd_Buff, 0x0, sizeof(At_Cmd_Buff)); memset(At_Name_Buff, 0x0, sizeof(At_Name_Buff)); strcpy(At_Name_Buff,"AT+CMEE"); strcpy(At_Cmd_Buff, "AT+CMEE=0\r\n"); AT_InTo_Queue( At_Name_Buff, At_Cmd_Buff, NULL);
//AT+IFC=0,0 memset(At_Cmd_Buff, 0x0, sizeof(At_Cmd_Buff)); memset(At_Name_Buff, 0x0, sizeof(At_Name_Buff)); strcpy(At_Name_Buff,"AT+IFC"); strcpy(At_Cmd_Buff, "AT+IFC=0,0\r\n"); AT_InTo_Queue( At_Name_Buff, At_Cmd_Buff, NULL);
//AT+CPIN=0,0 memset(At_Cmd_Buff, 0x0, sizeof(At_Cmd_Buff)); memset(At_Name_Buff, 0x0, sizeof(At_Name_Buff)); strcpy(At_Name_Buff,"AT+CPIN"); strcpy(At_Cmd_Buff, "AT+CPIN?\r\n"); AT_InTo_Queue( At_Name_Buff, At_Cmd_Buff, NULL);
//AT+CSQ memset(At_Cmd_Buff, 0x0, sizeof(At_Cmd_Buff)); memset(At_Name_Buff, 0x0, sizeof(At_Name_Buff)); strcpy(At_Name_Buff,"AT+CSQ"); strcpy(At_Cmd_Buff, "AT+CSQ\r\n"); AT_InTo_Queue( At_Name_Buff, At_Cmd_Buff, NULL); }
|