# Reading four consecutive Modbus Registers for modulo 10k

**URL:** <https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087>\
**Category:** General\
**Created:** [5 August 2022 17:00 UTC](https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087 "2022-08-05T17:00:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![HansZnarf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hansznarf/32/70215_2.png) [@HansZnarf](https://discourse.nodered.org/u/HansZnarf)\
**Post date:** [5 August 2022 17:00 UTC](https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087/1 "2022-08-05T17:00:31Z")

</div>

Need the following  
Read holding register 1620 - 1623

Preform math integer math function as follows from values in these registers  
(Value of 1623_10000^3)+(Value of 1622_10000^2)+(Value of 1621\*10000)+(Value of 1620)

Concerned if we do an individual read the math will not work as one output value so tried a block read of four (4) values starting at holding register 1620. The output of the block debug shows the values of each separated by a comma.

Have not found a Modbus block read that provides four output nodes to run the math. Is there a block that will allow us to take each value out and then do the math?

Hans

---

<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:** [5 August 2022 17:13 UTC](https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087/2 "2022-08-05T17:13:50Z")

</div>

Why have you started a new thread?

What's different to this one...

> [@Very Large Numbers Modulo 10k](https://discourse.nodered.org/t/very-large-numbers-modulo-10k/66069):
>
> Here is how modulo 10k is described. 64-bit unsigned value returned in four consecutive 16-bit registers, where R4 is the last register and R1 is the first register. Each registers range is 0 to +9,999: R410,000^3 + R310,000^2 + R2\*10,000 + R1 I have created a Modbus function read of four registers to create the math. The resulting numbers appear to be too large for Node-Red to use. What is the work around? Need to do these multiplications and then add the numbers together. Any help?

---

<div class="post-metadata">

**Author:** ![HansZnarf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hansznarf/32/70215_2.png) [@HansZnarf](https://discourse.nodered.org/u/HansZnarf)\
**Post date:** [5 August 2022 18:02 UTC](https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087/3 "2022-08-05T18:02:15Z")

</div>

Node Red Forum would not let me attach or send lager captures. Decided to make clear what I was trying to do. With a typical modbus block read I should be able to separate the output rather than getting a string such as 571,6584,16.0 Each one of these is a value that we need to conduct Modulo 10k math and add together.

Would modbustcp block to look something like this as best as I can show in text

* * *

IN modbustcp Out 1 (1620)\*  
10.145.44.234 Out 2 (1621)\*  
Modbus Add 2 Out 3 (1622)\*  
Out 4 (1623)\*

* * *

There should be four OUTPUT threads when I call four registers so each can be used.  
Or what use is a block read?

Hans.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 August 2022 19:33 UTC](https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087/4 "2022-08-05T19:33:48Z")

</div>

You should read four registers in one go and pass it to the buffer parser node to convert.

---

<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:** [5 August 2022 19:51 UTC](https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087/5 "2022-08-05T19:51:12Z")

</div>

Solution already posted in OPs other thread

---

<div class="post-metadata">

**Author:** ![HansZnarf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hansznarf/32/70215_2.png) [@HansZnarf](https://discourse.nodered.org/u/HansZnarf)\
**Post date:** [9 August 2022 15:06 UTC](https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087/6 "2022-08-09T15:06:03Z")

</div>

Have been using Modbus reads for decades. While reading four registers the out put of the block (node) would typically produce four output links. the modbustcp node I am using allows to configure for a block read but does not produce individual output links for the data being read. The debug shows all four values each separated by a comma. Do not know how to turn these into individual values to use. Buffer Parser node still outputs the four values as aaaa,bbbb,cccc,dddd and does not provide output threads that allow me to use the values separately. Thanks,

---

<div class="post-metadata">

**Author:** ![HansZnarf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hansznarf/32/70215_2.png) [@HansZnarf](https://discourse.nodered.org/u/HansZnarf)\
**Post date:** [9 August 2022 15:19 UTC](https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087/7 "2022-08-09T15:19:59Z")

</div>

Steve-Mcl. Many thanks for your help. Unfortunately while attempting to load BigInt from the Pallet Library Node-Red produced a "Fail to install:" message with an "Install failed" and "Check the log for more information" statement. Not BigInt does not show up in the Palette Install tab with a key word search. Running v3.0.1 with Windows 10. The error logs for this appear to be gone. Any other ideas?  
Thanks, Hans.

---

<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:** [9 August 2022 16:06 UTC](https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087/8 "2022-08-09T16:06:00Z")

</div>

> [@HansZnarf](#):
>
> Unfortunately while attempting to load BigInt from the Pallet Library Node-Red produced a "Fail to install:

No one said to install anything called "BigInt"

I gave you a solution on your duplicate thread using a built in function node.

---

<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:** [8 October 2022 16:07 UTC](https://discourse.nodered.org/t/reading-four-consecutive-modbus-registers-for-modulo-10k/66087/9 "2022-10-08T16:07:00Z")

</div>

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