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.

TCP Modbus
#1
Information 
Hello,

I'm trying to make a connection with Modbus TCP slave device.

I tried to do so with scripts (you can see it below) and visual mapper.
In visual mapper I tried many different combinations in device profile, but couldn't get right value:

Code:
{ "name": "Input 1", "bus_datatype": "float16", "type": "register", "address": 128, "datatype": "float16", "value_multiplier": 1, "units": " C" },
{ "name": "Input 1", "bus_datatype": "uint16", "type": "register", "address": 128, "datatype": "float16", "value_multiplier": 1, "units": " C" },
{ "name": "Input 1", "bus_datatype": "int16", "type": "register", "address": 128, "datatype": "int16", "value_multiplier": 1, "units": " C" }
and etc..

Full script (IP address of device is corrent - 192.168.1.210, port - 502, slave ID - 20):
Code:
require('luamodbus')

if not mb then
    mb = luamodbus.tcp()
    mb:open('192.168.1.210')
    mb:connect()
end

-- verbose output and select slave number 10
mb:setdebug(true)
mb:setslave(20)

-- read input from reg 1 to 5, get slave-specific data
local result = mb:readregistervalue(128, dt.float16)
grp.write('14/1/0', result, dt.float16)


local value = mb:reportslaveid()
alert(value)

-- close serial connection
mb:close()
Reply


Messages In This Thread
TCP Modbus - by leondias - 21.03.2017, 14:08
RE: TCP Modbus - by admin - 21.03.2017, 14:34
RE: TCP Modbus - by leondias - 21.03.2017, 14:39
RE: TCP Modbus - by unaxboy - 29.11.2017, 12:44
RE: TCP Modbus - by admin - 21.03.2017, 14:42
RE: TCP Modbus - by leondias - 21.03.2017, 14:47
RE: TCP Modbus - by admin - 21.03.2017, 15:59
RE: TCP Modbus - by leondias - 22.03.2017, 07:38
RE: TCP Modbus - by unaxboy - 13.11.2017, 04:18
RE: TCP Modbus - by admin - 29.11.2017, 13:09
RE: TCP Modbus - by unaxboy - 29.11.2017, 13:32
RE: TCP Modbus - by admin - 29.11.2017, 13:35
RE: TCP Modbus - by unaxboy - 29.11.2017, 13:55
RE: TCP Modbus - by admin - 29.11.2017, 15:54
RE: TCP Modbus - by unaxboy - 29.11.2017, 16:47
RE: TCP Modbus - by admin - 29.11.2017, 17:15
RE: TCP Modbus - by unaxboy - 29.11.2017, 18:22
RE: TCP Modbus - by Igor68 - 17.12.2017, 10:22
RE: TCP Modbus - by admin - 18.12.2017, 08:09
RE: TCP Modbus - by SportMaster10 - 12.09.2019, 11:20
RE: TCP Modbus - by AlexLV - 02.07.2020, 08:10
RE: TCP Modbus - by Daniel - 02.07.2020, 08:28
RE: TCP Modbus - by AlexLV - 03.07.2020, 06:56
RE: TCP Modbus - by AlexLV - 03.07.2020, 19:30

Forum Jump: