73
SMLC Ethernet/IP Communications Tutorial

SMLC Ethernet/IP Communications Tutorial

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SMLC Ethernet/IP Communications Tutorial

SMLC Ethernet/IP Communications Tutorial

Page 2: SMLC Ethernet/IP Communications Tutorial

Overview

• This tutorial covers using Ethernet/IP to communicate between an SMLC and a Logix family PLC.

• There are two primary types of messages on an Ethernet/IP network: Connected and Unconnected.

• Connected messages occur between an Ethernet/IP “scanner” and an “adapter”. The Logix PLC is the scanner and the SMLC is the adapter. Connected messages are configured to take place continuously at a pre‐determined rate. Connections are automatically re‐established when either side is reset or power cycled.

• Unconnected messages can occur between any two devices on an Ethernet/IP network. Unconnected messages are asynchronous and are initiated in a Logix PLC using the MSG block. In the SMLC, the OrmEIP_SendUCM function block in the OrmLibEIPex library is used to send unconnected messages.

• Both Connected and Unconnected messages will access Assemblies in the SMLC. The SMLC allows you to create up to 50 assemblies that are either inputs or outputs. Assemblies can be BOOL, INT, DINT or REAL data.

• Assemblies are created in the SMLC’s PLC configuration. Each element of an assembly can be assigned a variable name for use in your program.

7/16/2008 2SMLC to Logix PLC Connectivity

Page 3: SMLC Ethernet/IP Communications Tutorial

Topics

1) Basic – establish connected messaging between a Logix PLC and the SMLC• You can configure the Logix PLC to connect to 1 input assembly and 1 output assembly in the SMLC. 

• The SMLC allows you to create up to 50 input and output assemblies of BOOL, INT, DINT and REAL but the Logix PLC can only connect to 1 input assembly and 1 output assembly. The input and output assemblies must be of the same data type

• In this tutorial we will exchange 40 INT inputs and 40 INT outputs.

• We will modify the example to exchange BOOL, DINT or REAL assemblies

• You can also “consume” additional SMLC REAL and DINT output assemblies via their tag name from within the LogixPLC

2) Intermediate – send unconnected read and write messages from a Logix program to the SMLC

• In this tutorial we use the MSG block in the Logix PLC to access other assemblies in the SMLC

• We will read and write BOOL, DINT and REAL data in the SMLC

3) Advanced  – send unconnected read and write messages from the SMLC to tag names in the Logix PLC

• In this tutorial we will use the OrmLibEIPAex and OrmLibEIPAint libraries to read and write individual tags in the LogixPLC.

• These tags can be of type BOOL, SINT, INT, DINT, REAL, STRING as well as certain user‐defined types

• The SMLC initiates these messages, independent of the Logix program.

7/16/2008 3SMLC to Logix PLC Connectivity

Page 4: SMLC Ethernet/IP Communications Tutorial

Enable Ethernet/IP in the SMLC’s PLC Configuration

7/16/2008 4SMLC to Logix PLC Connectivity

Page 5: SMLC Ethernet/IP Communications Tutorial

Right click on Ethernet I/O Adapter, select Append Sub‐element and Add 40 INT outputs. Note that we are adding the OUTPUTS first. 

7/16/2008 5SMLC to Logix PLC Connectivity

Page 6: SMLC Ethernet/IP Communications Tutorial

7/16/2008 6SMLC to Logix PLC Connectivity

Right click on Ethernet I/O Adapter, select Append Sub‐element and Add 40 INT inputs

Page 7: SMLC Ethernet/IP Communications Tutorial

Download the program to the SMLC, go the the PLC Browser and type eipa assemblies. We can see that assemblies 101 and 102 have been created. Each is 80 bytes long (40 INTs)

7/16/2008 7SMLC to Logix PLC Connectivity

Page 8: SMLC Ethernet/IP Communications Tutorial

Now we are going to configure the PLC using RSLogix 5000 

7/16/2008 8SMLC to Logix PLC Connectivity

1. Create a new PLC project. 2. In this tutorial we are using a CompactLogix L35E processor.3. Select New Module

Page 9: SMLC Ethernet/IP Communications Tutorial

Select the Generic Ethernet Module and press OK

7/16/2008 9SMLC to Logix PLC Connectivity

Page 10: SMLC Ethernet/IP Communications Tutorial

7/16/2008 10SMLC to Logix PLC Connectivity

1. Name the module SMLC2. Select the Comm Format: Data – INT3. The data type must match the data type of the assemblies in the SMLC.4. Set the IP Address of the SMLC to 192.168.0.253 (this is the default IP address of 

EN0 on the SMLC. Use a different address if you have already changed this on the SMLC).

5. Enter 101 for the Input assembly, size of 406. Enter 102 for the Output assembly, size of 407. Enter 3 for the Configuration assembly, size of 0 (the SMLC doesn’t use a 

configuration assembly

Page 11: SMLC Ethernet/IP Communications Tutorial

On the Connection tab, set the RPI, this is how often the connected data will be updated. Click OK and download the program to the the Logix PLC

7/16/2008 11SMLC to Logix PLC Connectivity

Page 12: SMLC Ethernet/IP Communications Tutorial

If we’ve entered everything correctly, when we go online we should see the Status: Running

7/16/2008 12SMLC to Logix PLC Connectivity

Page 13: SMLC Ethernet/IP Communications Tutorial

If you want to see what happens if the data we have entered is incorrect, go offline and enter an incorrect size in the Connection Parameters

7/16/2008 13SMLC to Logix PLC Connectivity

Page 14: SMLC Ethernet/IP Communications Tutorial

Now when we go online we see a Module Fault on the connection tab. Also there will be a yellow exclamation on the Ethernet Module

7/16/2008 14SMLC to Logix PLC Connectivity

Page 15: SMLC Ethernet/IP Communications Tutorial

Once the Logix PLC is correctly configured we go back to the PLC Browser in the SMLC and type eipa. It shows us that there is 1 active connection

7/16/2008 15SMLC to Logix PLC Connectivity

Page 16: SMLC Ethernet/IP Communications Tutorial

By typing eipa connected we can see the connection statistics.

7/16/2008 16SMLC to Logix PLC Connectivity

Page 17: SMLC Ethernet/IP Communications Tutorial

Look in the Controller Tags section in RSLogix 5000. We can see the SMLC assemblies as input and output data.

7/16/2008 17SMLC to Logix PLC Connectivity

Page 18: SMLC Ethernet/IP Communications Tutorial

Go to the PLC Configuration in the SMLC and enter a value for one of the outputs by clicking on the AT. In this example we enter 1234 in the 2nd INT register.

7/16/2008 18SMLC to Logix PLC Connectivity

Page 19: SMLC Ethernet/IP Communications Tutorial

Now look at the SMLC:I.Data[1] Controller tag in RSLogix and see the value you entered at the SMLC

7/16/2008 19SMLC to Logix PLC Connectivity

Page 20: SMLC Ethernet/IP Communications Tutorial

Now enter a value in SMLC:O.Data[0] in the PLC

7/16/2008 20SMLC to Logix PLC Connectivity

Page 21: SMLC Ethernet/IP Communications Tutorial

Go back to the SMLC’s PLC configuration and see the value you entered in the PLC.

7/16/2008 21SMLC to Logix PLC Connectivity

Page 22: SMLC Ethernet/IP Communications Tutorial

Using other data types – Adding more assemblies 

• Add some more assemblies to the SMLC’s PLC Configuration

7/16/2008 SMLC to Logix PLC Connectivity 22

Page 23: SMLC Ethernet/IP Communications Tutorial

Using other data types (BOOL)

• Assuming the assembly numbers from the page titled Using other data types – Adding more assemblies, here is how you would configure the Logix PLC for BOOL data

• Since there is no Comm Format for BOOL, select Data‐DINT. 

• Since the SMLC BOOL assemblies contain 32 bits, set the size to 1

7/16/2008 SMLC to Logix PLC Connectivity 23

Page 24: SMLC Ethernet/IP Communications Tutorial

Using other data types (REAL)

• Assuming the assembly numbers from the page titled Using other data types – Adding more assemblies, here is how you would configure the Logix PLC for REAL data

• Since the SMLC REAL assemblies contain 20 REALs, set the size to 20

7/16/2008 SMLC to Logix PLC Connectivity 24

Page 25: SMLC Ethernet/IP Communications Tutorial

Using other data types (DINT)

• Assuming the assembly numbers from the page titled Using other data types – Adding more assemblies, here is how you would configure the Logix PLC for DINT data

• Since the SMLC DINT assemblies contain 20 values, set the size to 20

7/16/2008 SMLC to Logix PLC Connectivity 25

Page 26: SMLC Ethernet/IP Communications Tutorial

Consuming SMLC output assemblies

• The Logix PLC allows us to consume SMLC output assemblies as connected data

• In order to connect to the SMLC’s output assemblies they must be assigned tag names in the SMLC’s PLC configuration. Here we assign the tag name a value of SMLCREALOutputs.

7/16/2008 SMLC to Logix PLC Connectivity 26

Page 27: SMLC Ethernet/IP Communications Tutorial

Consuming SMLC output assemblies

• Here we assign the tag name a value of SMLCDINTOutputs.

• Consumed assemblies can be either REAL or DINT.

7/16/2008 SMLC to Logix PLC Connectivity 27

Page 28: SMLC Ethernet/IP Communications Tutorial

Consuming SMLC output assemblies

• Go back to the Logix program and add a new Controller Tag

• Set the Data Type to REAL[20] to match the SMLC’s REAL output assembly 105

7/16/2008 SMLC to Logix PLC Connectivity 28

Page 29: SMLC Ethernet/IP Communications Tutorial

Consuming SMLC output assemblies

• Click on the Connection button and select SMLC as the producer

• Enter the same tag name you assigned in the SMLC’s PLC Configuration

7/16/2008 SMLC to Logix PLC Connectivity 29

Page 30: SMLC Ethernet/IP Communications Tutorial

Consuming SMLC output assemblies

• Add another Controller Tag

• Set the Data Type to DINT[20] to match the SMLC’s DINT output assembly 107

7/16/2008 SMLC to Logix PLC Connectivity 30

Page 31: SMLC Ethernet/IP Communications Tutorial

Consuming SMLC output assemblies

• Enter the same tag name you assigned in the SMLC’s PLC Configuration

7/16/2008 SMLC to Logix PLC Connectivity 31

Page 32: SMLC Ethernet/IP Communications Tutorial

Consuming SMLC output assemblies

• Go to the SMLC’s PLC Browser and type eipa connected. We can see that the SMLC REAL and DINT output assemblies are now connected.

7/16/2008 SMLC to Logix PLC Connectivity 32

Page 33: SMLC Ethernet/IP Communications Tutorial

This concludes the Basic section of the tutorial, to summarize:

• At this point you have learned how to establish connected messaging between a Logix PLC and the SMLC

• NOTE: once we’ve established the connection between the Logix PLC and the SMLC it doesn’t matter whether either program is running. The communications is occurring in the background automatically. The only way to stop the communication is to download a new program to either the SMLC or the Logix PLC. 

• One advantage of connected messages is they will automatically reestablish when either side is reset or power cycled.

• The Logix PLC can consume SMLC output assemblies. These assemblies can either be REAL or DINT arrays.

• How do we access the other assemblies that you can create in the SMLC? The answer is to use MSG blocks in the PLC program and this topic is covered in the next section of this tutorial.

7/16/2008 SMLC to Logix PLC Connectivity 33

Page 34: SMLC Ethernet/IP Communications Tutorial

Intermediate Topic: Using MSG blocks to perform unconnected Read/Writes to the SMLC

7/16/2008 34SMLC to Logix PLC Connectivity

• This section assumes that you have created the following assemblies in the SMLC PLC Configuration tab

Page 35: SMLC Ethernet/IP Communications Tutorial

Create data arrays in the Logix PLC to match the assemblies in the the SMLC

7/16/2008 35SMLC to Logix PLC Connectivity

• To match the 32‐bit BOOLEAN assemblies create two DINT tags

• To match the REAL assemblies create two REAL[20] tags

• To match the DINT assemblies create two DINT[20] tags

• If we wanted to use MSG blocks to access the SMLC INT assemblies we would create two INT[40] tags. Since we’re already accessing those via our connected messages we won’t do that now.

Page 36: SMLC Ethernet/IP Communications Tutorial

Create the tags for the MSG blocks

7/16/2008 36SMLC to Logix PLC Connectivity

Create a DINT tag called diJunk. We may need to use this in a later step.

Page 37: SMLC Ethernet/IP Communications Tutorial

Now insert a MSG block into the Logix PLC program, we’ll start with reading the SMLC’s boolean outputs

7/16/2008 37SMLC to Logix PLC Connectivity

Click on the          to open up the MSG box configuration dialog

Page 38: SMLC Ethernet/IP Communications Tutorial

There are several values to enter here and all of them are critical

7/16/2008 38SMLC to Logix PLC Connectivity

• Pick CIP Generic for the Message Type

• Pick Get Attribute Single for the Service Type

• Set the Class to 4

• Set the Instance to 103 (this is the assembly number in the SMLC)

• Set the Attribute to 3

• If the Source Element is NOT grayed out then set it to diJunk, this is the DINT tag we created just for this purpose. A Read shouldn’t require a Source Element but sometimes RSLogix 16.0 insists on it.

• If you had to enter the Source Element to diJunk, then set the Source Length to 4, otherwise leave it at 0

• Set the Destination to the DINT variable we created to store the SMLC’s 32 output bit assembly – SMLC_BOOLout

Page 39: SMLC Ethernet/IP Communications Tutorial

Set the communication path by either typing in the name of the SMLC node or by browsing. The Communication Method should be CIP.

7/16/2008 39SMLC to Logix PLC Connectivity

Page 40: SMLC Ethernet/IP Communications Tutorial

Download the program to the Logix PLC and switch to run mode

7/16/2008 40SMLC to Logix PLC Connectivity

• Turn on the bDoRead contact

• You should see the DN bit come on. If the ER bit comes on, open the MSG block to see the error code.

• If you want the message to occur continuously use the EN output as shown

Page 41: SMLC Ethernet/IP Communications Tutorial

If you decide to execute the MSG continuously you should cache the connection by checking the Connected and Cache Connections checkboxes on the Communication tab of the MSG block.

7/16/2008 41SMLC to Logix PLC Connectivity

• WARNING: continuous messaging will negatively affect the scan time of your Logix PLC! Refer to your PLC documentation for more details.

Page 42: SMLC Ethernet/IP Communications Tutorial

Next we’ll create the MSG blocks writing to the SMLC’s BOOLEAN inputs

7/16/2008 42SMLC to Logix PLC Connectivity

• The only differences here are:

• The Service Type is now Set Attribute Single

• The Instance needs to be 104 because that is the assembly number in the SMLC of the 32 BOOLEAN inputs

• The Source Element is now the array in the Logix PLC program that will hold the data that we are going to write to the SMLC. Recall that we stored it in a single DINT called SMLC_BOOLin. A DINT has a Source Length of 4 bytes

• Remember to set the Path on the Communication tab to SMLC!

Page 43: SMLC Ethernet/IP Communications Tutorial

Download the program to the Logix PLC and turn on the bDoRead and bDoWrite bits

7/16/2008 43SMLC to Logix PLC Connectivity

• By turning on the output bits in the SMLC’s PLC Configuration we can see the bits turn on in the Logix PLC

Page 44: SMLC Ethernet/IP Communications Tutorial

Likewise, turning on the bits in the Logix PLC we can see them in the SMLC’s PLC Configuration

7/16/2008 44SMLC to Logix PLC Connectivity

Page 45: SMLC Ethernet/IP Communications Tutorial

Enter and configure the MSG blocks for reading and writing the REAL assemblies

7/16/2008 45SMLC to Logix PLC Connectivity

• Note that for the Set Attribute Single Source Length is in bytes (20 REALs = 80 bytes)

• Remember to set the Path on the Communications tab to SMLC!

Page 46: SMLC Ethernet/IP Communications Tutorial

Enter and configure the MSG blocks for reading and writing the DINT assemblies

7/16/2008 46SMLC to Logix PLC Connectivity

• Note that for the Set Attribute Single Source Length is in bytes (20 REALs = 80 bytes)

• Remember to set the Path on the Communications tab to SMLC!

Page 47: SMLC Ethernet/IP Communications Tutorial

Here’s a screen shot showing all unconnected reads/writes working correctly

7/16/2008 47SMLC to Logix PLC Connectivity

Page 48: SMLC Ethernet/IP Communications Tutorial

This concludes the Intermediate tutorial on using MSG blocks to read/write SMLC assemblies

7/16/2008 48SMLC to Logix PLC Connectivity

• Troubleshooting tips if you are getting errors in your MSG blocks

– Make sure the Path is correct on the communication tab

– Make sure the Instance is set to the SMLC’s Assembly Number. Recall that the first assembly added to the SMLC’s PLC Configuration is 101, the 2nd is 102, the 3rd is 103 and so on. The SMLC supports up to 50 assemblies.

– If it’s a Write, make sure the Source Length is correct.

– Make sure the Message type is CIP Generic

– Make sure you are using Get Attribute Single for a Read or Set Attribute Single for a Write

– Make sure you are using 4 for the Class and 3 for the Attribute

• You can improve the performance of unconnected CIP messages in the Logix PLC by caching the connection (leaving the connection open)

• The SMLC can also receive legacy PCCC messages from PLC‐5 and SLC‐500 PLCs with Ethernet interfaces. If you are using a Logix PLC do not use the PCCC messages to communicate with the SMLC, use the CIP Generic messages!

Page 49: SMLC Ethernet/IP Communications Tutorial

Advanced tutorial – sending unconnected messages from an SMLC to a Logix PLC

• An example program, SendUnconnectedMessage.pro is installed in \Program Files\3S Software\CoDeSys v2.3\Projects\ORMEC_Examples

• This program allows you to experiment with different unconnected messages

• There are many different types of unconnected messages. Probably the most useful is to read and write tags directly in the Logix PLC. That will be the focus of the remainder of this tutorial.

• The OrmLibEIPAint.lib library contains the OrmEIPA_ReadLogixTag and OrmEIPA_WriteLogixTag function blocks. These functions blocks use the OrmEIP_SendUCMfunction block in the OrmLibEIPAex.lib library to read and write tags in the Logix PLC.

• One of the advantage of sending unconnected messages from the SMLC is that there is no configuration required in the Logix for it to work. All you need is the communications path to the Logix PLC and the name of the tags you wish to access.

• When reading and writing user‐defined types (structures) you may only use supported data types.

• When reading and writing user‐defined types, the definitions in the SMLC must exactly matchthe definitions in the Logix PLC!

7/16/2008 49SMLC to Logix PLC Connectivity

Page 50: SMLC Ethernet/IP Communications Tutorial

Sending an unconnected write from an SMLC to a Logix PLC tag using OrmEIPA_SendUCM. This screens shot is from the visualization in SendUnconnectMessages.pro. In this example we write the hex value 0x04030201 to the Logix tag diJunk.

7/16/2008 50SMLC to Logix PLC Connectivity

Page 51: SMLC Ethernet/IP Communications Tutorial

Sending an unconnected read message from an SMLC to a Logix PLC using OrmEIPA_SendUCM. In this example from SendUnconnectMessages.pro we read the contents of the Logix tag diJunk.As use can see, if we had to use OrmEIPA_SendUCM to do all of our work it would be cumbersome. Fortunately there is the OrmEIPAint library!

7/16/2008 51SMLC to Logix PLC Connectivity

Page 52: SMLC Ethernet/IP Communications Tutorial

Introducing the OrmLibEIPAint library. This library contains two function blocks: EIPA_ReadLogixTag and EIPA_WriteLogix tag. These function blocks greatly simplify the reading and writing of tags in the Logix PLC from your SMLC program.

7/16/2008 52SMLC to Logix PLC Connectivity

Page 53: SMLC Ethernet/IP Communications Tutorial

Information common to the following examples

• The SMLC has an IP address of 192.168.0.253 on EN0 and Ethernet/IP support is enabled for that port.

• The Logix PLC is a CompactLogix L35E with an IP address of 192.168.0.1. The network path is thus 192.168.0.1,1,0

• We always pass the address (using ADR) and size (using SIZEOF) the SMLC variables into the function blocks. The function block uses this information to read/write the date from/to the SMLC variables.

7/16/2008 SMLC to Logix PLC Connectivity 53

Page 54: SMLC Ethernet/IP Communications Tutorial

Read examples: Reading the Logix BOOL tag bTestOut. In the SMLC program we are storing the result into the BOOL variable MyBOOLDataIn. Note that the DataType returned is LOGIX_BOOL.

7/16/2008 54SMLC to Logix PLC Connectivity

Page 55: SMLC Ethernet/IP Communications Tutorial

Read examples: Reading the Logix BOOL tag a_bTestOut which is an array of 32 BOOL values. In the SMLC program we are storing the result into the BOOL array variable MyBOOLArrayIn. Note that the DataType returned is LOGIX_BITARRAY. The Logix PLC automatically packs boolean arrays into bits in an array of bytes. The OrmEIPA function blocks deal with this and unpack the bits from the bit array into the SMLC’s BOOL array. In the SMLC MyBOOLArrayIn is declared as MyBOOLArrayIn: ARRAY[1..32] OF BOOL;

7/16/2008 55SMLC to Logix PLC Connectivity

Page 56: SMLC Ethernet/IP Communications Tutorial

Read examples: Here are examples of reading a single DINT tag and reading an array of 50 DINT values.  In the SMLC MyDintArrayIn is declared as MyDintArrayIn : ARRAY[1..50] OF DINT. Note how we set the Elements input to 50 when reading the array. You only need to use the Elements input when you are reading arrays.

7/16/2008 56SMLC to Logix PLC Connectivity

Page 57: SMLC Ethernet/IP Communications Tutorial

Read examples: reading single REAL and INT tags

7/16/2008 57SMLC to Logix PLC Connectivity

Page 58: SMLC Ethernet/IP Communications Tutorial

Read examples: Reading a STRING tag and reading an array of 5 STRING tags. 5 is the maximum number of STRINGs you can fit into a single Read/Write message. Once again note that Elements is set to the array dimension when reading an array of values.

7/16/2008 58SMLC to Logix PLC Connectivity

Page 59: SMLC Ethernet/IP Communications Tutorial

Write examples: Here we write a single BOOL tag and then an array of 32 BOOL values. Note how we use LOGIX_BITARRY as the DataType when writing the bit array!

7/16/2008 59SMLC to Logix PLC Connectivity

Page 60: SMLC Ethernet/IP Communications Tutorial

Write examples: Here we write a single DINT tag and an array of 50 DINT values.

7/16/2008 60SMLC to Logix PLC Connectivity

Page 61: SMLC Ethernet/IP Communications Tutorial

Write Examples: Here we write a single REAL tag and a single INT tag.

7/16/2008 61SMLC to Logix PLC Connectivity

Page 62: SMLC Ethernet/IP Communications Tutorial

Write Examples: Here we write a single STRING tag and an array of 5 STRING values.

7/16/2008 62SMLC to Logix PLC Connectivity

Page 63: SMLC Ethernet/IP Communications Tutorial

Rules for creating user‐defined types in the Logix PLC to read & write with unconnected messages

7/16/2008 63SMLC to Logix PLC Connectivity

1) Start with the smallest type2) Group like types together3) SINT variables must be created in groups of 4. Note that Logix does not support USINT or 

