Logic Machine Forum
Modbus slave disable - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Modbus slave disable (/showthread.php?tid=5542)



Modbus slave disable - jmir - 31.07.2024

Hi,
Is there any way to disable a modbus slave (when using profiles) from a script?
Thanks.


RE: Modbus slave disable - Daniel - 31.07.2024

Why would you like to do it?


RE: Modbus slave disable - jmir - 31.07.2024

(31.07.2024, 07:18)Daniel Wrote: Why would you like to do it?

Because this slave has a slow response time (1 register per second), and it seems that it slows all the polling cycle (we have 5 slaves in this line). 
When this slowest device is read, we have some write timeouts on other slaves... (don't know why...)
So, we want to disable it when we need to write, and enable again when done...

(The second RS485 is used for other devices and it's not posssible to change this device to this one...)


RE: Modbus slave disable - admin - 01.08.2024

You can use scripts instead of a profile to read this device. This way you can have a delay between reads without blocking other operations. Use mbproxy library: https://forum.logicmachine.net/showthread.php?tid=839&pid=22637#pid22637


RE: Modbus slave disable - jmir - 01.08.2024

(01.08.2024, 06:41)admin Wrote: You can use scripts instead of a profile to read this device. This way you can have a delay between reads without blocking other operations. Use mbproxy library: https://forum.logicmachine.net/showthread.php?tid=839&pid=22637#pid22637

And how mbproxy is assigned to RTU port 1 or 2? I've seen how to set the slave but not from which port...


RE: Modbus slave disable - admin - 01.08.2024

Use this:
Code:
require('mbproxy')
portnr = 1 -- either 1, 2 or 3
mb = mbproxy.new(portnr)



RE: Modbus slave disable - jmir - 01.08.2024

(01.08.2024, 09:15)admin Wrote: Use this:
Code:
require('mbproxy')
portnr = 1 -- either 1, 2 or 3
mb = mbproxy.new(portnr)

Ok thanks!