LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

modbus

Hello all.  I am trying to use a Yokogawa 7144 Gas Analyzer with Labview 2010.  The gas analyzer uses Modbus, and I am completely unfamiliar with modbus.  I have read on it, but still have a hard time trying to understand it.

 

Essentially I want to Labview to display the values shown on the gas analyzer screen.  The goal is to get labview to put these values into an Excel spreadsheet where other formuals reside.  So instead of having to type the values into the Excel spreadsheet, labview will automatically put them in for us when the analyzer is running.

 

I have attached the program that I made.  I have not ran it as I am afraid of ruining the analyzer by causing some fatal software error.  Can you all just look at this and see if the program makes sense?  figure you can't run it since it requires a connection to a device.

 

From looking at the analyzer modbus guide, there are six registers that I will access.  The data I want to display is held in registers 1 and 4.  The other registers contain values that tell the analyzer how to display the data (##.## format and measurement unit type).  Each register is of the Word data type.

 

Below is an explantion of the register array.  The array uses integers to assign values.  (e.g. a 0 in array value 3 means the CO will be shown as %vol)

 

Array Value 1 - CO value

Array Value 2 - decimal point position for CO

Array Value 3 - measurement unit for CO (vol%, ppm, etc.)

Array Value 4 - CO2 value

Array Value 5 - decimal point position for CO2

Array Value 6 - measurement unit for CO2(vol%, ppm, etc.)

 

In the end, the program should show someting like:  Co2 %  ##.##   and CO  ####.  The While Loop should enable to program to run continuously.

 

Does this look like it will work? 

0 Kudos
Message 1 of 6
(3,313 Views)

Hi,

 

I could change the VI for you, but I think it is better if your try it yourself.

Take a look at the 'MB Serial Example Master.vi' that comes with the MB lib from NI.

You can see how you should build a user interface and you see how to wire the (right) ModBus VI's.

 

Give it a try and let us know if you can wok this out.

 

Kees

0 Kudos
Message 2 of 6
(3,306 Views)

I looked at both the MB Serial Example Master and the MB Serial Example Slave.  Would both of these be necessary for what I want to do?  I basically was trying to hardwire the Master so the user did not have to enter any settings. 

 

Is it possible to take the Example VIs and use them as is?  They don't appear to write anything to a device, so if I run them as they are, could I see any values from the gas analyzer registers?  I don't believe the coils or discrete input booleans would do anything, as nothing in the analyzer modbus guide mentioned coils.

 

Thanks for the advice

0 Kudos
Message 3 of 6
(3,297 Views)

Hi,

 

Most examples are not useable as they are, but it is a start. You can see how things can be done.

 

Tell me which ModBus addresses you need to write and read to get the data you want.

 

Kees

0 Kudos
Message 4 of 6
(3,264 Views)

1) Why perform the init, and slave init for each iteration of the loop? These should be outside the loop.

2) If you are worried about somehow 'ruining' the gas analyzer, why include any write command at all? Delete the write holding register command, and simply use the read command. 

3) There is no timing in the loop.

 

 

0 Kudos
Message 5 of 6
(3,252 Views)

Register       Required  

Number        Value

 

30001 ->    9999

30002 ->    2

30003 ->    1

30004 ->    9999

30005 ->    0

30006 ->    1

 

 

0 Kudos
Message 6 of 6
(3,091 Views)