dle Posted October 19, 2015 Share Posted October 19, 2015 Hi all, Is there a way to temporarily set a break to all MODBUS channels. I'm still developing the GUI application and not connecting to a MODBUS device. The alert showing the modbus timeout is so annoying. Thanks. Link to comment Share on other sites More sharing options...
AzeoTech Posted October 20, 2015 Share Posted October 20, 2015 Not super easily. One option is to simply go into safe mode. Another is to write a script to set the timing of all your channels to 0. The best way to do this is to put all the channels with a particular timing into a single channel group, then you can do something like: private string chanList = channel.listAll("modbusReadGroup") for (private i = 0, i < numrows(chanList), i++) execute(chanlist[i] + ".timing = 0") endfor channel.restart() Make another sequence that is pretty much identical but sets the timing to some other value, or just create a sequence function that takes the timing: function changeTiming(string groupName, newTIming) private string chanList = channel.listAll(groupName) for (private i = 0, i < numrows(chanList), i++) execute(chanlist[i] + ".timing = " + newTiming) endfor channel.restart() Hardcode groupName like I did in the first example if you don't need it as a parameter. Link to comment Share on other sites More sharing options...
dle Posted November 16, 2015 Author Share Posted November 16, 2015 Can DF restart a certain channels only ? I tried channel.restart(chanlist) or channel.restart(groupname) but the restart command will initialize all of the channels Link to comment Share on other sites More sharing options...
AzeoTech Posted November 16, 2015 Share Posted November 16, 2015 No, restart() recalculates all the timing threads across all the channels. What are you trying to achieve? Link to comment Share on other sites More sharing options...
dle Posted November 16, 2015 Author Share Posted November 16, 2015 I want to disable the modbus channels if the PC id disconnected from a Modbus device. If the function OnAlert() is call, it will check the StrAlert[0]. If the StrAlert[0] = "P-ModbusTCP0010:Timeout", it will temporarily set all the Modbus channels to timing = 0. to stop those Modbus channel from keep trying to polling data. However, all other channels I would like to keep its current value. Link to comment Share on other sites More sharing options...
AzeoTech Posted November 16, 2015 Share Posted November 16, 2015 Your best bet is to not using Timing at all and instead put each device in its own channel Group, then use channel.readGroup() in a sequence to read each device. Then you can easily add logic to read or not read a device. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.