11-13-2013 04:07 PM
I am trying to set up a master/slave configuration between two PCs using the modbus protocol. I created a modbus serial master IO server on the first computer and a serial slave IO on the other one and I connect the two computers COM ports with a serial cable. But it seems there is no communication between the master and slave applications. When I setup the IO servers on each side, LabVIEW doesn't ask for the other side's address. How is it supposed to communicate? Is there a way to tell the master IO server the address of the slave?
11-13-2013 05:04 PM
Apologies I can't open your project.
Here is what I see when I mock one up.
Is it possible that you have selected modbus ethernet (TCP/IP) instead?
Modbus TCPIP is a different Beast.
The Slave doesn't need to know who it's talking to, it just needs to respond to whomever is asking.
In theory it can have multiple masters..
11-13-2013 05:15 PM
Timmar, Thanks. I did do that. But the address in your picture is used to specify the server's own address. How about specifying the address of the remote server so that it can connect to it?
11-13-2013 07:00 PM
The Master and Slave addresses need to be the same, I think this is so you can multi-drop modules on the same bus.
In my example it is 1 on the Master and 1 on the Slave, so - Connect!
Since it is Com port to com port there is no need for additional addressing.
When I have problems like this (and I do often) I go back to first principles.
Does the comms link work in both directions?
Use hyperterminal or something similar, (I have written my own in labview that allows me to read and write from alll com ports on any device).
Maybe try putting the master and slave on the same PC on different com ports and doing a loopback between com 1 and 2.
Once you have established this it is then up to labview.
The libraries must first be deployed (not sure if you need a DSC licence for Modbus on a PC, it might be worth a look).
Check your modbus addresses match
Attached is real world variable
I have had problems in the past were rebooting the target hardware allowed the modbus library start to communicate.
[This may have been coincidental but worth a try]
Good Luck
11-14-2013 06:38 PM
Ok. I tried creating a Master IO server and a Slave IO server on the same PC. one of them tied to COM3 and the other to COM5. I gave them the same address "1". Still can't get a connection. I even tried to look at the output of the com port on another computer with a terminal program. Nothing coming at the other end.
11-14-2013 07:22 PM - edited 11-14-2013 07:26 PM
Did you check your Comms Cable?
95 percent of my problems have been cabling or Blown Comms Ports.
I am assuming you are using a Null Modem.
Did you check bidirectional Comms On it.
Have you successfully deployed the libraries )Right Click on library Deploy) make sure you see the messages,
If it doesn't Deploy Clean it won't work.
I assume you are sending Data into the system as well? Look at the error messages coming from the Shared Variable node, They can help
11-14-2013 11:48 PM
I don't think you should be giving each server the same address. Each device should have a different address.
11-15-2013 01:54 AM
Ravens Fan,
It is a Master/Slave pairing. They need to have the same address. I use serial Modbus on a daily bassis, they just don't work if they aren't the same.
On the other hand if you have 2 masters or 2 slaves that won't work.
11-15-2013 09:17 AM
The master will have a different address from the slave. A master can have multiple slaves and obviously each slave can't have the same address, otherwise there would be confusion. You cannot have multiple masters because they would likely interfere with each other if they are both trying to communicate at the same time and each would get responses back that were requested by the other master.
Now if you tell me that the address setting for the master's dialog box is the setting so that the server know which slave address it is trying to communicate with to get a particular register of data, and NOT the address of the master itself, then I'll agree with you that the address needs to match.
11-15-2013 12:01 PM
Do you guys have any example code using the modbus serial IO server? Or do you know any step by step tutorial on how to setup my shared variables? The only thing I could find online is how to setup the servers and that's it.