News:

  • May 01, 2026, 03:20:50 PM

Login with username, password and session length

Author Topic: Modbus TCP  (Read 24315 times)

malcolm58

  • Newbie
  • *
  • Posts: 5
Modbus TCP
« on: September 29, 2008, 02:24:51 PM »
I am attempting to use a DL 06 with an HO ECOM 100 to communicate with two scales through a Linksys 5 port switch. It appears that Modbuss protocol is supported in direct soft 5. The Weight-tronix scales also support Modbuss protocol, Profibuss and devicenet. Do you have any information that would help me learn how to use Modbuss in the DS5?

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: Modbus TCP
« Reply #1 on: October 03, 2008, 04:51:34 PM »
Hey malcolm58,

Sorry for such a long delay in responding.  :(

The H0-ECOM100 can be both a client (master) and server (slave) using Modbus TCP. It communicates over TCP Port # 502. Basically, if you want the H0-ECOM100 to be the slave, you simply need to know what FCs it supports and how the Modbus Addresses maps to internal V-memory of the DL06. To see this mapping study this file:

http://www.hosteng.com/FAQFiles/ECOM100%20Server%20Client%20Mapping.pdf

If you want the H0-ECOM100 to be the master, then you not only have to know the mapping above, but you will have to use NetEdit (free tool that comes with DirectSOFT), and create a Peer-to-Peer configuration to each slave. Then use RX/WX (or ECRX/ECWX IBox) instructions in your ladders. This requires a bit more in-depth understanding and programming, so if that is what you want to do, let me know and I'll give you the necessary details.
« Last Edit: October 03, 2008, 04:53:51 PM by Greg »
There are two types of people in the world; those that can extrapolate from incomplete data sets.

malcolm58

  • Newbie
  • *
  • Posts: 5
Re: Modbus TCP
« Reply #2 on: October 08, 2008, 07:09:50 PM »
Greg,
I think?? I need to use the HO-ECOM100 as a master. I want to write a request for weight from the DL06 to one of the two scales and read the response from that scale. I have NetEdit and ModScan32 installed on my computer. Do you have and example specific to the HO-ECOM?
Malcolm58

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3607
  • Darth Ladder
Re: Modbus TCP
« Reply #3 on: October 09, 2008, 01:44:51 AM »
If you want the H0-ECOM100 to be the master, then you not only have to know the mapping above, but you will have to use NetEdit (free tool that comes with DirectSOFT), and create a Peer-to-Peer configuration to each slave. Then use RX/WX (or ECRX/ECWX IBox) instructions in your ladders. This requires a bit more in-depth understanding and programming, so if that is what you want to do, let me know and I'll give you the necessary details.

Aruh?  Where does the NetEdit come in again?  Wouldn't you just have to know the register mapping in the slaves?  Also, am I to take it the 06 doesn't support MRX / MWX?
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3806
    • Host Engineering
Re: Modbus TCP
« Reply #4 on: October 09, 2008, 09:48:08 AM »
Aruh?  Where does the NetEdit come in again?  Wouldn't you just have to know the register mapping in the slaves?  Also, am I to take it the 06 doesn't support MRX / MWX?
MRX/MWX is for Modbus/RTU out the serial ports in an 06, not Modbus/TCP out an ECOM100.  For example, you need an IP address for Modbus/TCP - the MRX/MWX instruction only supports RTU Node Addresses (e.g. 1-247), not 192.168.12.5.

To get Modbus/TCP to work with the exisiting ECRX/ECWX NETRX/NETWX RX/WX instructions, you have to map the Node Number that is used in the network instruction to a specific IP Address (e.g. Node 4 is IP address 192.168.12.4).  This map exists in the ECOM100 and is entered using NetEdit.  You also have to do element address mapping from/to a DL PLC element address to/from a Modbus element address.

If you are using Modbus/RTU out the serial port, then yes, just use the MRX/MWX instructions, which are Modbus/RTU instructions.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3607
  • Darth Ladder
Re: Modbus TCP
« Reply #5 on: October 09, 2008, 11:57:35 AM »
Ah, got it.  I didn't think NetEdit was going to want to talk to the scales, so if it was anything it had to be in the ECOM.  I have an application where a 205 is being used as a serial Modbus master, with an ECOM which is a Modbus TCP slave to an MMI, so I remembered I was using MRX and MWX, and got the two mixed up.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3607
  • Darth Ladder
Re: Modbus TCP
« Reply #6 on: October 09, 2008, 12:02:56 PM »
You're right.  I see ECRX/WX only have a spot for a node number and not an IP, both of which are required to assemble the query.  Any idea why the Modbus guys designed the protocol to require both?  Seems redundant.  I guess you need the IP for the physical layer, like so switches will recognize the packet and know where to forward it, but then why the cardinal address?
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3806
    • Host Engineering
Re: Modbus TCP
« Reply #7 on: October 09, 2008, 02:05:41 PM »
You're right.  I see ECRX/WX only have a spot for a node number and not an IP, both of which are required to assemble the query.  Any idea why the Modbus guys designed the protocol to require both?  Seems redundant.  I guess you need the IP for the physical layer, like so switches will recognize the packet and know where to forward it, but then why the cardinal address?
Actually, the Node Number in the ECRX/WX instructions is for the lookup only.  The Node Number at the protocol level is 0 (maybe 255?).  Modbus/TCP supports 2 modes - point-to-point, and gateway.  Basically, if the Modbus/TCP Node Number is 0 (or 255?), it is point-to-point, i.e. the device is AT the IP Address.  If the Node Number is not 0 (nor 255), then you are actually talking to a Modbus/RTU TCP/IP gateway that will then forward the request to that RTU node number.  If your device is Modbus/TCP, then its node number is 0 (or 255?).  But there are Modbus/TCP gateway's with a bunch of serial ports hanging out the other end, where the Node Number is actually used to resolve the RTU address.

The Node Number used in the ECRX/WX instructions are just for the lookup in the Modbus/TCP table in the ECOM100 (e.g. Node 17 is IP Address 192.168.12.4)

I hope this is clear as mud (this time though, it's the Modbus people, not us ;D)

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: Modbus TCP
« Reply #8 on: October 10, 2008, 09:21:48 AM »
malcolm58,

You only have to make a NetEdit peer-to-peer configuration if the H0-ECOM100 is going to be the master. If the H0-ECOM100 is merely to be the Modbus TCP slave (and therefore never initiate communications), then no NetEdit peer-to-peer configuration is necessary.

Here's the way it works if ECOM100 is master.

Normally, using ECWX/ECRX, there is only a place to put "Slave ID". This is a number that can only be 0-255. Yet this is the only way that the DL PLC instruction has for addressing his communication partner. In other words, there is no place to put a TCP address. As you can see, it is impossible to refer to an IP Address with only 0-255 numbers available. This is why, in the ECOM100, you have make a peer-to-peer configuration. The configuration is so that when you do an ECWX/ECRX using a particular Slave ID (e.g. 4), then this number 4 can be mapped to a real IP Address. The 4 has no other meaning. In other words, the 4 doesn't go out on the network. It is merely a means for the ECWX/ECRX instruction to be able to address an entry in the peer-to-peer table and therefore a real IP Address of a slave. The slave could be another ECOM100, or a 3rd-party device.

Thus, when an ECWX/ECRX instruction executes naming, e.g. 4, as the Slave ID, then the ECOM100 hears the request, looks to see if he has an entry for 4 in his peer-to-peer table, and if he does, then he forms the packet into a Modbus TCP telegram using the IP Address named for the #4 entry in his configuration. What leaves the ECOM100 going out on the wire is merely a Modbus TCP telegram with that IP Address (the Slave ID is no longer needed and is not present in that telegram; i.e. it means nothing anymore).

If there were no peer-to-peer configuration in the ECOM100 at all, then when the ECWX/ECRX tried to use Slave ID 4, the ECOM100 would notice there is no entry in his peer-to-peer table for a #4, and therefore would realize that he needs to find out exactly who 4 is. Normal ECOM100 behavior for this would be to send out a broadcast telegram (that only other ECOM100s understand) onto the network querying for any ECOM100 on the network with a Module ID of 4. In this case, if there is another ECOM100 on the network that has his Module ID = 4 (i.e. either by his dipswitch setting, or software setting via NetEdit), then he will recognize the query broadcast, and answer back, "I'm #4". In this response will be that slave ECOM100's IP Address, and MAC Address. Now the master ECOM100 "knows" who 4 is. Knowing this, he can now talk directly to that device using his IP and MAC Addresses. In other words, the Slave ID of the ECWX/ECRX instruction, in this case, points directly to a Module ID of another ECOM100 on the network and has therefore has meaning on the network. But you can't use this method to talk to 3rd-party devices... only ECOM100s.

As far as an example goes, in your DirectSOFT5\Projects\Examples folder, there is a project called ECOM100_ECRX_ECWX_Help_Example. This isn't specific for Modbus TCP, but that doesn't matter. The only difference would be that for the Modbus TCP to work you would only have to have a peer-to-peer configuration corresponding to the Slave ID you use as I described above.

The document I named above also tells you how to address a particular Modbus Register you want to read/write from/to (e.g. an ECWX to V0 would cause the ECOM100 to send out an FC16 to Modbus Holding Register 1 [or 40001, depending on how you are used to referring to Modbus Addresses]).

Does this help?

I hope I haven't further muddied the waters!  :-\
There are two types of people in the world; those that can extrapolate from incomplete data sets.