BYTE types. SINT is a signed 8‐bit value.4) INT variables must be created in groups of 2. Note that Logix does not support WORD or 

UINT types. INT is a signed 16‐bit values.5) DINT and REAL variables can be created in any number. Note that Logix does not support 

UDINT or DWORD types. DINT is a signed 32‐bit value.6) STRING variables should go last in the structure7) In the SMLC, Logix STRING variables are declared as type tLogixString. tLogixString is defined 

in OrmLibEIPAint.lib8) The maximum size of the data structure should not exceed 500 bytes

Page 64: SMLC Ethernet/IP Communications Tutorial

To demonstrate reading and writing user‐defined types with the function blocks, we create the  user‐defined type TestDataType in the Logix PLC. Note that we have 2 INT variables. If we needed 3 INT variables we should create 4, the total must be a multiple of 2.

7/16/2008 64SMLC to Logix PLC Connectivity

Page 65: SMLC Ethernet/IP Communications Tutorial

Next we create two Controller tags of type TestDataType.

7/16/2008 65SMLC to Logix PLC Connectivity

Page 66: SMLC Ethernet/IP Communications Tutorial

Next we create a 2nd user‐defined type: TestDataType2. This structure contains SINT (BYTE) variables which must be created in multiples of 4!

7/16/2008 66SMLC to Logix PLC Connectivity

