of 14 Communicate with a Rockwell ControlLogix PLC on

Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 1 of 14
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Ethernet/IP Communications
In-Sight Communications Reference
Overview
Implicit Messages
Explicit Messages
Overview
This topic describes how to transfer data between an In-Sight sensor and a ControlLogix or CompactLogix PLC on an Ethernet/IP network.
The examples in this topic were written assuming that you are using the following components:
 In-Sight sensor running firmware version 3.30.00 or higher
 ControlLogix or CompactLogix Controller running firmware version 15 or higher
 Rockwell's RSLogix 5000 programming software, version 15 or higher
 In-Sight Add-On Profile included with the In-Sight Software 3.4.2 or newer.
Implicit vs Explicit Messages
Implicit Messages transmit time-critical application specific I/O data, and can be point-to-point or multicast. Explicit messages require a
response from the receiving device. As a result, explicit messages are better suited for operations that occur less frequently. An
instruction to change an In-Sight Explorer job is an example of an explicit message.
Implicit Messages
This section explains how to connect a ControlLogix PLC to an In-Sight sensor (running firmware version 3.30.00 or higher), and how to
send and receive EtherNet/IP implicit messages.
 Establishing an Implicit Messaging Connection with a Single ControlLogix PLC
 Establishing a Multicast Implicit Messaging Connection with Multiple ControlLogix PLCs
 Getting Data From an In-Sight Sensor
 Sending Data To an In-Sight Sensor
EtherNet/IP implicit messaging allows an In-Sight sensor's inputs and outputs to be mapped into tags in the ControlLogix PLC. Once these
values are established, they are synchronized at an interval defined by the Requested Packet Interval (RPI).
The figure below represents Ethernet-based I/O through EtherNet/IP:
The EtherNet/IP Vision Object keeps track of the status of the various subsystems in the In-Sight Sensor, as well as the data that is
coming from, and going to the In-Sight Explorer Spreadsheet.
The Input Assembly and Output Assembly map various fields from the EtherNet/IP Vision Object: The Input Assembly is the collection of
In-Sight sensor data values sent to the PLC (PLC inputs); and the Output Assembly is the collection of data values received by the InSight sensor from the PLC (PLC outputs).
If there is an EtherNet/IP implicit messaging connection, then these values are updated on the client at the RPI. In conjunction, if the
client updates values across an EtherNet/IP implicit messaging connection, those changes will be reflected in the various In-Sight Sensor
subsystems, and the In-Sight Sensor will respond accordingly.
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 2 of 14
Establishing an Implicit Messaging Connection with a Single ControlLogix PLC
To setup an EtherNet/IP implicit messaging connection between an In-Sight sensor and a ControlLogix controller, the In-Sight sensor
must first be configured in the ControlLogix I/O Configuration tree. A Generic Ethernet Module must be added as an I/O device under the
node that corresponds to the Ethernet module in the rack.
To establish an implicit messaging connection with a single ControlLogix PLC:
1.
Open RSLogix 5000 and load the PLC's project.
Note: The PLC must be Offline to add connections in RSLogix 5000.
2.
Under the I/O Configuration node, select the Ethernet Node under the Ethernet Module, right-click on the icon and select New
Module from the menu:
3.
When the following dialog appears, select your model of In-Sight Vision System from the list. This option will appear once the AddOn Profile is installed from the In-Sight Software CD.
4.
After the selection is made, the configuration dialog for the In-Sight Vision system will be displayed:
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 3 of 14
The following fields need to be configured:
 Name: This is the name given to the generic EtherNet/IP device; the tags created in RSLogix 5000 will be based on
this name. It is recommended that the In-Sight sensor's name be used, to maintain consistency.
 IP Address: The IP address of the In-Sight sensor.
 Host Name: This setting is optional; only use this setting if there is a Domain Name Server (DNS) on the network.
5.
The Change button can be used to set the amount and type of data to be transferred between the In-Sight Vision System and the
PLC. Electronic Keying can also be enabled using this button.
6.
After accepting the general communication parameters, the next step in the configuration process is displayed in the figure below:
The following fields can be configured:
 Requested Packet Interval (RPI): This field specifies the Requested Packet Interval (RPI), which defines the
