# RS485/ Modbus 2x 16Bit Buffer conversion to signed 24Bit Datatype from Finder-Meter 7M38

**URL:** https://discourse.nodered.org/t/rs485-modbus-2x-16bit-buffer-conversion-to-signed-24bit-datatype-from-finder-meter-7m38/82443
**Category:** General
**Created:** [29 October 2023 12:34 UTC](https://discourse.nodered.org/t/rs485-modbus-2x-16bit-buffer-conversion-to-signed-24bit-datatype-from-finder-meter-7m38/82443 "2023-10-29T12:34:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![chris123](https://avatars.discourse-cdn.com/v4/letter/c/5fc32e/32.png) [@chris123](https://discourse.nodered.org/u/chris123)
#### Post date: [29 October 2023 12:34 UTC](https://discourse.nodered.org/t/rs485-modbus-2x-16bit-buffer-conversion-to-signed-24bit-datatype-from-finder-meter-7m38/82443/1 "2023-10-29T12:34:59Z")

</div>

Hi all,  
I got help here already with a similar problem but now i got stuck again.

I'm reading values from a finder energymeter with modbus into node-red. That's ok.

But now I'm not able to convert the two incomming 16bit register into one signed 24bit value. There is a description out of the manual which says the incomming data need to be transvered into a signed 24bit number. Until now I converted the incomming modbus-data with an buffer-parser. This worked perfekt for unsigned 24bit, because we could use the 32bit one. (Many thanks to Steve-Mcl!)

This ist the description of the manual:

 ![t6](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/d/7da3a1dd134cf2b095568790b64307ca927d124a.jpeg)

The example of the manual works with 0xFE1DC0. Divided into two 16bit Words ist (FE1D, 00C0). This into decimal is (65053, 192). Thats what I'm injecting into my example:

```auto
[{"id":"0a6cee1938af483e","type":"tab","label":"Flow 10","disabled":false,"info":"","env":[]},{"id":"545bde1568fd7ba7","type":"inject","z":"0a6cee1938af483e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[65053, 192]","payloadType":"json","x":150,"y":400,"wires":[["c716d07040b3e1b6"]]},{"id":"c716d07040b3e1b6","type":"buffer-parser","z":"0a6cee1938af483e","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32be","name":"item1","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":"0x0ffffff"},{"type":"int8","name":"item2","offset":0,"length":1,"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":370,"y":400,"wires":[["e2f9f5f802c0358c"]]},{"id":"e2f9f5f802c0358c","type":"debug","z":"0a6cee1938af483e","name":"debug 321","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":400,"wires":[]}]

Thank you!

BR
Chris

```

---

<div class="post-metadata">

### Author: ![chris123](https://avatars.discourse-cdn.com/v4/letter/c/5fc32e/32.png) [@chris123](https://discourse.nodered.org/u/chris123)
#### Post date: [31 October 2023 09:54 UTC](https://discourse.nodered.org/t/rs485-modbus-2x-16bit-buffer-conversion-to-signed-24bit-datatype-from-finder-meter-7m38/82443/2 "2023-10-31T09:54:47Z")

</div>

Hi,  
I got a workarround for the problem.

In the buffer-parser i'm passing the relevant 4 Bytes with a "Buffer" size 4. Next there comes a function-node. Within this I call these two functions. One for the 24Bit Value and one for the Finder specific exponent:

```auto
function extractT6Value(buffer) {
    if (buffer.length !== 4) {
        throw new Error('Der Buffer muss genau 4 Bytes lang sein');
    }
    const value = buffer.readIntBE(1, 3); // Liest 3 Bytes als signed Big-Endian Integer
    return value;
}
function extractT6Exponent(buffer) {
    if (buffer.length !== 4) {
        throw new Error('Der Buffer muss genau 4 Bytes lang sein');
    }
    const exponent = buffer.readInt8(0); // Liest das 8-Bit Dezimal-Exponenten-Feld
    return exponent;
}

```

BR  
Chris

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [30 December 2023 09:54 UTC](https://discourse.nodered.org/t/rs485-modbus-2x-16bit-buffer-conversion-to-signed-24bit-datatype-from-finder-meter-7m38/82443/3 "2023-12-30T09:54:54Z")

</div>

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