我是靠谱客的博主 冷艳金针菇,最近开发中收集的这篇文章主要介绍EC20 TCP/IP指令例程,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

串口已经调试通过;EC20 TCP/IP指令例程 具体指令如下



/* Use AT+CPIN?/AT+CREG?/AT+CGREG? to query the SIM status and network registration status */
[2015-09-14 13:56:10:185_S:] AT+CPIN?
[2015-09-14 13:56:10:208_R:] AT+CPIN?

[2015-09-14 13:56:10:208_R:] +CPIN: READY

[2015-09-14 13:56:10:208_R:] OK
[2015-09-14 13:56:10:210_S:] AT+CREG?
[2015-09-14 13:56:10:223_R:] AT+CREG?

[2015-09-14 13:56:10:223_R:] +CREG: 0,1

[2015-09-14 13:56:10:223_R:] OK
[2015-09-14 13:56:10:226_S:] AT+CGREG?
[2015-09-14 13:56:10:239_R:] AT+CGREG?

[2015-09-14 13:56:10:239_R:] +CGREG: 0,1

[2015-09-14 13:56:10:239_R:] OK

第一步:配置 context profile

AT+QICSGP=1,1,”UNINET”,””,””,1 //配置 context profile 1,这里以中国联通举例 AT+QICSGP=1,1,"CMNET","","",1

//移动APN:CMNET; 联通APN:UNINET OK

设置GPRS连接模式,设置命令AT+QICSGP=1,"CMNET"中国移动或者中国联通卡,通过GPRS连接TCP的这条命令可以省略,但是不建议省略。

/* Use AT+QICSGP=1,1,"UNINET","","",0 to set APN as "UNINET",user name as "",password as ""*/
[2015-09-14 13:56:10:243_S:] AT+QICSGP=1,1,"UNINET","","",0
[2015-09-14 13:56:10:255_R:] AT+QICSGP=1,1,"UNINET","","",0
[2015-09-14 13:56:10:271_R:] OK

第二步:激活 context profile
/* Activate context profile */
[2015-09-14 13:56:10:274_S:] AT+QIACT=1
[2015-09-14 13:56:10:287_R:] AT+QIACT=1

[2015-09-14 13:56:11:167_R:] OK

/* Query the status of the context profile */
[2015-09-14 13:56:11:181_S:] AT+QIACT?
[2015-09-14 13:56:11:199_R:] AT+QIACT?

[2015-09-14 13:56:11:199_R:] +QIACT: 1,1,1,"10.23.163.28"

[2015-09-14 13:56:11:199_R:] OK

/* Use ATV1 to set the response format */
[2015-09-14 13:56:12:452_S:] ATV1
[2015-09-14 13:56:12:462_R:] ATV1

[2015-09-14 13:56:12:478_R:] OK

/* Use AT+QIOPEN=1,0,"TCP","116.247.104.27",6003,0,1 to connect to a TCP server (IP address: 116.247.104.27:6003). */
[2015-09-14 13:56:12:488_S:] AT+QIOPEN=1,0,"TCP","116.247.104.27",6003,0,1
[2015-09-14 13:56:12:510_R:] AT+QIOPEN=1,0,"TCP","116.247.104.27",6003,0,1

[2015-09-14 13:56:12:510_R:] OK

[2015-09-14 13:56:13:314_R:] DSR:1 CTS:1 (RI:1) DCD:0

[2015-09-14 13:56:13:328_R:] +QIOPEN: 0,0

[2015-09-14 13:56:13:434_R:] DSR:1 CTS:1 (RI:0) DCD:0

/* Use AT+QISEND=0 to send data to server, ">" from the UART or USB port indicates the following input data is considered as data to be sent. After receiving ">", input data (TEST), the maximum length of the data is 1460, the data beyond 1460 will be omitted. Then use <CTRL+Z> to send data. When receive SEND OK means the data has been sent */
[2015-09-14 13:56:19:360_S:] AT+QISEND=0
[2015-09-14 13:56:19:383_R:] AT+QISEND=0

