Modbus tcp scripting help - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Modbus tcp scripting help (/showthread.php?tid=4437) |
Modbus tcp scripting help - christian.hegland@caverion.com - 11.12.2022 Hi, I'm having a hard time understanding how to make a simple script, for controlling a modbus device (off, Auto) I've made a trigger sensor which I've tagged, and used in event based scripting. But it seems like its working almost as expexted, nut sometimes the registers not get fullt set. Maybe theres some comm.issues which causes some timeouts or drops. Is there anyway to make a for-loop to run the script for X runs, until the register feedback is what i sent as command? Would also be great to use only one script for multiple mbslave ID's. So a loop here also starting from slave 1 til 3 for instance. Now I'm currently running this script duplicated for 3 devices on the same Modbus TCP gateway, modified only the mbslave ID. This is the script: Code: require('luamodbus') RE: Modbus tcp scripting help - admin - 12.12.2022 This will try writing 3 times to 3 slave IDs (1, 2, 3). Any possible errors can be found in Logs. Code: require('luamodbus') RE: Modbus tcp scripting help - christian.hegland@caverion.com - 13.12.2022 Thank you very much! |