LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MODBUS parameters for VFD communication to Labview

Solved!
Go to solution

Hi all,

 

My project will use NI LabVIEW 2015 to control a three phase motor through a variable frequency drive. I have no experience using ModBus.

 

My VFD needs to do 4 basic things through Labview. I need to set the motor speed, I need to START/TURN ON the motor, I need to read the motor RPM feedback, and I need to STOP/TURN OFF the motor. Does this mean that I will have 4 registers? 

 

In order to access ModBus, I downloaded a ModBus vi file along with it's library file that I found on the following thread (I attached the files to this thread)http://forums.ni.com/t5/LabVIEW/LabVIEW-vi-communication-with-MODBUS/td-p/1584302.

 

 Below is a screenshot of the Front Panel from the vi file;

FrontPanel.PNG

 

**Note** Under "Function Code", the options are Read Inbput Registers, Write Single Coil, Write Single Register, Read Exception Status, Write Multiple Coils, Read coils, Read Discrete Inputs, and Read Holding Registers.

 

My questions are: 

- How do I know what the read type would be?

- How do I choose the Starting Register Address?

- From the starting register, would I be reading 4 registers?

- What would I input for "Data" and "Discrete"?

 

 

I am using a USB-485M adapter. Here are the port settings;

ADAPTERsettings.PNG

 

I am using a DURAPULSE AC drive as a VFD. The Part number is GS3-21P0. Here is a link to the manual if it helps; 

https://cdn.automationdirect.com/static/manuals/gs3m/gs3m.pdf

 

Here is a screenshot that I edited from the VFD manual, here are the parameters I believe I'll need;

vfdPARAMETERS.png

 

Thank you.

 

-Kevin

 

Download All
Message 1 of 37
(12,244 Views)

Hello,

 

I am working on a project that will use NI LabVIEW 2015 to control a three phase motor through a variable frequency drive. I have no experience using ModBus.

 

I need my VFD to do 4 basic things. I need to set the motor speed, I need to START/TURN ON the motor, I need to read the motor RPM feedback, and I need to STOP/TURN OFF the motor. Does this mean that I will have 4 registers? 

 

In order to access ModBus, I downloaded a ModBus vi file along with it's library file that I found on the following thread (I attached the files to this thread)http://forums.ni.com/t5/LabVIEW/LabVIEW-vi-communication-with-MODBUS/td-p/1584302.

 

 Below is a screenshot of the Front Panel from the vi file;

**Note** Under "Function Code", the options are Read Inbput Registers, Write Single Coil, Write Single Register, Read Exception Status, Write Multiple Coils, Read coils, Read Discrete Inputs, and Read Holding Registers.

 

My questions are: 

- How do I know what the read type would be?

- How do I choose the Starting Register Address?

- From the starting register, would I be reading 4 registers?

- What would I input for "Data" and "Discrete"?

 

 

I am using a USB-485M adapter. Here are the port settings;

 

I am using a DURAPULSE AC drive as a VFD. The Part number is GS3-21P0. Here is a link to the manual if it helps; 

https://cdn.automationdirect.com/static/manuals/gs3m/gs3m.pdf

 

Here is a screenshot that I edited from the VFD manual, here are the parameters I believe I'll need;

 

Thank you.

 

-Kevin

0 Kudos
Message 2 of 37
(12,230 Views)

First, make sure you read the manual.
Second, you might want to read up more on Modbus as www.modbus.org

Start with just reading some parameters.

For instance, that motor RPM.  Since it as address 4xxxxx, that means you use command or function code #3 for Read Holding Registers.  Use Starting address 8455.  (Drop the 4 and subtract 1.  You'll notice if you convert that result to hexadecimal, you'll get the 2107 shown in the Hexadecimal address column.)  Put nothing in for the Data or Discrete.  That is only if you are writing data.

You would use the Discrete input, and not the Data, if you were doing a Write Coils.  Those have registers that begin with either nothing or 0, or 1  (I can't remember which.)

For Write Holding Registers, or Write Multiple Registers.  You put your U16 data into the Data section and leave Discrete Empty.

 

Again, you'll have to read the manual to find which registers correlate to what, and how many you may need to read.  If registers are conitguous, than you can read or write to them in once command.  If they are separated, you'll need to do multiple reads or writes.

Message 3 of 37
(12,193 Views)

Hello belae1ka,

 

The answer to these questions is very likely to be stated in the manual. This VI you found in the other forum seems to have more functionalities that you need, I recommend to take a look at these links and create the VI yourself:

http://www.ni.com/white-paper/7675/en/

http://www.ni.com/example/29756/en/

http://www.ni.com/tutorial/13911/en/

http://www.ni.com/example/31153/en/

 

First of all, make sure you can see the USB-485M in NI MAX, it's important to know if LabVIEW will be able to interact with it. You can also get access to ModBus examples in LabVIEW -> Help -> Find examples...

 

I am afraid that what you need to read, how to read, how many registers are things you should find in the manual. If you don't, get in touch with the seller and ask them. They might have some example for third party devices like: "write this to this register, then read this on this other register and this value is this data"

 

Regards,

Pedro

Message 4 of 37
(12,141 Views)

Thank you RavensFan,

 

I am currently reading through and taking notes on how Modbus works and then I will give it a go!

 

I have a question though, I am reading through the "white papers" NI offers on how Modbus works and it is stated that "NI provides three primary mechanisms for interfacing with Modbus devices: (1) a high-level OPC server, (2) a Modbus I/O server, and (3) a low-level Modbus API introduced in NI LabVIEW 2014 software through the LabVIEW Real-Time or LabVIEW Datalogging and Supervisory Control (DSC) modules."

 

My question is, will I be using option 3? Labview Modbus API? 

 

The end goal of my project is to plot a Force vs Speed graph. The force being the pressure applied on a load cell sensor while the speed is the RPM of the motor. Precise timing is essential for my project. For example, we need to know the force applied on the load cell at 1 RPMs, 2 RPMs, 3 RPMs, and so on. Here is an example of what our final graph will look like. (**Note: We will use stroke length and RPM to convert to Velocity (in/sec) as seen in the plot below by using a formula**)

Thanks again!

0 Kudos
Message 5 of 37
(12,111 Views)

I don't know.

 

What I do know is that I have used a Modbus library provided my NI that was never really officially supported.  It has come out in a couple different iterations over the years.  I would classify it under #3, except it does not require the DSC module to use.

 

The link to the one I use is one of the ones Pedro linked to above.  http://www.ni.com/example/29756/en/

 

Another links for a newer version, but was rearchitected to use LVOOP, if I recall,  is http://forums.ni.com/t5/NI-Labs-Discussions/NI-LabVIEW-Modbus-API-Discussion/td-p/3373078  and http://forums.ni.com/t5/NI-Labs-Toolkits/LabVIEW-Modbus-API/ta-p/3524019.  I've never used this one.

 

 

Message 6 of 37
(12,105 Views)

Hi RavensFan,

 

I am having a great deal of difficulty communicating to my VFD. I am trying to start simple and do something like read the status of my drive.

 

I am currently trying to find a Modbus serial RTU example to go off of but I am not having any luck. Do I need to create the Block diagram and Front panel from scratch? I tried to follow the example below which is found on the link under the image but I was unable to find the components used in the block diagram.

Screen Shot 2017-02-23 at 3.17.32 PM.png

http://www.ni.com/white-paper/7675/en/

 

I understand it's easier said than done but what I would ideally like to do is have a front panel that allows me to input;

- The settings of my RS485 adpater

- Modbus command settings such as Function code and starting address

-Serial parameters

 

- My command message

-A response message from the vfd

 

I went to "Find examples" and found "RS-485 Transceiver Control.vi" which is shown below, this seems to be fairly off as to what I am trying to do but I was hoping of having a front panel that allows me to both read and write and display the response.

ghrhtrh.PNG

 

 I am continuing to research Modbus as much as I can but I feel that I am easily confused when attempting to interface it with Labview.

 

Thank you for your time.

 

-Kevin

0 Kudos
Message 7 of 37
(12,092 Views)

Your top image and link refer to Modbus functions that are found in Data Communication >>  Modbus.  Then it breaks into two submenus called Modbus Master and Modbus Slave.  Generally you would use Modbus master since you are trying to communicate with devices that are slaves.

 

When I look at the help file for these, it says the DSC module is required.  So this must be the one referred to be needing the DSC module Modbus API.  I believe the DSC module is also required if you try to create libraries of variables and tags within a project and associate them with devices.  Although I have the DSC module, I have never used either of these methods.  I think the VI's you see there are a relatively recent addition to LabVIEW.

 

Do you have the DSC module?  If not, you won't be able to find them.  In which case I suggest you look at the links I gave you in an earlier message.  Those do not require the DSC module.  If I remember correctly, the newer versions of those went used polymorphic VI's for the different commands, while the older ones you picked the type of command in the controls you wired to it.

 

Also, look in JKI Package Manager.  the NI Modbus Library version 1.1.5.39 is listed there from the NI LabVIEW Tools Network.

 

Now you mentioned looking for an example and finding RS-485 transceiver control.  Just forget about that.  It has nothing to do with Modbus.  It looks like it is a version similar to Basic Serial Read and Write, but tweaked to show the properties associated with RS-485 ports.

 

 

Message 8 of 37
(12,085 Views)

Hi RavensFan,

 

Thank you for for clearing that up, you have been the most beneficial resource for helping me in the processes of understanding. I do not have a DSC module, just a computer acting as a master, and the VFD acting as the slave through the RS485 link. I will follow your suggestions and see where it takes me.

 

Thanks again!

 

-Kevin

0 Kudos
Message 9 of 37
(12,079 Views)

Hello RavensFan,

 

What does timeout error 6101 mean?

 

Here is what I have tried;

I clicked on the "MB Serial Init VI", input the settings of my usb-RS485 adapter then clicked run, I think this ran fine because of the green check mark in the error out box.

 

I then clicked on the "MB Serial Master Query Read Holding Registers (poly) VI" and inputted the settings below, I got an error message.

 

Do I need to use the error out code from MB Serial Init Vi in order to get the read holding registers to work? I tried to put that code in the error in and it didn't work.

Capture.PNG

Thank you,

 

-Kevin

0 Kudos
Message 10 of 37
(12,044 Views)