[2015-09-14 13:56:19:383_R:] > 123456789
[2015-09-14 13:56:19:608_R:] SEND OK

/* Use AT+QISEND=0,0 to query whether all the data have been sent out */
[2015-09-14 13:56:19:624_S:] AT+QISEND=0,0
[2015-09-14 13:56:19:640_R:] AT+QISEND=0,0

[2015-09-14 13:56:19:640_R:] +QISEND: 9,0,9

[2015-09-14 13:56:19:640_R:] OK

[2015-09-14 13:56:20:265_R:] DSR:1 CTS:1 (RI:1) DCD:0

[2015-09-14 13:56:20:280_R:] +QIURC: "recv",0,9
[2015-09-14 13:56:20:280_R:] 123456789

[2015-09-14 13:56:20:386_R:] DSR:1 CTS:1 (RI:0) DCD:0
[2015-09-14 13:56:20:646_S:] AT+QISEND=0,0
[2015-09-14 13:56:20:656_R:] AT+QISEND=0,0

[2015-09-14 13:56:20:672_R:] +QISEND: 9,9,0

[2015-09-14 13:56:20:672_R:] OK

/* Use ATE1 to enable echo mode */
[2015-09-14 13:56:22:479_S:] ATE1
[2015-09-14 13:56:22:495_R:] ATE1

[2015-09-14 13:56:22:495_R:] OK

/* Use AT+QICLOSE=0 to close the connection of TCP/UDP */
[2015-09-14 13:56:22:515_S:] AT+QICLOSE=0
[2015-09-14 13:56:22:527_R:] AT+QICLOSE=0

[2015-09-14 13:56:23:167_R:] OK

/* Use ATE1 to enable echo mode */
[2015-09-14 13:56:24:658_S:] ATE1
[2015-09-14 13:56:24:670_R:] ATE1

[2015-09-14 13:56:24:670_R:] OK

/* Use AT+QIDEACT=1 to deactivate GPRS context */
[2015-09-14 13:56:25:168_S:] AT+QIDEACT=1
[2015-09-14 13:56:25:182_R:] AT+QIDEACT=1

[2015-09-14 13:56:25:982_R:] OK

 

  OpenCPU硬件开发:M26 OpenCPU硬件设计参考手册

   OpenCPU开发软件包:M26_OpenCPU_GS3_SDK_V2.0

   OpenCPU FLASH烧录工具:qFlash v4.8

   OpenCPU用户手册:M26 OpenCPU用户指导手册

   硬件设计:M26封装库

    AT开发参考1:AT_TCPIP开发指导手册

     AT开发参考2:移远AT开发工具及其他指导文档

转载自:http://bbs.21ic.com/icview-2398924-1-1.html

 

AT+CFUN=1,1  //重启模块

AT+QSIMDET=1,1或AT+QSIMDET=1,0开启     可以设置高电平  或者低电平有效//SIM卡热拔插,同一个电路 肯定不可以设置两种sim卡检测状态   要么高电平有效  要么低电平有效

AT+QSIMDET=0  关闭热拔插功能

通过AT命令开启SIM卡检查功能

举例:

AT+QSIMSTAT=1          //开启SIM卡热拔插状态报告

AT+QSIMDET=1,1或AT+QSIMDET=1,0//开启 SIM卡检测功能

当SIM卡拔出或者插上的时候,模块会有相应的提示:

+CPIN:NOT READY

AT+QSIMSTAT=1,1或AT+QSIMSTAT=1,0

Call Ready
————————————————
版权声明:本文为CSDN博主「lemon15071230867」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/lemon15071230867/article/details/80607519

最后

以上就是冷艳金针菇为你收集整理的EC20 TCP/IP指令例程的全部内容,希望文章能够帮你解决EC20 TCP/IP指令例程所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(58)

评论列表共有 0 条评论

立即
投稿
返回
顶部