本帖最后由 leyinlewis 于 2018-3-24 15:33 编辑
EC20 TCPIP指令例程
/* 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
/* 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
/* 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
|