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.

Modbus TCP
#1
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,
Reply
#2
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.
------------------------------
Ctrl+F5
Reply
#3
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.
Reply
#4
(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? (:
Reply
#5
I'll scrap my script and look at profiles then, thanks.
Reply


Forum Jump: