Siemens#Connect to S71200(Adapter) TwinCAT(Scanner)by using EthernetIP

EtherNet/IP?

In Normal, Siemens families are using Profinet for real-time communication,but you can also use other industrial protocols in the same channel.For Example EthernetIP.

EthernetIP is an IEE802.3 base Protocol and is integrated with TCP and UDP technology.

EthernetIP is managed by the ODVA Community.

There are two types of devices named Scanner and Adapter.

Scanner is the device to scan all the devices in the network, and collect or write the device to the Adapter.

Adapter is the device that provides

After the connection between Scanner and Adapter is established, they will use UDP to exchange the IO Data.

Originator:The device for initiating the connection.

Target:The device to accept the connections.

Siemens provided a Function Block named “LCCF_EnetAdapter” to implement the adapter function for the Siemens CPU.This time we will use the S7-1200 as Adapter.

The Example from Siemens’s Manaul, uses other Siemens PLC in Adapter Side and Scanner. But in this Example I will configure the Scanner as with TwinCAT3+TF6281 as a Scanner.


Topology Setup

Line Topology

This is the most simple onn but not good for Network debugging.

Star Topology

Star Topology is implemented by a network switch and we can use wireshark/Port Mirroring/Port spawning in this configuration.

Library

https://support.industry.siemens.com/cs/document/109782315/ethernet-ip-adapter-connecting-third-party-control-systems-to-simatic-s7-controllers-via-ethernet-ip?dti=0&lc=en-DE

  1. Download the Library.
  2. Download the Example  with your TIA Version
  3. Download the Library with your TIA Version
  4. Download the S7-1200,S7-1500 EDS File.

Unzip your library.

Open your TIA Software and import your library by Global libraries>Right click>Open library.

Choose the Files of type as Compressed libraries.

Select LCCF_EnetAdapter.zal1x and Open it.

Choose the directory that you would like to extract.

You can see the library shown in the TIA Global libraries.


Function Block

Input

enableboolPulse Up Edge=Start Pulse Down Edge=Stop
interfaceHW_ANYThe CPU interface that communicates with Scanner
endiannessboolTrue=BigEndianFalse=Little Endian
inputAssemblyUintT->O Assembly ID
Default=101
outputAssemblyUintO->T Assembly IDDefault=102
configAssemblyUintO->TAssembly IDDefault=104
adapterNameString[32]Adapter Name’s Name
adapterIPAddrIP_V4Adapter’s IP

InOut

inputsvariantScannerのInput Area
outputsvariantScannerのOutput Area
configurationvariant


Output

validbool1=Communicating
busybool1=Busy
errorbool1=Error
statuswordCurrent status of Block
actUpdIntervalOuttimeThe Cycle time that receives data from the Scanner.
actUpdIntervalIntimeThe Cycle time that sends data to the Scanner.
diagnosticsLCCF_typeAdaptDiagError information

TIA Side

Import the Function Block

Open your Global libraries >S71200 and choose LCCF_EnetAdapter.

Add a Cyclic interrupt OB30 inside your program and set the update time as 100ms.

Drop the Function Block inside OB30.

Create a DB instance for this function block.

Finished!

You can see a small icon in the Function Block

While the icon is clicked, the hidden parameters are shown.

DB Insert

Now we need to Add the DB for data exchange.

Define 3 arrays with 64 bytes.

Assignment

Assign the variables defined before in the DB to the parameters Inputs/outputs/configuration.

And Also the Enable signal.

TwinCAT Side

Now we need to configure the TwinCAT Side.Please reference the follow link to configure TwinCAT as a IP Scanner.

Beckhoff#TwinCAT3 Using TF6281 Configure An Ethernet/IP Scanner

EDS

Import the EDS Files that were downloaded from Siemens Website before, and import to TwinCAT.

Insert the Variables

As mentioned before, TwinCAT will not update the variable value until you assign and use it in the user program.


Implement

We configured the network lke this.


Test

Download the project on both TwinCAT and Siemens.

Click the State in the TwinCAT.

0x0000 is displayed while communication is OK.

TIA Output

Let’s input 123 into a register.

You can see 123 is transferred from Siemens CPU.

TwinCAT Output

This time we will input some values from TwinCAT.

Siemens can receive the data from TwinCAT.

Footer_Basic

Please Support some devices for my blog

Amazon Gift List

Find ME

Twitter:@3threes2
Email:soup01threes*gmail.com (* to @)
YoutubeChannel:https://www.youtube.com/channel/UCQ3CHGAIXZAbeOC_9mjQiWQ

シェアする

  • このエントリーをはてなブックマークに追加

フォローする