09-04-2012 03:58 AM
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.
09-04-2012 04:23 AM
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.
09-04-2012 05:00 AM
Finally I've been able to open your project..
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.
09-13-2012 07:20 AM - edited 09-13-2012 07:21 AM
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.
09-13-2012 08:31 AM
You failed to attach the example you are referring to.
09-13-2012 11:05 PM
Hi RavensFan,
I already attached it in my first post of this thread.Anyway Iam attaching again.
09-17-2012 01:19 AM
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
09-17-2012 05:28 AM
You've only attached the project file, that's just a XML describing the files used. We need to see some files (.vi). 🙂
/Y
09-17-2012 11:54 PM - edited 09-17-2012 11:55 PM
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.
09-18-2012 10:20 PM
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?