LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read out and convert Modbus registers

Solved!
Go to solution

hello friends,
I have the UMD 98 meter and need to access it via a fixed IP address. I have fixed registers that I need to read out. in the registers are "Word" with 2 bytes each. a total of 4 bytes corresponding to "Float 32". the two float values need to be converted so that I can display the voltage. I can't find my problem. Can someone help me with this. i am attaching the VI.

0 Kudos
Message 1 of 22
(4,359 Views)

I don't have the Modbus library you are using but I have used the NI Modbus library

 

The NI Modbus library is probably somewhat similar in that is has a VI for reading multiple Modbus registers

 

I was working with a power analyzer and created a "Get Primary Measurements" vi 

 

GetPriMeas.png

 

All of the primary measurements use two registers. I read the registers and the Modbus VI returns an INTEGER (Well it this case a U16 integer array since it is multiple registers)

 

Then I combine the two registers and convert them to floating point

 

bytes2dbl.png 

 

 

 

 

========================
=== Engineer Ambiguously ===
========================
Message 2 of 22
(4,350 Views)

Can you send me the code section so I can use it on myself?

0 Kudos
Message 3 of 22
(4,342 Views)

@JuniorLabview wrote:

Can you send me the code section so I can use it on myself?


Those are code snippets, you can drag and drop them right onto a block diagram.

 

But drag and drop may not work with some (most) modern browsers 

 

  1. Right-click the image
  2. Select Save Image As... and complete saving
  3. Drag the newly created .PNG file onto the LabVIEW Block Diagram
========================
=== Engineer Ambiguously ===
========================
Message 4 of 22
(4,335 Views)

I have been able to do it but it remains as an image and I cannot use the appropriate tools and do not know where to find them all. Can you put the two pictures you sent in a VI and post them?

thank you

0 Kudos
Message 5 of 22
(4,312 Views)

With your code how can I connect with the IP address? can I open the connection with a TCP where I can enter the IP address and with which TCP could it be?

0 Kudos
Message 6 of 22
(4,308 Views)

When you use the NI Modbus library, there are other subVI's which will create the connection and close it when you are done.  The code RTSLVU isn't showing the open or close part, but you can find it in the palette where you get the NI Modbus subVI's.

0 Kudos
Message 7 of 22
(4,303 Views)

JuniorLabview_0-1641491747081.png

Thank you, I found it.

I still have one question, I didn't find the orbiting one in the picture in the palette. How do I find it?

 

0 Kudos
Message 8 of 22
(4,293 Views)

@JuniorLabview wrote:

With your code how can I connect with the IP address? can I open the connection with a TCP where I can enter the IP address and with which TCP could it be?


Well my code was using Modbus Serial, you will need to use Modbus TCP.

 

You will have to install the NI Modbus library and use the "Create Modbus Instance" vi set to "New TCP Master".

 

I linked to the discussion forum thread for the NI Modbus library in my first post but here is is again: LabVIEW Modbus API

 

 

========================
=== Engineer Ambiguously ===
========================
Message 9 of 22
(4,292 Views)

@JuniorLabview wrote:

JuniorLabview_0-1641491747081.png

Thank you, I found it.

I still have one question, I didn't find the orbiting one in the picture in the palette. How do I find it?

 


 

The left circle is around an Array Constant. It's in the Array Pallet. 

 

You will need to refer to your devices register map for the proper values

 

The right circle is around two things. Index Array, that is also in the Array Pallet and the "Bytes to DBL" Vi that I posted the snippet of in my first reply.

========================
=== Engineer Ambiguously ===
========================
Download All
0 Kudos
Message 10 of 22
(4,288 Views)