LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MODBUS

Hi,

      Iam fairly new to MODBUS protocol.I got one modbus library from forums and an example.From the tutorials I have learned that for Discrete input and Input Registers type of access is 'read only' and for coils and holding registers it is both read and write.But in the example attached below(both master and slave is attached) in the MB Ethernet example slave.vi in the array named 'Holding registers' it is not both read and write.Why it is like that?Please check the attached example.Pardon me if it is a stupid question.

0 Kudos
Message 1 of 10
(3,369 Views)

Can you please attach a file with all the VIs I tried to open the project before giving you an answer but it is impossible as there are VIs left. Smiley Wink

0 Kudos
Message 2 of 10
(3,364 Views)

Finally I've been able to open your project.. Smiley Happy

 

Looking at the code and trying to remember the Moodbus protocol, I believe that your question has more to do with the Modbus protocol than with the code. I'm not sure of if I have understood your question though. 

 

I think that when you say that Holding Registers are Write/Read, means that they allow you to perform both operations, but that does not mean that you have to define the action that you are to perform as Write/Read allways.

 

If you only want to read from a Holding register as I think the case is in the Slave example, you can set the action just as read. On the other hand, if you were to write in the Holding registers you could define you action as write.

 

I hope this helps. Smiley Wink

Message 3 of 10
(3,355 Views)

Thanks for the response.

One more question I want to ask is;While I studied modbus protocol,I learned that the Master/client is sending request to the slave/server and then only the slave will respond to that.But in the attached example, whatever changes we make in the slave part(that is entering some values in "Holding Registers (Master can write in these registers))" it is automatically going to the Master,without any request from the master.How it is happening?or is it the problem with what I understand the concepts?

Please help!Sorry for poor English.

0 Kudos
Message 4 of 10
(3,329 Views)

You failed to attach the example you are referring to.

0 Kudos
Message 5 of 10
(3,323 Views)

Hi RavensFan,

                      I already attached it in my first post of this thread.Anyway Iam attaching again.

0 Kudos
Message 6 of 10
(3,316 Views)

Hello jkuttu,

 

There is something that I don't understand in your question, you say that any change done in a holding register by the Slave affects to the Master, don't you??

But for me that makes sense as what you are doing when you write to a holding register is to modify the content of an address so obviously if the master accesses to that address after the change was done the value the Master read, should be the one that the Slave modified
.

 

So I don't really know if have understood your question, but if not, can you give me a longer explanation??

 

Regards

0 Kudos
Message 7 of 10
(3,289 Views)

You've only attached the project file, that's just a XML describing the files used. We need to see some files (.vi). 🙂

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 10
(3,277 Views)

Hi Yameda,

                  Inside the attached example there contains .lv files.And Iam unable to attach master and slave seperately.See the zipped file.

                  My question is:As per modbus concepts the slave only responds when master requests.But in the example given what ever we are entering inside "Input Registers (Master can only read these)" in slave it is automatically going to Master.Please respond.

0 Kudos
Message 9 of 10
(3,250 Views)

You still haven't attached anything useful.  You attached a zip file of your project file.  The project file only defines what files are grouped together.  It does not contain any actual .vi files.  If you look at the file size of 3 KB, wouldn't your agree that is too small to be anything?

 

And I still don't understand your question.

 

In most modbus applications, your PC is probably going to be the master, and you send requests and wait for responses from slaves.  The slaves tend to be things like hardware instruments or motor controllers that know how to respond to modbus requests.

 

The slave example that comes with the Modbus toolkit in LabVIEW is just a VI to simulate what a slave might do, so you can run your master VI and have something be able to respond in the event you don't have any real hardware to communicate with.

 

With that information, can you ask your question again more clearly?

0 Kudos
Message 10 of 10
(3,224 Views)