Modbus values wrong - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10) +--- Thread: Modbus values wrong (/showthread.php?tid=2430) |
Modbus values wrong - arnocl - 19.01.2020 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 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 } 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. 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. RE: Modbus values wrong - admin - 20.01.2020 Set "read_swap" to "n" RE: Modbus values wrong - arnocl - 20.01.2020 (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. RE: Modbus values wrong - admin - 20.01.2020 Do you have any errors in Modbus error logs? RE: Modbus values wrong - arnocl - 20.01.2020 No, all seems to come through fine, except these little quirks. Direct readout with modbus poll works without issues. RE: Modbus values wrong - admin - 20.01.2020 Try reading raw values via a script, change IP/port as needed: Code: require('luamodbus') RE: Modbus values wrong - arnocl - 20.01.2020 Thanks for your help. Enabling the script gives me no valuable data: Quote:Dantherm Ventilation 20.01.2020 17:19:31 When I enter another register address I do get the data as expected. RE: Modbus values wrong - admin - 20.01.2020 Try reading register 196 instead of 197 RE: Modbus values wrong - arnocl - 22.01.2020 This gives 255, not the correct value RE: Modbus values wrong - admin - 23.01.2020 You might need to uncomment setslave() call and set correct slave id like this: Code: mb:setslave(1) RE: Modbus values wrong - TomasIha - 24.05.2022 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? RE: Modbus values wrong - admin - 25.05.2022 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') RE: Modbus values wrong - TomasIha - 25.05.2022 (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'). Thanks for your answer |