Blog

AICover

Using a Siemens PLC to Communicate with an EtherNet/IP Device

Overview:

Although Siemens PLCs do not natively support EtherNet/IP communication, they possess the capability with a few extended programming instructions and a free-to-use library provided by Siemens. (see download links below) Unlike with a standard ProfiNet connection, the configuration will exist entirely within the PLC code, working around the limitation of the device and network editor. Below we will look into how to set up import the library, setup the configuration, and test communication with an EtherNet/IP device.

Physical Connections:

In this example, we will be using a Siemens fifteen-hundred series PLC as the EtherNet/IP Scanner and an S7-1200 PLC to simulate an EtherNet/IP device. Although we are using Siemens PLCs the twelve-hundred series PLC could represent a variety of devices ranging from variable frequency drives, pneumatic air manifolds, to Allen-Bradley PLCs. The devices should be connected like any other network device into one of the RJ45 port of the Siemens PLC. Each device should maintain a static and unique IP address and all devices should be reachable within an appropriate subnet. In this example our Siemens EtherNet/IP Scanner (S7-1500) will be set to an IP address of 192.168.1.1 and our field devices will be set to an IP address of 192.168.1.2. Both devices will have the /24 (255.255.255.0) subnet to permit communication between themselves.

Importing Libraries

After downloading a copy of the LCCF_EnetScanner library from the Siemens website (see below) you should have a single .ZIP file. Extract the contents of the archive and open the desired TIA version. (The oldest supported version of TIA for this library is 15.1).

Opening a global Library:

  1. Select the Library tab in TIA
  2. Select the open global library icon
  3. Change the file type to Compressed libraries
  4. Navigate and select the .ZAL17 file
  5. Select “Open”

Instantiating Function Blocks

Using TIA’s click and drag feature you can drag desired function blocks from the library to the project tree. For our EtherNet/IP scanner PLC, we should be using the function block labeled, “LCCF_EnetScanner.” After dragging the function into the project all necessary data types should copy themselves as well. You should notice that there are separate functions for each series of PLC 

Recommended Blocks:

  • It is recommended that you use a cyclic interrupt to call the EtherNet/IP scanner function.  This is because the function is quite resource-heavy and will most likely need to be called faster than the normal cycle time of the PLC to establish a connection without timing out.
  • Siemens OBs (organization blocks) do not have instance memory. As a result, when calling the LCCF_EnetScanner function you will need an instance data block.
  • Another global data is also required. This data block will contain the adapter configuration type and a data buffer for the transferred data to populate.

Configuring Connections:

Inside your global data block, you will need to create two separate tags shown below. The tags will be an array of their respective data type where the size of the array corresponds with the number of devices you would like to connect to. For example, if you had three EtherNet/IP devices your array would be of size three. (array [0..2] of xxxxx)

  • adapters – data type “Array[0..X] of LCCF_tpyEnetAdaptConfig”
  • data – data type “Array[0..X] of LCCF_tpyEnetAdaptData”

The tag, “adapters” will contain the configuration for each ethernet device. Below is a description of what each tag is referencing followed by an example of a fully configured adapter. It is worth noting that you should have an EDS (electronic data sheet) file for your EtherNet/IP device provided by the manufacturer. 

  • ADDR – The IP address of the EtherNet/IP device you wish to connect to.
  • vendorIdentifier – ODVA assigned Vendor ID (from EDS files)
  • productType – ODVA assigned ProductType number (from EDS files)
  • productCode – ODVA assigned ProductCode (from EDS files)
  • revisionMajor – Major Revision (from EDS file)
  • revisionMinor – Minor Revision (from EdS file)
  • assemblyInstance – Instance the Assembly can be reached at (from EDS file)
  • packetInterval – Requested Packet Interval/ Update Rate
  • conPointOutputIdentifier – Connection Point Identifier O->T direction
  • conPointOutputSize – [Bytes] Connection Point Size in Bytes O->T direction
  • conPointInputIdentifier – Connection Point Identifier T->O direction
  • conPointInputSize – [Bytes] Connection Point Size in Bytes O->T direction
  • configDataSize – [Bytes] Configuration data size of the assembly instance

Ladder Logic Programing:

The program should be relatively simple once the adapter and data tags are created. First, you will need to call the LCCF_EnetScanner function inside of your cyclic interrupt OB and then link the corresponding tags to the inputs and output of the function. An example will be shown below. The enable input can always be set, to “True” if communication needs to be active whenever the PLC is running. The interface ID is a system constant that is created when your PLC is brought into your project. (Usually 64 for interface 1 and 65 for interface 2)

With your function block set up in this way, you should be able to interface with your EtherNet/IP devices through the datas[] tag. Each index of this tag will have an input, output, and configs area. The inputs can be treated as “%I” tags and the outputs can be treated as “%Q” tags. The configs area contains important information about the port diagnostics and the communication status.

Another peculiarity to take note of is the endian of the data you are transmitting. Usually, EtherNet/IP devices are configured to use little-endian while Siemens PLCs use big-endian. Fortunately with the Siemens instruction, swap, move_blk, scatter, and gather. you should be able to convert the array of words into any data type.

References and Links:

Siemens AG. (2024). EtherNet/IP Scanner – Connecting third party I/O’s using EtherNet/IP. Retrieved from

https://support.industry.siemens.com/cs/document/109782314/ethernet-ip-scanner-%E2%80%93-connecting-third-party-i-o%E2%80%99s-using-ethernet-ip?dti=0&lc=en-WW

Library and Example Projects: Link

Share this post

Leave A Comment

Let's work together to solve your automation problem

Call 480-900-2170