08-03-2011 09:15 PM
Hello,
I am trying to send over pressure and temperature information via the Input Register array in MODBUS TCP. My question is, how to I properly send over an array of double precision values without loosing my data?
For example, my array of data looks like:
12.0001
32.001
0.00051234
0.0014838
1.02
12.0232
31.920
Thanks so much.
08-03-2011 09:39 PM
@huskyblacktools wrote:
Hello,
I am trying to send over pressure and temperature information via the Input Register array in MODBUS TCP. My question is, how to I properly send over an array of double precision values without lo
osing my data?
For example, my array of data looks like:
12.0001
32.001
0.00051234
0.0014838
1.02
12.0232
31.920
Thanks so much.
We need more information.
Double precision means 8 bytes of data. A single register is only 16 bits or 2 bytes of data. Many times, machines that need floating point data will use 2 consecutive registers, (4 bytes) but that means only single precision floating point data.
You show 7 pieces of data there. How many registers are you trying to write it to?
08-03-2011 10:40 PM
Thank you Ravens Fan for replying.
I missed one extra point of data. Below is what I'd like to send:
12.0001
32.001
0.00051234
0.0014838
1.02
12.0232
31.920
2046
The array above is an array of double precision values. I will convert that array to an array of single precision floating data to reduce data size.
Since I have eight pieces of single precision floating point data now, I will need to write to 16 registers correct? What is the best method to split up each piece of data into two consecutive registers?
Attached is a Slave Send Data.VI that I want to send this data through. The end goal is to have a Master PC (not using labview, but a MODBUS utility) to read my MODBUS TCP message from the "Slave Send Data.vi"
Thanks
08-03-2011 10:57 PM - edited 08-03-2011 10:58 PM
You can use coerce to force the double float to become a single. Then use typecast to convert that to a U16 array.
There are other functions in the Numeric, Data Manipulation palette that may be useful such as swap bytes, swap words, flatten/unflatten to string, and split/join numbers. Because one thing you might have to do is worry about Endianism on your numbers.
08-03-2011 11:40 PM - edited 08-03-2011 11:42 PM
Ravens Fan, I think this will work! Tomorrow I'll test it on the equipment and report back. I've been following many MODBUS threads you've posted in since starting my project and your advice has been great. Thank you for your assistance.
08-04-2011 01:20 PM
Worked great! Thanks Ravens Fan