13.09.2016, 07:09
Hi everybody!
I have a big problem, with the execution of my project and I hope you will have some advise.
I have to read/write datas from/to 4 different PLCs in the same Modbus RTU network. There are 14 different script (6 resident, 6 event and 2 scheduler) that exchange data via modbus RTU.
To avoid that one or more script start before the finish of the script that is in execution, I use this code:
Sometimes it happened that 2 or more script started at the same time and they were both executed. This couse timeout and wrong slave errors because scripts set the communication with different slaves.
I hope you will understand my problem, I'm not very good in english
Mirco
I have a big problem, with the execution of my project and I hope you will have some advise.
I have to read/write datas from/to 4 different PLCs in the same Modbus RTU network. There are 14 different script (6 resident, 6 event and 2 scheduler) that exchange data via modbus RTU.
To avoid that one or more script start before the finish of the script that is in execution, I use this code:
Code:
repeat
tmp = storage.get("Modbus")
if (tmp == nil or tmp == 0) then
storage.set("Modbus", 1)
continue = true
alert("--SCRIPT--Dati CT -> START") --This line is used for debuggig purpose
else
continue = false
os.sleep(0.2)
end
until (continue)
--My script code that start communication with one modbus slave PLC
Sometimes it happened that 2 or more script started at the same time and they were both executed. This couse timeout and wrong slave errors because scripts set the communication with different slaves.
I hope you will understand my problem, I'm not very good in english
Mirco