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 register type
#12
(16.03.2020, 11:16)admin Wrote: You still haven't provided full profile that you are using for reading registers. You can also test using second RS-485 port if there's a hardware issue of some sort.
Another thing to try is to read register data via script. You need to disable modbus mapper before running this script. Post what you get in Logs tab. Change baud rate (19200) if needed.

Code:
require('luamodbus')
mb = luamodbus.rtu()

mb:open('/dev/RS485-1', 19200, 'E', 8, 1, 'H')
mb:connect()

buffer = {}

mb:setdebug(function(msg)
  buffer[ #buffer + 1 ] = msg
end)

mb:setslave(1)

res = { mb:readinputregisters(0, 16) }
log(res)

mb:close()

log(table.concat(buffer))

Code:
initscript 16.03.2020 19:22:02
* table:
[1]
  * number: 22810
[2]
  * number: 22845
[3]
  * number: 22748
[4]
  * number: 22828
[5]
  * number: 22854
[6]
  * number: 22819
[7]
  * number: 22872
[8]
  * number: 0
[9]
  * number: 0
[10]
  * number: 0
[11]
  * number: 0
[12]
  * number: 0
[13]
  * number: 0
[14]
  * number: 0
[15]
  * number: 0
[16]
  * number: 0

Code:
initscript 16.03.2020 19:22:02
* string: [01][04][00][00][00][10][F1][C6]
Waiting for a confirmation...
<01><04><20><59><1A><59><3D><58><DC><59><2C><59><46><59><23><59><58><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><85><1D>
the profile is this
Code:
{
  "manufacturer": "Indomogal",
  "description": "Universal 16+4 I/O module",
  "mapping": [
    {
      "name": "Output 1",
      "bus_datatype": "1",
      "type": "coil",
      "address": 0,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 2",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 1,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 3",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 2,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 4",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 3,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 5",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 4,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 6",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 5,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 7",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 6,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 8",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 7,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 9",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 8,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 10",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 9,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 11",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 10,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 12",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 11,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 13",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 12,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 14",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 13,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 15",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 14,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}
    },
    {
      "name": "Output 16",
      "bus_datatype": "bool",
      "type": "coil",
      "address": 15,
      "writable": 1,
      "value_custom": {"0": "Off", "1": "On"}

    }
  ]
}
Reply


Messages In This Thread
Modbus register type - by sx3 - 18.03.2019, 17:01
RE: Modbus register type - by admin - 18.03.2019, 17:05
RE: Modbus register type - by sx3 - 18.03.2019, 17:17
RE: Modbus register type - by admin - 18.03.2019, 17:34
RE: Modbus register type - by davidchispas - 12.03.2020, 17:51
RE: Modbus register type - by admin - 12.03.2020, 19:35
RE: Modbus register type - by davidchispas - 13.03.2020, 07:55
RE: Modbus register type - by admin - 13.03.2020, 07:58
RE: Modbus register type - by davidchispas - 13.03.2020, 08:09
RE: Modbus register type - by davidchispas - 16.03.2020, 09:51
RE: Modbus register type - by admin - 16.03.2020, 11:16
RE: Modbus register type - by davidchispas - 16.03.2020, 18:24
RE: Modbus register type - by admin - 16.03.2020, 18:35
RE: Modbus register type - by davidchispas - 16.03.2020, 18:43
RE: Modbus register type - by admin - 17.03.2020, 06:36
RE: Modbus register type - by davidchispas - 04.06.2020, 11:03
RE: Modbus register type - by admin - 04.06.2020, 11:16
RE: Modbus register type - by davidchispas - 04.06.2020, 16:19

Forum Jump: