I would like to read and write coils and registers through the READ_VAR and WRITE_VAR function (or other programmable method). I wrote my program in ST. However, the output in connection management variable returns code 5 on second element at every attempt to read or write something.
What am I doing wrong? Example invocations:
Code: Select all
READ_VAR(ADDR('{1.158}0.0.254.1'), '%M', 16#1800, 1, %MW50:2, %MW108:4);
WRITE_VAR(ADDR('{1.158}0.0.0.20'), '%MW', 16#1000, 1, %MW109:4, %MW51:2);
The 1.158 XWAY address is a station defined in Ethernet_1 module in the Messaging module as MULTI with IP address of existing ModbusTCP device present in the network.
When I am using scanning feature, it works well, but can read only registers using function code 23. I need other function codes working as well.
Any help/advice appreciated.