Modbus Not reading float value correct

Hi,

I am reading modbus RTU , 32 bit float register and noticed some of the values are not read correct.
Alternatively if I use Kepware OPC server it reads absolutely correct and very fast response.
I am using buffer parser node, could it be a problem, please advise.


It is impossible to tell from screenshots.

You would need to capture sample data from the modbus node & post an export of the pid2 buffer-parser & provide a specification for checking the byte offsets. Also helpful would be the values you expect to get out of the parser so I could check them.

My first guess would be either incorrect byte offset, incorrect data type or data corruption.

Do you get correct values if you run only pid2 (disable/un-wire the other flex requests)

I beleieve problem is with Modbus flex node, just tested withour buffer parser. I injected value 1.89. You may see the difference between input and output.

[
    {
        "id": "ff350b8a3b2b9988",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "8a173fc8259d81dc",
        "type": "inject",
        "z": "ff350b8a3b2b9988",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 420,
        "y": 200,
        "wires": [
            [
                "420a149f233d6d40"
            ]
        ]
    },
    {
        "id": "420a149f233d6d40",
        "type": "function",
        "z": "ff350b8a3b2b9988",
        "name": "",
        "func": "msg.payload = { \n    value: msg.payload, \n    'fc': 3, \n    'unitid': 1, \n    'address': 1, \n    'quantity': 2 \n} \n\nreturn msg",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 565,
        "y": 200,
        "wires": [
            [
                "cf6ca03e41631e12"
            ]
        ],
        "l": false
    },
    {
        "id": "cf6ca03e41631e12",
        "type": "modbus-flex-getter",
        "z": "ff350b8a3b2b9988",
        "name": "",
        "showStatusActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "logIOActivities": false,
        "server": "fd2ba637e7543e66",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "delayOnStart": false,
        "startDelayTime": "",
        "x": 710,
        "y": 200,
        "wires": [
            [
                "ad059000c08d8a83"
            ],
            []
        ]
    },
    {
        "id": "ad059000c08d8a83",
        "type": "debug",
        "z": "ff350b8a3b2b9988",
        "name": "value",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 950,
        "y": 200,
        "wires": []
    },
    {
        "id": "fd2ba637e7543e66",
        "type": "modbus-client",
        "name": "",
        "clienttype": "serial",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "127.0.0.1",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "COM5",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": 1,
        "commandDelay": 1,
        "clientTimeout": 1000,
        "reconnectOnTimeout": true,
        "reconnectTimeout": 2000,
        "parallelUnitIdsAllowed": true,
        "showWarnings": true,
        "showLogs": true
    }
]

Please see close up of input injected and output received.

Some modbus devices have zero based addresses, some start at 1. You may need to use addresses 1+ in the simulator. Alternatively, try accessing address zero in the flex getter.

Thanks for your help. How I may set zero address in flex getter.Thanks

Try changing that to 0 in the function.

Alternatively, write data to address 2 and above in the simulator. Also check settings of the simulator - it may have an address offset option.

It did not help.Only start address1 works.
If I use an opc server like Kepware, it works fantastic. Could you suggest any alternative way to read data from Modbus serial devices other than using node-red-contrib-modbus.
Thanks

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.