amount of time (in milliseconds) between data exchanges across an implicit messaging connection.
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 4 of 14
Note: Beginning in In-Sight firmware version 3.30.00, the RPI value no longer has to be longer than the job execution
time; implicit messaging connections now run asynchronous to the job execution. However, small RPI times (<5ms) may
negatively impact the performance of vision jobs. For best results, the RPI time should be set to no more than half the
time between when the In-Sight sensor completes the job execution and when the PLC requires the data.
 Inhibit Module: Checking this box prevents the PLC from attempting to establish a connection with an In-Sight
sensor.
 Major Fault On Controller If Connection Fails While in Run Mode: This option will cause the controller to
generate a major fault when the connection fails.
7.
After adding the module to ControlLogix, the I/O tree should appear as follows:
8.
RSLogix 5000 will then create tags that map to the In-Sight sensor's Input and Output Data, based on the name given to the
device, as shown below:
 InSight_Top:I Scheduled Input: The table below represents the data that is sent FROM the In-Sight sensor to the PLC:
 TriggerReady: Indicates when the In-Sight sensor can accept a new trigger. This field is true when
the sensor is Online, the Trigger Enable bit is set and the sensor is not currently acquiring an image.
 TriggerAck: Indicates when the In-Sight sensor has been triggered by setting the Trigger bit; this
bit will stay set until the Trigger bit is cleared.
 Acquiring: Set when the In-Sight sensor is currently acquiring an image; either by setting the
Trigger bit or by an external trigger.
 MissedAcq: Set when the In-Sight sensor misses an acquisition trigger; cleared when a successful
acquisition is triggered.
 OfflineReasonX: This field is a 3-bit field used to identify the reason why an In-Sight sensor is
Offline. The table below lists those reasons:
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Offline Reason
0
1
2
Name
Online
Programming
Discrete Offline
3
Comm. Offline
Page 5 of 14
Description
The sensor is Online.
The sensor's job is being modified.
a discrete signal is holding the sensor Offline.
A communications protocol is holding the sensor
Offline.
 Online: This bit is set when the In-Sight sensor is Online and cleared when the sensor is Offline.
When the sensor is Offline, examine the Offline Reason field to determine the reason.
 Inspecting: This bit is set when the In-Sight sensor is executing spreadsheet functions.
 InspectionCompleted: This bit is toggled on the completion of an inspection.
 ResultsBufferOverrun: This field is set when the Buffer Results Enable bit is set and the In-Sight
sensor has discarded a set of inspection results because the PLC has not acknowledged the results by
setting the Inspection Results Ack bit.
 ResultsValid: Set when the Inspection ID, Inspection Result and Inspection Results fields are valid.
 InspectionID: The acquisition ID associated with this set of results.
 InspectionResultCode: The pass/fail code that is associated with this set of results. This value
cannot be set and is always 0.
 InspectionResults: The inspection results set by the WriteEIPBuffer function in the In-Sight
Explorer spreadsheet.
 InSight_Top:O Scheduled Input: The table below represents the data sent TO the In-Sight sensor from the
EtherNet/IP client (ControlLogix):
 TriggerEnable: This field is set to enable triggering via the Trigger bit. Clear this field to disable the
EIP triggering mechanism.
 Trigger: Setting this bit triggers an acquisition when the following conditions are met:
 The In-Sight sensor is Online.
 The Trigger Enable bit is set.
 The AcquireImage function's Trigger parameter is set to Network or External.
 BufferResultsEnable: When this bit is set, the Inspection ID, Inspection Result and Inspection
Results fields are held constant until the Inspection Results Ack field has acknowledged them and
been set. The In-Sight sensor will respond to the acknowledgement by clearing the Results Valid bit.
Once the Inspection Results Ack field is cleared and there is a new set of rules sent to the PLC, the
Results Valid bit will no longer be cleared.
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 6 of 14
 InspectionResultsAck: When the Buffer Results Enable bit is set, the Inspection Results Ack bit
acknowledges that the PLC has received the Inspection ID, Inspection Result and Inspection Results
data.
 SetOffline: When this bit is set, the In-Sight sensor is taken Offline until the bit is cleared again.
 SoftEventX: Setting any of these bits causes the associated soft event in the In-Sight Explorer
