<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Reading and Writing 4 byte floating point from modbus]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I am implementing a control solution for a breadboard rocket test bench using the Monarco HAT and Rexygen. I can read and write commands with success using modbus with all devices so far but I am having difficulties with some values that need to be read and write using 4 byte floating point (IEEE 32-bit single precision, MSB first) values.</p>
<p dir="auto">How do I convert the read values to something human readable for my HMI and then convert analog inputs back to this format to send the correct command back?</p>
<p dir="auto">For now the read values shows things like:</p>
<p dir="auto"><img src="/assets/uploads/files/1608236439127-b6e8fec4-9440-470e-b96c-73c1bd7be27b-image.png" alt="b6e8fec4-9440-470e-b96c-73c1bd7be27b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The upper one is a modbus value of temperature in the 4 byte floating point format and the lower one an integer of a second flow controller showing the same temperature. Just as an example.</p>
<p dir="auto">Almost all commands and information I need does not need to be floating point but the critical input (the set-point of the controller) must be of this number format.</p>
<p dir="auto">Thank you!</p>
]]></description><link>https://forum.rexygen.com/topic/174/reading-and-writing-4-byte-floating-point-from-modbus</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 16:58:54 GMT</lastBuildDate><atom:link href="https://forum.rexygen.com/topic/174.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 17 Dec 2020 20:25:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Reading and Writing 4 byte floating point from modbus on Tue, 22 Dec 2020 14:34:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/133">@reitinge</a> Thank you very much! That is what I am doing right now <img src="https://forum.rexygen.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=rfreqd0ultg" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /> It works good enough.</p>
]]></description><link>https://forum.rexygen.com/post/658</link><guid isPermaLink="true">https://forum.rexygen.com/post/658</guid><dc:creator><![CDATA[brunofporto]]></dc:creator><pubDate>Tue, 22 Dec 2020 14:34:10 GMT</pubDate></item><item><title><![CDATA[Reply to Reading and Writing 4 byte floating point from modbus on Tue, 22 Dec 2020 09:12:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.rexygen.com/uid/198">@brunofporto</a> Hi Bruno,<br />
you can read and write into one register simultaneously, but you need two items in the Modbus Master registers table. Rexygen doesn't support Read and Write flags at one Master Item. You should set something like this into your table for one register value:<br />
<img src="/assets/uploads/files/1608628133960-8b435268-4377-45db-8768-4a04c4dc68a5-image.png" alt="8b435268-4377-45db-8768-4a04c4dc68a5-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">You can also look here, where similar problem was solved:<br />
<a href="https://forum.rexygen.com/topic/23/read-write-modbus/9?_=1608627568594">https://forum.rexygen.com/topic/23/read-write-modbus/9?_=1608627568594</a></p>
]]></description><link>https://forum.rexygen.com/post/657</link><guid isPermaLink="true">https://forum.rexygen.com/post/657</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Tue, 22 Dec 2020 09:12:16 GMT</pubDate></item><item><title><![CDATA[Reply to Reading and Writing 4 byte floating point from modbus on Sun, 20 Dec 2020 09:00:29 GMT]]></title><description><![CDATA[<p dir="auto">Dear Bruno,<br />
in my opinion, Rexygen does not natively support the string type in Modbus registers.  If reading ASCII values ​​is enough for you, use several <em>REGISTER_16</em> or <em>REGISTER_32</em> items and <strong>INTSM</strong> blocks (<a href="http://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/INTSM.html">www.rexygen.com/doc/ENGLISH/MANUALS/BRef/INTSM.html</a>). Use settings:</p>
<ul>
<li>shift = 0, mask = 255 for reading LSB</li>
<li>shift = 8, mask = 255 for second byte, etc.</li>
</ul>
<p dir="auto">For example <em>REGISTER_16</em> (UINT16) value 0x4272 =  17010 will be divided to LSB = 0x72 = 114 and MSB = 0x42 = 66.<br />
<img src="/assets/uploads/files/1608454456676-d7b31cfd-ce43-4622-aca5-bf2cd8f42914-image.png" alt="d7b31cfd-ce43-4622-aca5-bf2cd8f42914-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">If you want to convert ASCII characters into a string, you should use a Python block (<a href="https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/PYTHON.html">https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/PYTHON.html</a>).</p>
<p dir="auto">Cheers,<br />
Jan</p>
]]></description><link>https://forum.rexygen.com/post/653</link><guid isPermaLink="true">https://forum.rexygen.com/post/653</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Sun, 20 Dec 2020 09:00:29 GMT</pubDate></item><item><title><![CDATA[Reply to Reading and Writing 4 byte floating point from modbus on Fri, 18 Dec 2020 10:35:19 GMT]]></title><description><![CDATA[<p dir="auto">Other doubt is about RW data and use of Goto and From.</p>
<p dir="auto">If I have a RW type of  register why I can not use the same register for both? Now I created a pair of them for this - one to write the value and a second one to read the current set value.</p>
]]></description><link>https://forum.rexygen.com/post/650</link><guid isPermaLink="true">https://forum.rexygen.com/post/650</guid><dc:creator><![CDATA[brunofporto]]></dc:creator><pubDate>Fri, 18 Dec 2020 10:35:19 GMT</pubDate></item><item><title><![CDATA[Reply to Reading and Writing 4 byte floating point from modbus on Fri, 18 Dec 2020 10:25:07 GMT]]></title><description><![CDATA[<p dir="auto">Thank you Jan</p>
<p dir="auto">Swap Words did the trick:</p>
<p dir="auto"><img src="/assets/uploads/files/1608286528256-475f6e4b-38fa-49a3-9220-e2f5e0c4442b-image.png" alt="475f6e4b-38fa-49a3-9220-e2f5e0c4442b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">There are other registers that I am not able to read even with the same settings (REGISTER_FLOAT type and Swap Words ticked)</p>
<p dir="auto">Today I'll test the other way: try to write a float type <img src="https://forum.rexygen.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=rfreqd0ultg" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">Ont he same subject, but other type of data, from the 917050-Manual-mini-CORI-FLOW.pdf page 29:</p>
<p dir="auto">Type<br />
Unsigned char 1 byte unsigned integer (0…255)<br />
Unsigned int 2 byte unsigned integer, MSB first (0…65535)<br />
Unsigned long 4 byte unsigned integer, MSB first (0…4294967295)<br />
Float 4 byte floating point, IEEE 32-bit single precision, MSB first<br />
<strong>Unsigned char '[x]' x byte array (text string)</strong></p>
<p dir="auto">This last one is a ASCII text . Please, any tips if it is possible to read or write these types of data? They give an example at page 35:</p>
<p dir="auto">Fluid Name:<br />
Request<br />
01 03 81 88 00 05 2D DF<br />
01 slave address of instrument Address = 0x01<br />
03 function code 0x03 is Read Holding Register<br />
8188 starting address<br />
0005 quantity of registers (5 register2 = 10 bytes)<br />
2DDF CRC</p>
<p dir="auto">Response<br />
01 03 0A 41 69 72 20 20 20 20 20 20 20 86 7F<br />
01 slave address<br />
03 function code 0x03 is Read Holding Register<br />
0A number of Bytes<br />
697220202020202020 Fluid Name in ASCII<br />
86 7F CRC (Generated from the MODBUS slave)</p>
<p dir="auto">Thank you!</p>
]]></description><link>https://forum.rexygen.com/post/649</link><guid isPermaLink="true">https://forum.rexygen.com/post/649</guid><dc:creator><![CDATA[brunofporto]]></dc:creator><pubDate>Fri, 18 Dec 2020 10:25:07 GMT</pubDate></item><item><title><![CDATA[Reply to Reading and Writing 4 byte floating point from modbus on Fri, 18 Dec 2020 08:36:00 GMT]]></title><description><![CDATA[<p dir="auto">Hi Bruno,<br />
how did you set your Modbus RTU registers at Monarco HAT? Please, open your <strong>MBM</strong> driver block in the <strong>Exec</strong> file of your project. Click on <strong>Configure</strong> button and Modbus registers editor will appear. For reading a 4 byte floating point real number, you should add an Item with proper Item Address, Type <strong>REGISTER_DOUBLE</strong> and marked <strong>Readable</strong>. The MSB first format should be the native format of Rexygen numbers, so you don't need to check the <strong>Swap Bytes</strong> box, but maybe the <strong>Swap Words</strong> box will be useful. With a right configuration of this two boxes (Swap Bytes and Swap Words), you should observe correct real numbers direct at the output of the MBM__FLWF_TEMPERATURE flag and no additional conversion should be needed.<br />
I usually use this site for checking the proper byte order: <a href="http://www.binaryconvert.com/convert_double.html">http://www.binaryconvert.com/convert_double.html</a><br />
If you have the opportunity to directly monitor the values of communicated bytes, please post them here.<br />
Documentation for Modbus in Rexygen is there: <a href="https://www.rexygen.com/doc/ENGLISH/MANUALS/MbDrv/MbDrv_ENG.html">https://www.rexygen.com/doc/ENGLISH/MANUALS/MbDrv/MbDrv_ENG.html</a></p>
<p dir="auto">Cheers,<br />
Jan</p>
]]></description><link>https://forum.rexygen.com/post/648</link><guid isPermaLink="true">https://forum.rexygen.com/post/648</guid><dc:creator><![CDATA[reitinge]]></dc:creator><pubDate>Fri, 18 Dec 2020 08:36:00 GMT</pubDate></item></channel></rss>