NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
ksurdi
Posts: 36
0 Kudos

LabVIEW vi communication with MODBUS

Hi,

  I am trying to establish a communication with my LabVIEW program and MODBUS to read the speed and torque off of a servo motor application. What is the easiest way to do this using LabVIEW? I am pretty much new to communication process/coding. Would really appreciate a few examples.

Thanks.

 

ksurdi

Knight of NI
RavensFan
Posts: 13,226
0 Kudos

Re: LabVIEW vi communication with MODBUS

There is a modbus library available for download.

 

NI Modbus Library for LabVIEW

Member
Roryriffic
Posts: 86
0 Kudos

Re: LabVIEW vi communication with MODBUS

For Modbus examples, try checking in the LabVIEW Example Finder.  In LabVIEW, click Help » Find Examples... When the Example Finder window pops up, search for "Modbus".  I'd recommend taking a look at the examples called Modbus Simulator.lvproj and Modbus Fundamentals.lvproj.

 



 

 

Active Participant
Matt_W1
Posts: 319

Re: LabVIEW vi communication with MODBUS

If you use the modbus library check the comments, there's a bug (that can show up intermittently) in the MB CRC-16.vi. It's easy to fix you need to change the representation of CRC-16 from a U8 to a U16 in MB CRC-16.vi within NI-Modbus.llb. I wish NI would upload a fixed version but considering the modbus library is "not an official NI Product" and the bug is approaching 2 years old, that doesn't seem too likely.

Knight of NI
RavensFan
Posts: 13,226
0 Kudos

Re: LabVIEW vi communication with MODBUS

That's the first I heard about a bug.  Can you post a link to a thread that brings this issue up and discusses it?

Active Participant
Matt_W1
Posts: 319
0 Kudos

Re: LabVIEW vi communication with MODBUS

The only place I know the bug being reported is in the reader comments for the download.

http://sine.ni.com/devzone/cda/epd/p/id/4756

Member
ksurdi
Posts: 36
0 Kudos

Re: LabVIEW vi communication with MODBUS

Hi Rory R,

  I could not find the examples.. when I type in Modbus in the 'Find examples' window in LabVIEW, nothing shows up.. can you please attach those two examples with this thread.. I would really appreciate it. Thank you.

 

ksurdi

Member
Matt_McLaughlin
Posts: 165
0 Kudos

Re: LabVIEW vi communication with MODBUS

Hi ksurdi,

 

The examples that Rory pointed you to are included in the Datalogging and Supervisory Control (DSC) Module. It is very likely that you are not able to find these examples, and likely will not be able to run them, because  LabVIEW DSC is not installed on your machine.

 

More information and the evaluation download of DSC can be found on the NI LabVIEW Datalogging and Supervisory Control Module page.



Matt
NI Community Manager
National Instruments
Active Participant
Himanshu_Goyal
Posts: 248

Re: LabVIEW vi communication with MODBUS

Hi Ksurdi,

 

To work on ModBUS DSC module is not required, only you need one ModBUS library.

This is simple as a serial communication. First you have to Initialize the MB. In this you have to define the device ID, baud rate, parity, stop bit, data bit and time out settings. Second for read the register values you have to define the register range and your device identification setting. As a output you will get the register values. So you can use the register values and an output or that value holding by that register.

 

I have attached a sample VI for your reference. Just go through this and if some more clarification is required please let me know.

To access modBUS, one modBUS library(LabVIEW 8.6) also attached with this post copy and past this in LabVIEW user library and restart LabVIEW.

 

Thanks and Regards

Himanshu Goyal 

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
Member
Cpesko
Posts: 14
0 Kudos

Re: LabVIEW vi communication with MODBUS

Hi Himanshu,

I'm trying to gain knowledge of how to implement a simple MODBUS read/write VI in LabView through your post... 

In your post you say: "This is simple as a serial communication. First you have to Initialize the MB. In this you have to define the device ID, baud rate, parity, stop bit..."

 

Where are can you set the stop bits?  I have a device that uses two stop bits.  I'm able to talk to it using software called "Modbus Poll" but I can't get anywhere with LabView.  I noticed that in LabView the "Init MB" VI doesn't have a stop bit setting.  Is there another way to handle two stop bits?

 

Thanks in advance,

Chris

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page