spreadsheet to be triggered.
 UserData: This data is sent to the In-Sight Explorer spreadsheet via the ReadEIPBuffer function.
EXAMPLE: Setting Up a Connection
For I/O messaging, the In-Sight sensor has been added as an input/output device in a ControlLogix project. After this project is
downloaded to the controller, the I/O connection will be established (as is the case with other I/O devices - unless the Inhibit Module
checkbox is set to Offline). Once a successful connection has been established, cyclic data transfers will be initiated, at the requested RPI.
To verify a proper I/O connection, follow these steps:
1.
Working Offline, perform the ControlLogix configuration steps as outlined in Establishing an Implicit Messaging Connection with a
Single ControlLogix PLC.
2.
Download the project to the ControlLogix controller.
3.
Upon the completion of the download, the I/O device that corresponds to the In-Sight sensor should show no errors; this signifies
that the I/O connection has been completed successfully.
4.
To verify the correct, 2-way transfer of I/O data, connect to the In-Sight sensor via In-Sight Explorer. Open the AcquireImage
property sheet and set the Trigger parameter to Network; now place the sensor Online.
5.
In RSLogix, go to the controller tags and change the state of the TriggerEnable bit from 0 to 1, enabling triggering of acquisitions
over EtherNet/IP, as shown below:
6.
After this has been set, whenever the Trigger bit is changed from 0 to 1, the In-Sight sensor will acquire an image.
7.
After the inspection is completed, the InspectionCompleted toggle bit should change state, as shown below:
Establishing a Multicast Implicit Messaging Connection with Multiple ControlLogix PLCs
If you want to send inspection results to more than one PLC, you can establish a multicast implicit messaging connection. A multicast
connection allows all of the connected PLCs to consume data, but only one of the PLCs can produce data. To set up an EtherNet/IP implicit
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 7 of 14
messaging connection between an In-Sight sensor and a ControlLogix controller, the In-Sight sensor must first be configured in the
ControlLogix I/O Configuration tree.
To establish the multicast implicit messaging connection, for the first PLC:
1.
Follow steps 1-3 from the Establishing an Implicit Messaging Connection with a Single ControlLogix PLC section.
2.
In the General tab of the In-Sight Vision System configuration dialog:
 Connection must be set to "Input (Results Only)"
 The Input Results from Sensor size and data type must be identical for each connection.
 (Optional) If you want to write data from one of the PLCs to an In-Sight sensor, set Connection to Data (Bidirectional (for
the writing PLC only). Only one ControlLogix controller can write to an In-Sight sensor at a time.
3.
In the Connection tab of the In-Sight Vision System configuration dialog:
 RPI values must be the same for each In-Sight Sensor connection.
Getting Data from an In-Sight Sensor
In order to get data from the In-Sight Explorer spreadsheet to a ControlLogix PLC, the data must be pushed into the EtherNet/IP stack by
using the WriteEIPBuffer function. This function takes a buffer of data created by the FormatOutputBuffer function and writes it to the
data area in the In-Sight sensor's EtherNet/IP Input Assembly (input to the network). This data is then transferred to the PLC during the
next RPI cycle.
EXAMPLE: Getting 32 bit integer data from an In-Sight sensor
The following steps explain how to format the data that will be sent from an In-Sight sensor to a ControlLogix PLC.
1.
To begin, using In-Sight Explorer, create a new job.
2.
From the Palette's Snippets tab, add these two Snippets to the spreadsheet: Acquisition -> AcqCounter and Math & Logic ->
Random.
3.
Open the AcquireImage cell and set the Trigger parameter to Continuous.
4.
Right-click an empty cell and select Insert Function. From the left-side of the screen, expand the Input/Output category, click on
the Network subcategory and double-click on the FormatOutputBuffer function to insert it into the spreadsheet.
5.
From the FormatOutputBuffer dialog, click on the Add button. This will initiate the cell selection mode; select the "Scaled random
number" cell of the Random snippet.
6.
From the FormatOutputBuffer dialog, use the Data Type pull-down menu to change the Data Type to 32 bit integer.
7.
From the FormatOutputBuffer dialog, click on the Add button again. This will initiate cell selection mode; select the count cell of
the AcqCounter snippet.
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 8 of 14
8.
Close the FormatOutputBuffer by clicking the OK button.
9.
Right-click an empty cell and select Insert Function. From the left-side of the screen, expand the Input/Output category, click on
the Network subcategory and double-click on the WriteEIPBuffer function to insert it into the spreadsheet.
10.
Set the WriteEIPBuffer function's Buffer parameter as a cell reference to the just created FormatOutputBuffer
structure.
11.
Place the In-Sight sensor in Online mode.
12.
The data should now be displayed in the Controller -> Controller Tags node of RSLogix 5000.
data
Note: The RSLogix Monitor Tags tab must be selected in order to display the data values.
EXAMPLE: Getting floating point value data from an In-Sight sensor
If another data type, for instance a type other than the 32-bit integers type, or a mix of data types needs to be sent, the simplest method
to accomplish this is to create a User Defined Type in ControlLogix, and then to copy that data from the In-Sight sensor's input tag to the
newly created User Defined Type. The steps below illustrate how to copy two cells as floating point values:
1.
Place the In-Sight sensor Offline.
2.
Open the previously created FormatOutputBuffer function.
3.
From the FormatOutputBuffer dialog, use the Data Type pull-down menu to change the Data Type from 32 bit integer to 32 bit
floating point.
4.
Place the In-Sight sensor back Online.
5.
In RSLogix, go into Offline mode.
6.
Within RSLogix, right-click on the Data Types -> User-Defined folder and select New Data Type from the menu.
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
7.
Give the new data type a descriptive name and add two floating point values to the Members: list.
8.
Next, add a new tag to the project's Controller Tags, using the user defined data type.
9.
Finally, add a COP instruction to the MainRoutine ladder logic program, which will copy the data from the
InSight_Top:I.InspectionResults[0] tag to the InSight_Top_Input tag.
10.
Page 9 of 14
After this program has been downloaded to the ControlLogix PLC, the data from the Random and Acquisition Counter In-Sight
Explorer spreadsheet cells will now appear in the InSight_Top_Input tag in the floating point format:
Sending Data To an In-Sight Sensor
In order to send data from the ControlLogix PLC to the In-Sight Explorer spreadsheet, the data must be pulled from the EtherNet/IP stack
by using the ReadEIPBuffer function. This function takes the data format created within the FormatInputBuffer function and reads the
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 10 of 14
data from the data area of the EtherNet/IP Output Assembly (output from the network), and formats this data into the In-Sight Explorer
spreadsheet. This data is received from the PLC every RPI cycle; the corresponding spreadsheet data is updated only when the
spreadsheet executes.
EXAMPLE: Sending 32 bit integer data to an In-Sight sensor
For this example, create a new job within In-Sight Explorer, then perform the following steps to configure the data that will be received by
the ControlLogix PLC.
1.
Open the AcquireImage cell and set the Trigger parameter to Continuous.
2.
Right-click an empty cell and select Insert Function. From the left-side of the screen, expand the Input/Output category, click on
the Network subcategory and double-click on the FormatOutputBuffer function to insert it into the spreadsheet.
3.
From the FormatOutputBuffer dialog, click on the Add button and add two 32-bit integers to the list.
4.
Close the FormatOutputBuffer by clicking the OK button.
5.
Right-click an empty cell and select Insert Function. From the left-side of the screen, expand the Input/Output category, click on
the Network subcategory and double-click on the ReadEIPBuffer function to insert it into the spreadsheet.
6.
Set the ReadEIPBuffer function's Buffer parameter as a cell reference to the just created FormatOutputBuffer
structure.
7.
The Data Access functions will automatically be added to the spreadsheet based on the fields added to the FormatOutputBuffer
function.
8.
Place the In-Sight sensor in Online mode.
9.
Within RSLogix 5000, open the Controller Tags dialog and change the value of the InSight_Top:O.Data[1] and
InSight_Top:O.Data[2] tags. The values in the In-Sight Explorer spreadsheet should change, as well:
data
EXAMPLE: Sending floating point value data to an In-Sight sensor
If another data type, for instance a type other than the 32-bit integers type, or a mix of data types needs to be sent, the simplest method
to accomplish this is to create a User Defined Type in ControlLogix, and then to copy that data from the In-Sight sensor's output tag to
the newly created User Defined Type. The steps below illustrate how to copy to two cells as floating point values:
1.
In RSLogix, go into Offline mode.
2.
Within RSLogix, right-click on the User-Defined ->Data Types folder and select New Data Type... from the menu.
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 11 of 14
3.
Give the new data type a descriptive name and add two floating point values to the Members: list.
4.
Next, add a new tag to the project's Controller Tags, using the user defined data type, as shown in the example below.
5.
Finally, add a COP instruction to the MainRoutine ladder logic program, which will copy the data from the InSight_Top_Output
tag to the InSight_Top:O.Data[1] tag.
6.
Place the In-Sight sensor Offline.
7.
Open the previously created FormatInputBuffer function, and change the Data Type values of both to 32 bit floating point.
8.
Place the In-Sight sensor back Online.
9.
After this program has been downloaded to the ControlLogix PLC, the data in the InSight_Top_Output tag will now appear in the
floating point format:
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 12 of 14
Explicit Messages
Unlike implicit messages, explicit messages are sent to a specific device and that device always responds with a reply to that message. As
a result, explicit messages are better suited for operations that occur less frequently. Explicit messages can be used to read and write the
Attributes in the EtherNet/IP Vision Object of the In-Sight Vision System, which may be used for changing jobs, acquiring images, sending
Native Mode commands and retrieving result data.
Example: Change a Job
The most common explicit message sent to an In-Sight sensor from a ControlLogix PLC is an instruction to change a job. Explicit
messages are sent from a ControlLogix PLC using MSG instructions. The following steps show how to add a MSG instruction in RSLogix to
change a job on an In-Sight sensor:
1.
Add the following tags to the ControlLogix Controller Tags dialog:
2.
Create the following rung in the MainRoutine of your ControlLogix project:
This rung uses the Set Offline bit in the implicit connection to force the In-Sight sensor Offline, because the JobName
attribute of the Vision Object requires the In-Sight sensor to be Offline before it will change the job. The Set Offline bit
waits for the In-Sight sensor to bring the Online bit low, then sets up the data containing the new job name and sends the
MSG instruction to the In-Sight sensor. After the job change is completed, the falling edge of the TriggerSetJob tag will
cause the In-Sight sensor to go back Online.
3.
To setup the MSG instruction, click on the InSight_SetJobMsg … button. This will cause the Message Configuration dialog to
appear:
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 13 of 14
The following fields need to be configured:
 Message Type: This is the type of message that will be sent; choose CIP Generic to send a message to vendor
specific objects like the Vision Object.
 Service Type: This is the service code that will be sent to the object; select Set Attribute Single to change a single
attribute of the Vision Object.
 Service Code: This field allows any type of service to the object; this field is disabled if a predefined service type is
selected.
 Class: This is the identifier of the class that the message will be sent to; the ID of the Vision Object is Hex 78.
 Instance: This field specifies the instance number of the object that the message will be sent to; for In-Sight
sensors, the Vision Object only has one instance, so this field should be set to 1.
 Attribute: The attribute number that the message will be sent to; in this case, the JobName attribute has the ID of
14 Hex.
 Source Element: This field indicates the source for the data that is being sent with the message. For the JobName
attribute, a String with a 2 byte length header needs to be sent. This string was formatted earlier using the COP
and MOV instructions in the run that was created in the previous steps. This field should be set to
InSight_SetJobData to send the new job name to the JobName attribute.
 Source Length: This field indicates the number of bytes of the source element that will be sent to the object. In
this instance, because all of the data in the source element needs to be sent, the bytes should be set to 32.
4.
The MSG instruction now needs to be told which device should have the explicit message sent to it. Click on the Communication
tab of the Message Configuration dialog and press the Browse... button. Choose the In-Sight sensor from the I/O configuration
as shown below:
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Communicate with a Rockwell ControlLogix PLC on an EtherNet/IP Network
Page 14 of 14
5.
After downloading the program to the ControlLogix PLC, the current job should be able to be changed with RSLogix by using the
InSight_JobName and the InSight_TriggerSetJob controller tags:
6.
The Job Loading, Job Load Complete, and Job Load Failed bits can be used to determine if the job loaded successfully.
mk:@MSITStore:C:\Program%20Files\Cognex\In-Sight\In-Sight%20Explorer%204.2.0\Do... 1/8/2009
Download PDF