I'm using DOPSoft to create HMI Application Modbus Master RTU. When I'm using API link.read("{Modbus}5@RW-1") it work fines. But I want to my parameters is flexible for reading multiple slave device with other address, so I used:
local addrLinkMem = string.format("{Modbus}%d@RW-%d", 3, 100);
link.Read(addrLinkMem)
DOPSoft notifies error Program name: Main(10): "addrLinkMem" Element address input error
string.format() is return a string, so addrLinkMem is a string. What I have fault ? How can I use link.read() without address fixed parameter ?
Thanks very much everyone !!
-- Add initial code here (run once)
while true do
-- Add loop code here (cyclic run)
timeStamp = startTick
readVal1 = link.Read("{Modbus}5@RW-0") --It's work fine
local addrLinkMem = string.format("{Modbus}%d@RW-%d", 3, 100);
readVal2 = link.Read(addrLinkMem) --Program name: Main(10): "addrLinkMem" Element address input error
-- one cycle is 250ms
sys.Sleep(250)
end
``