LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus RTU via RS485

Hi!

I need to send a message on some device wich uses Modbus RTU protocol. That message looks like this: "01 2B 0E 01 00 70 77". Is it good choise to use VISA palet for that? 

0 Kudos
Message 1 of 8
(7,310 Views)

download the Modbus library for labview.  This will make the modbus rtu packets and is build on visa.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 8
(7,297 Views)

Hi Emir_Hodza!

 

To use this protocoll, the best is to download the NI Modbus Library for LabVIEW.

You can do this using this link: http://sine.ni.com/devzone/cda/epd/p/id/4756

 

You can find the installation instructions (seen below), in the Readme.html file, after you unzip the downloaded file. If you use later LV version than 8.6, just use the files in the "86" folder.

 

Installing NI-MODBUS Library:
In order to use the Library in LabVIEW, please follow these steps:

- Close LabVIEW.
- If you have version NI-MODBUS Library 1.1 on your system, it is recommended to uninstall it by going to Control Panel -> Add Remove Programs -> National Instruments Software and select NI Modbus 1.1 from the list.
- Copy NI Modbus.llb from the ##\vi.lib folder to the LabVIEW_ROOT\vi.lib directory where ## is your LabVIEW version (example 86 for 8.6) and is the root folder where you installed LabVIEW.
- Copy lvmodbus.chm and lvmodbus.txt from ##\help to the LabVIEW_ROOT\help directory.
- Copy nimodbus.mnu from ##\user.lib to the LabVIEW_ROOT\user.lib directory.
- Restart LabVIEW. You should see the NI Modbus palette in the User Libraries palette.
- To Uninstall the Library, remove all the files copied from the previous steps.

 

If you copy everything properly, you will see the Modbus VIs in the function library, under User.lib

 

You can read detailed information about the modbus protocoll under this link: http://www.ni.com/white-paper/7675/en

 

If you have any questions regarding to this, please feel free to post them.

 

Best regards,

 

 

 

CLA, CLED
0 Kudos
Message 3 of 8
(7,280 Views)

Thank you very much.

I installed Modbus library according to instructions, but he returned an 6101 error after I run him. I found on the forums that this error means a hardware problem, but it is not a problem because I have achieved communication by using RS232 analyzer. I don't know is it possible to achieve Modbas RTU communication using the "Basic Serial Write and Read", with the necessary modifications?

0 Kudos
Message 4 of 8
(7,269 Views)

Sure you can use serial communication, but the library will handle all the levels of the protocol including timing and packetizing the data.  looks like you are sending the 43 function to address 1, is this correct?

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 8
(7,266 Views)

An example of the message that I set was the device identification. I tried to send it with Basic Serial Read and Write, but without success. I think it's because either hexadecimal characters or the time gaps at the beginning and end of the message, which are absent in ASCII modbus.

0 Kudos
Message 6 of 8
(7,250 Views)

Most common reasons for not getting the transmit are incorrect com settings (parity, baud, port ....) or incorrect messages.  did you validate the string in hyperterminal or other program first?

Also make sure you send the hexidecimal nimbers as a string, not a labview string.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 7 of 8
(7,237 Views)

Hi Emir_Hodza!

 

Did you try the examples, taht you can find on the Modbus functions palette?

 

I mean the Modbus Serial Exmaple Slave.vi and Modbus Serial Exmaple master.vi ?

 

Previously you wrote that you need to send a message to a device, so I think you should try the Master example. 

 

Please let me know how the examples work for you.

 

Best regards,

CLA, CLED
0 Kudos
Message 8 of 8
(7,216 Views)