Real-Time Measurement and Control

Showing results for 
Search instead for 
Did you mean: 

Modbus daq

Go to solution

Hi, everyone here i'm using Modbus TCP to get the Energy Meter data, the actual data format is swapped float/ big Endian,  I'm getting data in an array and it displays values in decimal, can anybody help me to swap the value and get the correct value. 


0 Kudos
Message 1 of 12

Send an example of the array you get and the expected value.

0 Kudos
Message 2 of 12

I'm getting array values are 16967,54476,16072,33183 and expected values are 49.9707 and 0.3823.

Download All
0 Kudos
Message 3 of 12

If we could see the VI you have written so far, that would help us give you advice on it.

0 Kudos
Message 4 of 12

I tired lot of swapping logic but i'm not yet succeed, please help me get actual value. I attached pic of some logic tired. 

0 Kudos
Message 5 of 12

In order to help you, we need the communication protocol of your Energy Meter which describes the encoding of the values. Which model do you use ?


0 Kudos
Message 6 of 12

One thing that jumps out is that you are getting an array of U16 data from the Read Input Registers function, then using a Type Cast function to convert the indexed U16 values to U16? This seems unnecessary.


Anyway, if the elements in the 'register values' array are the same data type as the values being sent, they should be the same values if they are being read correctly. What data types are being sent to the NI hardware? Try using a conversion function from the Numeric palette, perhaps.

0 Kudos
Message 7 of 12
Accepted by topic author praveenrajk

IEEE 754 ? See this discussion.


IEEE 754.png


Message 8 of 12

I'm getting data from Electrical meter through Modbus TCP , actual data format coming out from Meter is Long&Real, I'm using modscan software to verify the data, under modscan i'm using swapped float type to see the actual data.

Actual data takes 2 words space for single value, but in Labview it displays in 1 word (decimal), I think there will be problem, I have to use two decimal values coming from registers and swap it to get the actual data, this is my idea, but i'm struggling how to effectively use the join and swapping function to get the actual data. 

I'm new to LabVIEW software, but i tired some logic using these functions but not yet succeed, Kindly guide me to get the actual data.

Is any Modbus block available to get the swapped float data directly without any swapping? if it available, that will be more useful. 

Thanks in advance

0 Kudos
Message 9 of 12

Have you seen my last post ?


IEEE 754.png 

  1. Convert U16 array to U32 array
  2. Flatten U32 array to string
  3. Unflatten string to SGL
0 Kudos
Message 10 of 12