tera term 的一个命令解析脚本

;用虚拟串口虚拟2个串口,tera term使用串口2

;设置串口2 波特率 115200,超时500ms;如果收到串口发来OK则回复SUCCESS;如果收到ERROR则回复faile
;若超时则发送timeouts.
connect " /c=2 /BAUD=115200"
 timeout = 0
mtimeout = 500
while 1
        wait 'OK' 'ERROR'
        ; If timeout occurs, 发送 ":timeout".
        if result=0  then
           sendln "timeouts"
        ; has received, 发送 ":error".
        elseif result=1 then
           sendln "success"
        ; "ERROR" has received, 发送 ":faile".
        elseif result=2 then
           sendln "faile"
        
        endif
    endwhile

posted on 2017-12-08 18:05  杰瑞鼠  阅读(4932)  评论(0编辑  收藏  举报