LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview I/O Server

So I have been asked to help set up a modbus over ethernet program to read a couple of pressures and flowrates off a pump controller here at work.  I was going to use the I/O Server because I've never done any modbus work with labview and thought it might be simpler.  I first connected to the slave using CAS modbus scanner to make sure I could see it and read from it.  Once that was successful I tried to write the code like I thought it should be.  I create an I/O server, then create bound variables and then try to output those variables in a VI.  I have had no luck whatsoever yet.  I can communicate with the slave using the CAS scanner.  I was hoping someone might have a sample or a tutorial that might help.

 

Thanks

0 Kudos
Message 1 of 7
(2,813 Views)

I generally recommend using the NI Modbus Library which you can download off of VI Package Manager over the I/O servers but ether way we would need to know what device you are trying to communicate to, what registers/coils on that device you are trying to read, and then how you have configured everything in LabVIEW.

 

Also, are you receiving an error or just not getting the data you expect from the Modbus reads in LabVIEW? Addressing in Modbus isn't always super clear so if you aren't getting the data you expect but no errors are being thrown, I would suggest reading the adjacent addresses to make sure it isn't an off by one error.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 7
(2,787 Views)

Hello, and thanks for the response.  I'm not getting an error right now and I am reading 2 channels on each side of the channel I want.

 

I am working with a teledyne isco pump controller.  We are trying to read the pressures which are 40073 and 40079, so with the 6 digit addressing reading 400073 and 400079 off the variable chart that is created. 

 

I did download the ni modbus library earlier but haven't tried it yet.  I would use either since I'm only needing to read a few registers.

 

Thanks 

0 Kudos
Message 3 of 7
(2,779 Views)

MattBHGE_0-1582149839953.png

MattBHGE_1-1582150033821.png

 

These are the values I'm trying to read.  I rewrote the code using NI modbus library.  I am getting values but they are not the values I want.  They are the Uint16 values and I need the floating 32 values.  I am having no luck converting them from 16 to 32.  Is there any simple code that can run to convert those values?

0 Kudos
Message 4 of 7
(2,709 Views)

You could also typecast an array of U16 values into an array of single floating points in the event you have registers in a row you have acquired as an array to convert.

You could also typecast an array of U16 (with only two elements) in to a single floating point.

 

You may have to play around as the word order may matter.

 

Useful functions will be under the Numeric >> Data Manipulation palette.

0 Kudos
Message 5 of 7
(2,702 Views)

Thank you for the reply.  I am new to modbus through labview, do you happen to have any examples of these options that you know of?

 

Thanks again

0 Kudos
Message 6 of 7
(2,674 Views)

Examples:

 

 

But you'll have to test it out in case the word order matters.

0 Kudos
Message 7 of 7
(2,661 Views)