Hello Guest it is March 28, 2024, 10:35:06 AM

Author Topic: How to use MODBUS RTU in MACRO  (Read 585 times)

0 Members and 1 Guest are viewing this topic.

Offline doy

*
  •  2 2
    • View Profile
How to use MODBUS RTU in MACRO
« on: March 17, 2020, 04:58:28 AM »
Hello!
How to use MODBUS RTU in MACRO

The source is:

'------------------------------------------------------
rem M403 modebus test

Dim a1,a2,a3

'a1 = FillFromInput(1,1020, 2)
a1 = FillFromHolding(1,1020,8)

a2 = GetModWord(0)
a3 = GetInput(0)

Message "M403 Test End! = " &  GetUserDRO(1000) & " , " & a1  & " , " & a2  & " , " & a3   
'------------------------------------------------------------

result
[ M403 Test End! = 1691574, -1 , -1 , 0 ]

The '1691574' value obtained from GetUserDRO (1000) is the result of normal communication in the brain.

Manual instructions should be 1. However, -1 is output.

a1 = FillFromHolding(1,1020,8)

I would appreciate it if you let me know what needs to be fixed in the above line.