Page 67: SMLC Ethernet/IP Communications Tutorial

Next we create two more Controller Tags of type TestDataType2

7/16/2008 67SMLC to Logix PLC Connectivity

Page 68: SMLC Ethernet/IP Communications Tutorial

In the SMLC we create identical structures to match the user‐defined data types. Note that the string variables are declared as tLogixString. Since the Logix stores strings in a different format than the SMLC we need to match that format.

7/16/2008 68SMLC to Logix PLC Connectivity

OrmLibEIPAint.lib contains the type declaration for tLogixString:

In our SMLC program we define some variables using the new data types

Page 69: SMLC Ethernet/IP Communications Tutorial

The OrmLibEIPAint.lib contains an enumeration for the Logix data types. The values match those used in the Logix PLC to identify different data types in unconnected messages. You will use these type values as an input to the Write function blocks to identify the type of information being transferred. This type value is returned by the Read function blocks and can be used to confirm the type read.

7/16/2008 69SMLC to Logix PLC Connectivity

OrmLibEIPAint.lib also contains a global constant that you will use to write Strings and String arrays.

Page 70: SMLC Ethernet/IP Communications Tutorial

Writing User‐defined types: Before you can write to a User‐defined type in the Logix PLC you need to know the Abbreviated Type Code of the user‐defined type. The easiest way to get this is to read the tag of the user‐defined type and the EIPA_ReadLogixTag function block will return the TypeCode for our use. So, in order to write to the Logix user‐defined tag udtMyDataOut, we first read it and pass the TypeCode (5552 in this example) to the EIPA_WriteLogixTag function block.

7/16/2008 70SMLC to Logix PLC Connectivity

Page 71: SMLC Ethernet/IP Communications Tutorial

Here we read the type code for udtMyDataOut2 before we write it to the Logix PLC

7/16/2008 SMLC to Logix PLC Connectivity 71

Page 72: SMLC Ethernet/IP Communications Tutorial

If you attempt to Write a User‐defined tag with an invalid TypeCode you get a “vendor specific error”.

7/16/2008 72SMLC to Logix PLC Connectivity

Page 73: SMLC Ethernet/IP Communications Tutorial

This concludes the SMLC to Logix PLC Connectivity tutorial

7/16/2008 SMLC to Logix PLC Connectivity 73