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.

w4k fails reading modbus rtu float32
#3
Using a profile was my first try, but it didn't work. So I tried so solve it with this script. 

Code:
{
  "manufacturer": "Eastron",
  "description": "3-phasiger Energiezähler SDM72D-M",
  "mapping": [
    {
      "name": "Frequency",
      "address": 70,
      "type": "inputregister",
      "bus_datatype": "float32",
      "unit": "Hz"
    }
  ]
}

With this profile I get the value 16967.000. Which is wrong, it should be around 50. 

readinputregistervalue() - seems to be the problem. 
Code:
require('luamodbus')
mb = luamodbus.rtu()

mb:open('/dev/RS485', 9600, 'N', 8, 1, 'H')
mb:setslave(20)
mb:connect()



local r1 = mb:readregistervalue(70,"float16")
local r2 = mb:readregistervalue(71,"float16")


local value = mb:readregistervalue(70, "float32")
log(r1, r2, value)


mb:close()

log:
Code:
* arg: 1
  * number: 0
* arg: 2
  * number: 0
* arg: 3
  * number: 0
Reply


Messages In This Thread
w4k fails reading modbus rtu float32 - by cgn - 15.04.2026, 12:20
RE: w4k fails reading modbus rtu float32 - by cgn - 16.04.2026, 07:14

Forum Jump: