软件准备:teraterm-4.77.exe
编辑软件TTL:setup_ttleditor_1_5_1.exe
下载链接: https://pan.baidu.com/s/1i5CbIbb 密码: s756
tera term打开界面如下:
如果安装TTL,可以直接在TTL下面编写命令流程,点击Run Macro即可运行。
下面时下发AT命令测试的脚本:
connect "/c=3 /baud=38400"
gettime logstr "log-%Y%m%d-%H%M%S.txt"
setdir 'd:\User\Desktop'
;changedir 'd:\User\Desktop'
getdir curdir
;curdir ='d:\User\Desktop'
sprintf '%s\%s' curdir logstr
filename = inputstr
logopen filename 0 1 1 1
logwrite '************Log start'#13#10
sendln "ATI"
wait "OK"
sendln "AT+CGMR"
wait "OK"
sendln "AT+CGSN"
wait "OK"
sendln "AT+IPR?"
wait "OK"
sendln "AT+CPIN?"
wait "OK"
sendln "AT+CSQ"
wait "OK"
sendln "AT+CREG?;+CGREG?;+COPS?"
wait "OK"
sendln "AT+CGATT?"
wait "OK"
sendln "AT+CGATT=1"
wait "OK"
sendln 'AT^SICS=1,"conType","GPRS0"'
wait "OK" "ERROR"
sendln 'AT^SISS=2,"srvType","Socket"'
wait "OK" "ERROR"
sendln 'AT^SISS=2,"conId",1'
wait "OK" "ERROR"
sendln 'AT^SISS=2,"address","socktcp://59.174.171.231:9001"'
wait "OK" "ERROR"
sendln 'AT^SICS?'
wait "OK"
sendln 'AT^SISS?'
wait "OK"
sendln 'AT^SISO?'
wait "OK"
sendln 'AT^SISC=2'
wait "OK" "EEROR"
sendln 'AT^SISO=2'
wait "^SISW:"
for i 0 9
sendln 'AT^SISW=2,10'
pause 1
sendln '1234567890'
wait "OK"
wait "^SISR:"
sendln 'AT^SISR=2,100'
wait "OK"
n = i + 1
sprintf "*******************The %dth :send and receive is OK!*********" n
str1 = inputstr
logwrite #13#10
logwrite str1
logwrite #13#10
next
logwrite #13#10'************Log end'#13#10
Logclose
sendln 'AT^SISC=2'
wait "OK"
messagebox "complete!" "AT Command"
closett
下面是对应的测试LOG:
************Log start
[Thu Oct 12 11:04:45.590 2017] AT+CGMR
[Thu Oct 12 11:04:45.610 2017] REVISION 01.301
[Thu Oct 1