# RS485/ Modbus 16Bit Buffer conversion to different Datatypes from Finder-Meter 7M38

**URL:** <https://discourse.nodered.org/t/rs485-modbus-16bit-buffer-conversion-to-different-datatypes-from-finder-meter-7m38/80400>\
**Category:** General\
**Created:** [8 August 2023 07:29 UTC](https://discourse.nodered.org/t/rs485-modbus-16bit-buffer-conversion-to-different-datatypes-from-finder-meter-7m38/80400 "2023-08-08T07:29:51Z")\
**Posts on this page:** 4\
**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:** [8 August 2023 07:29 UTC](https://discourse.nodered.org/t/rs485-modbus-16bit-buffer-conversion-to-different-datatypes-from-finder-meter-7m38/80400/1 "2023-08-08T07:29:51Z")

</div>

Hi all,  
I'm new to node red. I want to automate my pv charging system with node red. I'm still at the very beginning but able to read out the registers from the Finder 7M38. But I'm in trouble now by converting the received 16Bit Buffers into the corresponding datatypes.

First, the normal 16Bit Datatypes with only 2Bytes are correctly displayed. Thats fine and I assume the correct reading of the Meter.

Now I tryed Register 30105-30106, it contains the Frequency in Hz, so I assume a value of about 50,000.

Modbus Response shows me data[65024, 5010] and buffer: fe 00 13 92.

The datasheet tels me its unsigned measurement 32Bit and  
bits 31...24 are decade exponent signed 8bit and  
bits 23...0 are binary unsigned value 24bit

 ![finder_datatypes](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/1/f10f04b52ca0e0deebe9b45db020290d23162c24.jpeg)

I read that modbus sends MSB first, so we get here:

Exponent Value  
11111110 000000000001001110010010  
(1) minus?  
1111110

DEC: 126 DEC: 5010

I think the value of 5010 could be correct, but how should DEC126 give me the decade exponent? I can't see it...

I also tryed to use the buffer parser, but this also did not give me the result i assumed:

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

Thank you very much for your help!

BR  
Chris

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 August 2023 11:18 UTC](https://discourse.nodered.org/t/rs485-modbus-16bit-buffer-conversion-to-different-datatypes-from-finder-meter-7m38/80400/2 "2023-08-08T11:18:09Z")

</div>

The issue is the way the manufacturer has packed the data is NOT IEE 754 compliant float. Therefore you need to grab the parts and calculate the T5 value yourself.

e.g:

```auto
msg.payload.T5 = msg.payload.uint24 * Math.pow(10, msg.payload.exponent)
return msg

```

Demo flow (use `CTRL+I` to import it)

```auto
[{"id":"df02b668d9229bd3","type":"buffer-parser","z":"fe471bfa726693b8","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint32be","name":"uint24","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":"0x00FFFFF"},{"type":"int8","name":"exponent","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":2030,"y":820,"wires":[["6b746531a8fdd309","72f1ab990ea48fc4"]]},{"id":"67f19a5bdfba2ea7","type":"inject","z":"fe471bfa726693b8","name":"[65024, 5010]","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[65024, 5010]","payloadType":"json","x":1850,"y":820,"wires":[["df02b668d9229bd3"]]},{"id":"6b746531a8fdd309","type":"debug","z":"fe471bfa726693b8","name":"debug 306","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2370,"y":820,"wires":[]},{"id":"6430740824aa88ce","type":"inject","z":"fe471bfa726693b8","name":"123456*10-3 (FD 01 E2 40)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"0xfd\",\"0x01\",\"0xe2\",\"0x40\"]","payloadType":"bin","x":1800,"y":880,"wires":[["df02b668d9229bd3"]]},{"id":"72f1ab990ea48fc4","type":"function","z":"fe471bfa726693b8","name":"Calc T5","func":"msg.payload.T5 = msg.payload.uint24 * Math.pow(10, msg.payload.exponent)\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2200,"y":880,"wires":[["db7a8a8e5698eea9"]]},{"id":"db7a8a8e5698eea9","type":"debug","z":"fe471bfa726693b8","name":"debug 307","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2370,"y":880,"wires":[]}]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/f/5f07513b6fe244212a84882034d1d4263343fdf7.png)

---

<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:** [8 August 2023 20:22 UTC](https://discourse.nodered.org/t/rs485-modbus-16bit-buffer-conversion-to-different-datatypes-from-finder-meter-7m38/80400/3 "2023-08-08T20:22:42Z")

</div>

Hi Steve,  
thank you so much! Your example does exactly what I needed. I was able to do some minor modification due too differnt datatypes of the meter because it is more than selfexplaning!

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:** [22 August 2023 20:23 UTC](https://discourse.nodered.org/t/rs485-modbus-16bit-buffer-conversion-to-different-datatypes-from-finder-meter-7m38/80400/4 "2023-08-22T20:23:09Z")

</div>

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