想采用MODBUS TCP实现DMC-2143与HMI(SERVER)的数据通讯, 下面是个例子:
COUNTER =1
DM A【10】
#LOOP
MG "Connection established to ",ip0{F3.0},ip1,ip2,ip3
MBa=,6,0,COUNTER ;‘SET REGISTER 40001
MBa=,4,0,1,A【】 ;‘READ REGISTER 30001MG "HMI READ= ",A【0】, ", COUNTER = ", COUNTER
WT1000
COUNTER = COUNTER + 1
JP#LOOP,COUNTER<20
提示系统已经连上了,但HMI(SERVER)上没有数据更新或无法设置数据。我采用调试工具PC作为CLIENT调试HMI是没有问题的。
高手帮我分析哪里出问题了?
:TH
CONTROLLER IP ADDRESS 192,168,214,90 ETHERNET ADDRESS 00-50-4C-00-B8-AA
IHA TCP PORT 1030 TO IP ADDRESS 192,168,214,91 PORT 502
IHB UDP PORT 60007 TO IP ADDRESS 192,168,214,9 PORT 1331
IHC TCP PORT 23 TO IP ADDRESS 192,168,214,9 PORT 1330
IHD AVAILABLE
IHE AVAILABLE
IHF AVAILABLE
IHG AVAILABLE
IHH AVAILABLE
IHA=>-2
WT100 ;‘ENSURE HANDLE IS NOT IN USEBGA
IHA = 192,168,214,91<502>2 ;‘HMI HANDLE(HMI IP ADDRESS),
WT100
COUNTER =1
DM A【10】
#LOOP
MBa=1,16,1,1,COUNTER ;‘SET REGISTER 40001 ON HMI 4x0001,
MBa=1,4,0,1,A【】 ;‘READ REGISTER 30001 ON HMI 3x10000,
MG "HMI READ= ",A【0】, ", COUNTER = ", COUNTER
WT1000 ;‘WAIT 1S
COUNTER = COUNTER + 1
JP#LOOP,COUNTER<200 ;‘REPEAT 200 TIMES