LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Help with Serial Modbus to PLC

Hi,
 
I have a small HVAC unit which has it's temperature and fan speed controlled by a PLC (T100MD-888+PLC).There are start/stop buttons and a variable pot for the temperature setpoint locally, but I would also like to be able to view and control the unit on Labview.
The PLC has a serial port and will support Modbus but I have no experiance with Modbus or setting it up.
I am using Labview 8.2 with the DSC Module, so I think I have all I need to set it up. (with your help)
I tried to set-up one of the inputs as a shared variable but it didn't work (see attached), not sure if this is the right method. 
I also tried some of the VI's from User Libraries > NI Modbus, but because I have no experiance with these I got lost.
If someone can explain to me (in very plain english) how to set this up or if you have a VI that I can easly modify I will be very thankful.
 
Thanks.
 
 
0 Kudos
Message 1 of 4
(8,830 Views)
First, your attachment didn't make it.
 
Second, I would recommend going to modbus.org.  This link http://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf is a good document to explain how modbus works.  Once you've read that, the NI modbus libraries will make more sense and you will be able to ask some question about what you don't know.
0 Kudos
Message 2 of 4
(8,817 Views)
Hi cubtech,

In addition to the steps below I also recommend running the two Modbus examples from the Example Finder (Help>>Find Examples) in LabVIEW.  You need to run the two main examples together to get the full Modbus demo (see attached image).

1)  Ensure that modbus communication is enabled on your PLC.  Refer to the PLC documentation on how to do this.  The program running on the PLC may need to explicitly export values to different Modbus registers.
2)  Make sure you're using the right kind of serial cable.  Most likely you need a straight-through cable, but you could need a null-modem cable.
3)  Open LabVIEW and create a new project.
4)  Right-click on My Computer and choose 'New IO Server'.  Choose the 'Modbus' IO server type (not Modbus Slave).
5)  Configure the Modbus IO server communications settings to match those on the PLC.
6)  After accepting changes to the Modbus IO server configuration, save Untitled Library 1 with a new name. 
7)  Right-click on the library you just created and choose 'Create Variables'.  For the count, enter the number of IO points on your PLC that you want to connect to, then click 'Create'.
8)  (Now look at the attached image) When the multiple variable editor windows appears you can rename 'Variable1', 'Variable2', etc, with meaninful names.  Also, select the values in "bind to source" and make the values 'on'.  Now browse to the Modbus regsiter you want to bind each variable to in the NetworkSmiley Tongueroject Path column.  The dialog will always put the first register of any range so after you browse for the item you should manually edit the string in the cell to point to the precise register you need to communicate with.
9)  Close the MVE after you've setup all the variables with the correct bindings.
10) Right-click the library and choose 'Deploy'.  From LabVIEW, choose Tools>>DSC Module>>Monitor Variables.  You should be able to browse to the variables you just created.  When you add them to the watch window you should be able to see the values from your PLC.  --If you don't, look at the quality of the tags in the watch window.  This will help you debug any communications problems.

-Nick

~~
Message 3 of 4
(8,775 Views)

学习modbus rtu

0 Kudos
Message 4 of 4
(2,535 Views)