This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Script execution priority
#1
Hi everybody!  Big Grin

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 Tongue

Mirco
Reply


Messages In This Thread
Script execution priority - by Mirco - 13.09.2016, 07:09
RE: Script execution priority - by admin - 13.09.2016, 07:17
RE: Script execution priority - by Mirco - 13.09.2016, 07:38
RE: Script execution priority - by admin - 14.09.2016, 08:40
RE: Script execution priority - by Mirco - 16.09.2016, 05:58
RE: Script execution priority - by admin - 16.09.2016, 06:45
RE: Script execution priority - by Mirco - 02.12.2016, 14:53
RE: Script execution priority - by admin - 02.12.2016, 16:38

Forum Jump: