LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to a Single Register Using Modbus

Solved!
Go to solution

Hi,

I'm using the Modbus Library for LabVIEW 8.5,

I'm trying to control a system of motor drives by using LabVIEW as the master device.

I know the register address, slave address and all the other indentifying protocol for my devices, but I have no input on my block diagram for an actual value to write asides from these. How can I send a value to be written?

Thanks

0 Kudos
Message 1 of 8
(8,004 Views)

Hello Rolin,

 

In the Modbus Library that you downloaded, there is an example called MB Serial Master Example.vi. It should show how the write is performed in a simple 4 register write. Please check out the example and let us know if you have any other questions.

Cheers!

TJ G
0 Kudos
Message 2 of 8
(7,989 Views)

Thanks for the reply, I was using the example to guide me but I still have questions.

I'll be more specific about the application:

I'm trying to use ABB ACS 140 motor drives as slave devices with Modbus.

 

The literature on these drives and how they interface with Modbus is here: (http://www05.abb.com/global/scot/scot201.nsf/veritydisplay/3cb579871ec41124c1256d2800407872/$file/ad...)

 

In order to control them I'm trying to use the Modbus library for LabVIEW 8.5 in 'Write Single Register' mode.

 

I'm getting confused between all the Modbus terminology I've seen.

I've attached a .png of the basic idea behind my attempt to communicate with the drives.

 

My confusion arises between the terminal on the Modbus Master Serial Query terminals "Address" and "Holding Register"

Nowhere  in the ACS 140 literature does it mention an address asides from the slave address which is already specified in the Serial Parameters node.

And the Holding Register is describe in subroutines of this block as "Data" even though the Holding register in the ACS 140 manual seemed to indicated the register being written two, like a signal encyrption key telling the device what the signal means, but not actually representing the data itself.

 

What should my inputs be here and how do I write a specific signal to the slave device?

~Rolin

0 Kudos
Message 3 of 8
(7,977 Views)

All of the register addresses are listed starting on page 22 and the Modbus function codes are on page 23.

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

Thanks Dennis,

I understand that,

The function code (in this case six) was already specified when I selected "Write to a single register"

And the holding registers are all listed between 40001-40099

But the way I understand this to operate, is, for example, if I were to write to holding register 40002, the ext ref 1 area, I specify a frequency at which to run using LabVIEW

But I don't see how to do that using this Modbus library.

0 Kudos
Message 5 of 8
(7,966 Views)

The register value is the constant you have labeled as 'Holding Register'. You can look on the block diagram and see it's being written to a cluster element called 'Data'. It would have been nice if the programmer had added descriptions to all of the controls. I went through some of the same confusion a couple of weeks ago.

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

Dennis,

So the terminal labelled Holding Register that is where I would assign the desired frequency?
And is the 4xxxx register area wired to the terminal labelled "Address" ? (also held at constant zero in my attachment)

0 Kudos
Message 7 of 8
(7,957 Views)
Solution
Accepted by topic author Rolin

Yes, assuming you have specified the correct address and value for the register, that should work.

Message 8 of 8
(7,954 Views)