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 values wrong
#1
I'm trying to connect my ventilation unit (Dantherm) to the Wiser for KNX from Scheider using Modbus TCP/IP. Most parameters are updating correctly, but for some there is no value coming through, or when entering a new value a completely different value is set at the device-end.

These are the modbus guidelines from the manual:

Quote:3.2 Modbus commands
The Ventilation unit supports the following commands of Modbus protocol:
– Read holding registers (0x03);
– Write multiple Holding registers (0x10).
3.3 Date storing format
3.3.1 32 bit parameters
All parameters of the ventilation unit have a 32 bits dimension. However the Modbus works with regist ers which have 16 bits dimension. Each parameter in the ventilation unit is therefore separated in two parts (Low and High). Modbus model stores it like two registers (R0 and R1 according), which are located together in sequence. A register with Low part o f parameters has the lower address.
3.3.2 Date/Time format
All date/time parameters contain value in Unix time (amount of seconds from 1.1.1970).
3.3.3 Float
A floating point value is 32 bits, but Modbus uses 16 bit registers therefore this 32 bit value is mapped to two register. The sequence used is CDAB.

This is the line in my profile to read the humidity in the room air:
Code:
{ "name": "RH sensor value", "bus_datatype": "5", "type": "register", "datatype": "uint32", "address": 197, "read_count": 2, "read_swap": "w", "writable": 0 }

[Image: IjuyRgi.png]
In Wiser there is a value of 0 shown, although when reading this value directly using Modbus Poll the correct value is shown (45%), but only when formatting using the Little-endian byte swap.

[Image: oRpyv1R.png]

[Image: qnyKAPq.png]

When the Filter Lifetime is set, eg. 360 days, there is 23592960 registered on the device. I can only correct this again using Modbus Poll, using this desktop application everything is working as expected.
Code:
{ "name": "Filter Lifetime", "bus_datatype": "7", "type": "register", "datatype": "uint32", "address": 557, "read_count": 2, "read_swap": "w", "writable": 1, "write_multiple": true }

Some of the other writable parameters show the same glitch.

I can't figure out how to define these parameters in my profile, most other parameters seem to work fine. Also seems strange everything is working fine when using Modbus Poll.

Attached Files
.json   Dantherm_HCV700.json (Size: 4.59 KB / Downloads: 10)
Reply
#2
Set "read_swap" to "n"
Reply
#3
(20.01.2020, 08:12)admin Wrote: Set "read_swap" to "n"

That doesn't work, the manual states CDAB, following the guide found here, this seems to be word swap. All values are out of range when no swap is selected.
Reply
#4
Do you have any errors in Modbus error logs?
Reply
#5
No, all seems to come through fine, except these little quirks. Direct readout with modbus poll works without issues.
Reply
#6
Try reading raw values via a script, change IP/port as needed:
Code:
require('luamodbus')

mb = luamodbus.tcp()
mb:open('192.168.1.100', 502)
res, err = mb:connect()

if res then
  -- mb:setslave()
  r1, r2 = mb:readregisters(197, 2)
  log(r1, r2)
else
  log('connect failed', err)
end

mb:close()
Reply
#7
Thanks for your help. Enabling the script gives me no valuable data:


Quote:Dantherm Ventilation 20.01.2020 17:19:31
* arg: 1
  * number: 0
* arg: 2
  * number: 0


When I enter another register address I do get the data as expected.
Reply
#8
Try reading register 196 instead of 197
Reply
#9
This gives 255, not the correct value
Reply
#10
You might need to uncomment setslave() call and set correct slave id like this:
Code:
mb:setslave(1)
You can also run Wireshark on your PC together with Modbus Poll to see raw communication. This might help to find out correct settings.
Reply
#11
Hello, can you help me. I have a Condair RM humidity and I want to change humidity setpoint value. Modbus address 4888 32-bit float big_endian
Example: I send 47% setpoint. I send command mb:writeregisters(4887, 47, 'B') nothing changes, but if mb:writeregisters(4887, 16956, 'B') setpoint changes to 47%.

But if I want to send 48% I don't know what value to send. How I can convert values?
Reply
#12
Use writeregistervalue, writeregisters can only write 16-bit register values. In case you need to set a different swap mode, pass it as the 4th argument to writeregistervalue and in lowercase ('n', 'b', 'w' or 'wb').
Code:
res, err = mb:writeregistervalue(4887, value, 'float32')
log(res, err)
Reply
#13
(25.05.2022, 06:36)admin Wrote: Use writeregistervalue, writeregisters can only write 16-bit register values. In case you need to set a different swap mode, pass it as the 4th argument to writeregistervalue and in lowercase ('n', 'b', 'w' or 'wb').
Code:
res, err = mb:writeregistervalue(4887, value, 'float32')
log(res, err)

Thanks for your answer Smile
Reply


Forum Jump: