Writing a 32bit Float (le) Modbus

Hi, I want to write one (or more) float (le) registers:

for uint32(be) I know how to do (Steve told me):
grafik
first buffer maker with uint32(be) => buffer parser with uint16(be) length: 2 => write FC16

but for float(le) there is no 32/16bit present.

Floats in JS are 32bit (AKA 2 words AKA 4 bytes)

ok, is there any possibility to recreate 2x 16bit to write registers ?

example from input:
grafik

[
    {
        "id": "9be00b9bab774a27",
        "type": "inject",
        "z": "9fc0f809.f00518",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "4893.3720703125",
        "payloadType": "num",
        "x": 1010,
        "y": 1060,
        "wires": [
            [
                "2944dd90b4f49503"
            ]
        ]
    },
    {
        "id": "2944dd90b4f49503",
        "type": "buffer-maker",
        "z": "9fc0f809.f00518",
        "name": "",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "name": "item1",
                "type": "floatle",
                "length": 1,
                "dataType": "msg",
                "data": "payload"
            }
        ],
        "swap1": "swap16",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "x": 1210,
        "y": 1060,
        "wires": [
            [
                "0a0122983e4af6fb",
                "f1351bc61addfa16"
            ]
        ]
    }
]

edit: i think I got it:

[
    {
        "id": "9be00b9bab774a27",
        "type": "inject",
        "z": "9fc0f809.f00518",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "4893.3720703125",
        "payloadType": "num",
        "x": 1010,
        "y": 1060,
        "wires": [
            [
                "2944dd90b4f49503"
            ]
        ]
    },
    {
        "id": "2944dd90b4f49503",
        "type": "buffer-maker",
        "z": "9fc0f809.f00518",
        "name": "",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "name": "item1",
                "type": "floatle",
                "length": 1,
                "dataType": "msg",
                "data": "payload"
            }
        ],
        "swap1": "swap16",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "x": 1190,
        "y": 1060,
        "wires": [
            [
                "0a0122983e4af6fb",
                "f1351bc61addfa16"
            ]
        ]
    },
    {
        "id": "0a0122983e4af6fb",
        "type": "buffer-parser",
        "z": "9fc0f809.f00518",
        "name": "",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "uint16be",
                "name": "item1",
                "offset": 0,
                "length": 2,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "value",
        "resultTypeType": "return",
        "multipleResult": true,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 1370,
        "y": 1060,
        "wires": [
            [
                "f1351bc61addfa16"
            ]
        ]
    }
]

Sure...

image

[{"id":"9be00b9bab774a27","type":"inject","z":"76a6f1dc1056998c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4893.3720703125","payloadType":"num","x":1990,"y":816,"wires":[["2944dd90b4f49503"]]},{"id":"2944dd90b4f49503","type":"buffer-maker","z":"76a6f1dc1056998c","name":"","specification":"spec","specificationType":"ui","items":[{"name":"item1","type":"floatle","length":1,"dataType":"msg","data":"payload"}],"swap1":"swap16","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","x":2190,"y":816,"wires":[["4e3d8ece4e3594bf"]]},{"id":"ea646b374b59410b","type":"debug","z":"76a6f1dc1056998c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":2194,"y":880,"wires":[]},{"id":"4e3d8ece4e3594bf","type":"buffer-parser","z":"76a6f1dc1056998c","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint16be","name":"floatAsUINT16","offset":0,"length":2,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":2006,"y":880,"wires":[["ea646b374b59410b"]]}]
1 Like

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