11-17-2013 06:28 PM
Attached is Actual code that I use on an actual site and in an actual simulation.
I have given an example on how to configure a modbus variable in an earlier post, use it as a template.
Pay special attention to the target,library and modbus i/o server names.
Potential trap is forgetting to change the server name on the slave:
MasterController\beltweigher.lvlib\ModbusMaster\400370
Simulator\beltweigherSlave.lvlib\ModbusSlave\400370
Sorry Ravens Fan, I am calling shenanigans on your analisis, Real world Trumps Theory.
PS, There are are unresolved bugs (feature deficiencies) in the Labview modbus Library that limits it's functionality. See Here
If you were talking about LIN I would agree with you. In this case, this isn't how NI have implimented it.
If you get the addresses wrong, it just doesn't work, period.
Lecture:
From the Topology diagrams,
There can only be a single master device but allows for multiple slave devices.
With the exception of an interrupt frame, The maser does all the talking.
You can (should be able to) set up mulpultiple "master servers" on the 1 master controller (addr 1= test, addr 99 = beltweigher, addr 81 = Site PLC)
Each will have it's own .lvlib file and talk to a discrete slave .
11-17-2013 07:21 PM
I noticed you have your controller and simulator appearing in the project explorer and they have ip addresses. Do I have to have a third PC connected by ethernet to both PCs that I want to run as master and slave? Even though the master and slave have a strictly serial RS-232 connection?
11-17-2013 08:17 PM
@Timmar wrote:
Sorry Ravens Fan, I am calling shenanigans on your analysis, Real world Trumps Theory.
PS, There are are unresolved bugs (feature deficiencies) in the Labview modbus Library that limits it's functionality. See Here
If you were talking about LIN I would agree with you. In this case, this isn't how NI have implemented it.
I do work in the real world.
I use the LabVIEW modbus library. Found here. NI Modbus Library for LabVIEW There are claims that there are problems with the library. But those have never affected me.
I have never had the need to use the Modbus IO server where you set up servers and libraries that you show in your screen shots. Why? I work with real world modbus slave devices, not "simulated' LabVIEW devices. I prefer using the modbus library because I can see what the bytes are being using in the communication process. I'm not relying on a bunch of behind the scenes communications to get things to work. I can control when the slaved device is being queried and at which registers.
A master cannot have the same address as the slave. It's a fact. Actually, I'm not sure a master necessarily even has to have an address. A device only needs an address if other devices are going to directly send messages to it rather than just responding to messages requests.
Now in your diagrams, you have two different configuration screens. One is the modbus I/O server that says "I am going to talk to address 99". The other is the Modbus Slave I/O Server which says "I am address 99". That's why they both need the same number written in that field in order to work.
I suggest if you want to learn about Modbus in the real world, look at the modbus organization's documents at http://www.modbus.org/tech.php. Or at least open up the wikipedia page at http://en.wikipedia.org/wiki/Modbus.
As for "LIN", are you talking about http://en.wikipedia.org/wiki/Local_Interconnect_Network? That has nothing to do with modbus.
11-17-2013 09:06 PM
Ravensfan:
This debate probably comes down to terminology used in the simplified method.
Change the phrase "Master address" to "Target Slave Address" and this debate never happened.
It is still stored in the same location I indicated and is still essential that it is the same for both nodes for it to work.
You are right, the master doesn't need to have an address per-se, but it needs to know the address of the slave that it is retrieving data from.
Apologies for bringing your real world use into question. By real world I meant the warped world that Labview expects us to use,
It appears that you don't like/trust/rely on it anyway, this I fully understand and respect.
The guys at NI have gone to great lengths to make it so that we don't have to understand Modicon's (Now Schneider) 's protocol.
Many users are happily oblivious to the intricacies.
That said, if you aren't using the simple "out of the box" labview methods you are less likely to know how to set one up.
In an industrial environment it is not always possible to access the target device during software development in the office.
I use a Simulation. This allows me to fully test and comission my code long before I get to site. I can also inject faults and test corner cases that are impossible to safely create.
In this example, I am connecting to a 3rd party device, it's address of "99" is programmed using it's user interface and it is located 1,700 km's away.
My working example shows a simple method to setup both sides of a network.
----
If I have 2 of these slave devices on the same network each with the same, fixed modbus addesses (400370), without a Target Slave address, there is no way to differentiate between the two devices.
---
LIN is a 1/2 duplex Master-Slave protocol that uses Frame ID's to address the LIN slaves. The master also has an ID (Usualy Zero) and a slave can be configured not to respond unless it is correct.
11-17-2013 09:21 PM
I use PXI R/T devices for my targets.
I use 1 as Master, the other as simulated slave.
I have never had to set up a PC as a Modbus Master/Slave, that is why I suggested that you check the licensing requirements for a PC.
Histoicaly I have been told that you need a DSC licence to use it on a PC, it is built-in to the RT versions.
I am not sure if it is, or was ever the case and why I suggested that you looked into this.
The Tutorial suggests that you need it
Requirements
I haven't been able to open your project (it's in 2013), Does it use RavensFan's Programatic method or the Shared variable library approach in the tutorial?
Tim L.