谁能给我写一个台达人机与台达PLC MODBUS RTU格式自由通讯的宏 我想学学这个通讯宏怎么用 谢谢
下面是我自己写的 请指正错在哪里 只能输出字 收不到PLC的响应
INITIAL宏
$0 = INITCOM(1, 2, 1, 0, 1, 6, 0)
$2 = 1H
$3 = 06H
$4 = 1000H
$5 = 1234H
End
CLOCK宏
if $0.0==off then goto label 10
if $0.0==on then goto label 1
goto label 10
label 1
selectcom(1)
$10 = B2W($2,2)
$100 = $10
$12 = B2W($3,2)
$101 = $12
$102 = $4
$103 = $5
$104 = 807dH
delay(1000)
$200 = PUTCHARS($100, 10, 200)
delay(1000)
$200=0
clearcombuffer(1,1)
$201 = GETCHARS($300, 8, 500)
delay(1000)
$201=0
clearcombuffer(1,0)
$202=$202+1
label 10