Logic Machine Forum
Modbus TCP - 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 (/showthread.php?tid=2760)



Modbus TCP - Seijboldt - 30.07.2020

Hi,
I'm trying to read and write some values to a modbus device via script.
The device comes with some documentation, example:
3x0001 alarm status 1-30
1x0005 fault status 1/0
4x0045 outside temperature -50-50c

I've searched these forums and figured out how to read from the modbus TCP, however the function readregisters() doesn't really support running these types of addresses.

Is there any documentation if partial about modbus implementation?
Readregisters(address, modbus function) would make sense but it doesn't really seem to work that way.
I assume writing is writeregisters()?

(On a spacelynk btw)

Thanks,


RE: Modbus TCP - Daniel - 31.07.2020

In spaceLYnk manuals it is quite well described. It is recommended to use profiles as then modbus connection is properly handled and you can add most of the needed conversions.


RE: Modbus TCP - admin - 31.07.2020

The first number before the address is function number: 1= coil, 3 = holding register, 4 = input register. The actual address might be in hex but you will have to check. You probably will have to subtract 1 from the address. Try reading register 0 or 1, it should contain the alarm status. But as Daniel said once you get addressing right using profile is more convenient.


RE: Modbus TCP - Erwin van der Zwart - 31.07.2020

(31.07.2020, 07:30)Daniel. Wrote: In spaceLYnk manuals it is quite well described.  It is recommended to use profiles as then modbus connection is properly handled and you can add most of the needed conversions.

Are you giving yourself kudoos Daniel? (:


RE: Modbus TCP - Seijboldt - 31.07.2020

I'll scrap my script and look at profiles then, thanks.