You are on page 1of 8

Support Hotline: 508-650-4100

One Vision Drive ts.global@cognex.com


Natick, MA 01760

Technical Support
Technical Bulletin

Distribution: Application Engineers, Technical Support


Engineers, Vision Solutions Engineers, Technical INTERNAL ONLY
Documentation Group, Worldwide Sales X Internal &
Bulletin No.: TB-18-001 Customers (as needed)

Date: September 25, 2018 Internal &


Customers (MANDATORY)
Product: IN-SIGHT & Rev: ALL
DATAMAN
Title:

PURPOSE

This document is intended to provide the steps necessary to establish communications between a
Cognex In-Sight vision system or a Dataman scanner and a Beckhoff PLC through an Anybus gateway.
The Anybus gateway will be an EtherNet/IP master to the camera and an EtherCAT slave to the Beckhoff
PLC

TECHNICAL DETAILS

Hardware Needed:
 HMS Anybus Gateway EtherNet/IP master to EtherCAT slave (AB7699)
 Beckhoff PLC

Software needed:
 Anybus Configuration Manager (available from the HMS website)
 TwinCAT 3 installed into Visual studio 2013
 Web Browser (Firefox or Chrome)

Connect power and ethernet cables to your gateway. The EtherNet/IP side should connect to your
network containing the EtherNet/IP devices, while the EtherCAT side should connect to your EtherCAT
master. Connect your PC to the HMS Gateway via USB cable, and launch the Anybus Configuration
Manager tool, available from the HMS website. From the project window on the left of the application,
under the X-gateway node select the first option “No Network Type Selected (Upper)”. On the right
window, select Network Type  Name  “EtherNet/IP Scanner” from the list for upper. Configure the
rest of the settings on the right as shown:

Cognex Corp., CONFIDENTIAL Page 1 of 7 02/19/21 (6:08 AM)


Customer Satisfaction
Support Hotline: 508-650-4100
One Vision Drive ts.global@cognex.com
Natick, MA 01760

Technical Support
Technical Bulletin

Note, here the Input I/O and Output I/O are set to the maximum sizes supported by the Cognex.

Next, select the “No Network Type Selected (Lower)” option under the X-gateway on the left and select
Network Type  Name  “EtherCAT slave” from the for the lower. Fill in the remaining settings as
shown:

Cognex Corp., CONFIDENTIAL Page 2 of 7 02/19/21 (6:08 AM)


Customer Satisfaction
Support Hotline: 508-650-4100
One Vision Drive ts.global@cognex.com
Natick, MA 01760

Technical Support
Technical Bulletin

Now that both sides of the gateway have been configured, go to the Online drop-down menu and select
Connect, or click on the lightning bolt icon in the toolbar. Once connected the lightning bolt icon will grey
out and the lightning bolt with the red circle will become enabled. This will indicate you are connected to
the gateway over serial. Once connected, click the Online drop-down menu and select Download
Configuration, or click the matching icon from the tool bar. This will push the entered settings and reboot
the gateway. There will be a status bar showing the progress of the download, and once the gateway has
fully restarted, it will say complete. You can now disconnect the USB connection to the gateway.
The HMS gateway should be set up for DHCP out of the box, so connecting it to your network with a
DHCP server should assign it an IP address. If you are unsure of the IP address of your gateway you can
open a windows command prompt and run the “arp -a” command to display add devices on the network
the PC is on. You can search the list for the MAC address of the gateway and determine the IP address.
Alternatively, the gateway will include instructions for manually setting an IP address via the dip switches.
Once you have the IP address of your gateway you can use a web browser to browse to the gateway’s
web interface.

Cognex Corp., CONFIDENTIAL Page 3 of 7 02/19/21 (6:08 AM)


Customer Satisfaction
Support Hotline: 508-650-4100
One Vision Drive ts.global@cognex.com
Natick, MA 01760

Technical Support
Technical Bulletin

Once connected to the web interface select the Scan List Config option on the left and click the ‘add’
button in the main window. Note, the gateway will need to set to idle mode to have the ‘add’ button
displayed or edit the scan list.  This can be done by setting the Control word, or though Anybus
configuration manager. Once the gateway has been set to Idle, you can click the ‘add’ button and
this will pull up the Anybus Master EtherNet/IP settings dialog:

Cognex Corp., CONFIDENTIAL Page 4 of 7 02/19/21 (6:08 AM)


Customer Satisfaction
Support Hotline: 508-650-4100
One Vision Drive ts.global@cognex.com
Natick, MA 01760

Technical Support
Technical Bulletin

Enter the IP address of the camera the gateway is connecting to in the IP address field. The Transport
Type drop down can be set to point to point. Next enter in the amount of data that is to be exchanged
between the camera and the PLC in the Data section. The Data Rate is the rate at which the gateway will
read and write to and from the camera. If the application is fast, an appropriate time should be entered
here. For the Connection Points section, the Originator -> Target represents the output assembly of the
camera and the Target -> Originator is the input assembly. For an In-Sight camera running 5.x firmware
the Input assembly is 13 and the output assembly is 22. For 4.10.x firmware, the input assembly is 12
and the output assembly is 21. In all cases, the config value is always 1. If a Dataman scanner is being
connected, Input assembly is 11 and the output assembly is 21, and again the configuration is 1. Once
these values are entered click OK to close this dialog. The gateway status LEDs should now be green
indicating that communications are running.

Setting Up Communications On The Camera

Now that the gateway is configured, the EtherNet/IP protocol needs to be enabled on the vision system.
For spreadsheet jobs, a FormatOutputBuffer function needs to be added along with a WriteResultsBuffer
to send data to the PLC. If values will also be read into the spreadsheet, a FormatInputBuffer and

Cognex Corp., CONFIDENTIAL Page 5 of 7 02/19/21 (6:08 AM)


Customer Satisfaction
Support Hotline: 508-650-4100
One Vision Drive ts.global@cognex.com
Natick, MA 01760

Technical Support
Technical Bulletin

ReadResultsBuffer will also need to be added. If Easybuilder is being used, go to the Communications
App step and select PLC/Motion Controller from the Device drop down, Rockwell Automation from the
Manufacturer drop down and EtherNet/IP from the Protocol drop down and click OK. Using the Add
buttons on the FormatInputData and FormatOutputData tabs to add tool data to the input and output
buffers. Now the camera can be placed Online and will exchange data with the PLC. From the HMS web
interface, click the Monitor button on the left to see data changing under the From Network column. This
is the data from the camera being sent to the gateway and on to the PLC

Setting Up The Gateway In TwinCAT 3


Launch Visual Studio 2013 with the TwinCAT 3 plug-in installed and create a new project. From the
Solution Explorer panel on the right, double click on the SYSTEM folder and click on the Choose Target
button on the Version (local) tab in the main window. From the Choose Target System dialog, select your
PLC and click OK. To setup the EtherCAT connection to the gateway, the PLC needs to scan and find
the gateway on the network.

From the Solution Explorer panel on the right, under the TwinCAT project, expand the I/O node and right
click on the Devices option. Select “Scan” from the menu. This will pop up a New I/O Devices dialog with
check boxes next to any found EtherCAT devices. Uncheck any options that are not EtherCAT and click
OK. Click Yes on both the “Scan for boxes,” and the “Activate Free Run” prompts. This should put the
found devices under the I/O  Devices node in the Solution Explorer panel. Expanding the new device
node should show an Anybus X-gateway – Slave:

Cognex Corp., CONFIDENTIAL Page 6 of 7 02/19/21 (6:08 AM)


Customer Satisfaction
Support Hotline: 508-650-4100
One Vision Drive ts.global@cognex.com
Natick, MA 01760

Technical Support
Technical Bulletin

From the main window select the Process Data tab to see the data being sent from the camera if the
vision system is online and being triggered. If at any time changes need to be made to settings in the
Anybus Configuration Manager tool, the EtherCAT device in the Solution Explorer will need to be
removed and found again by repeating these steps

Mapping Tags For PLC Logic

Now that data can be seen updating in the PLC, they can be mapped to variable tags that can be used in
the PLC logic. Assuming this is a new PLC project, these are the steps to create these variable tags. In
the Solution Explorer, right click on PLC and select “Add New Item” and select Standard PLC Project from
the Add New Item dialog. This will create an Untitled1 Project under the PLC node in the Solution
Explorer. Under the Untitled1 Project there is a POUs folder with a MAIN (PRG) under it.

Cognex Corp., CONFIDENTIAL Page 7 of 7 02/19/21 (6:08 AM)


Customer Satisfaction
Support Hotline: 508-650-4100
One Vision Drive ts.global@cognex.com
Natick, MA 01760

Technical Support
Technical Bulletin

Under the main tab in the middle window, click into the space under Name to enter the name of a variable
tag. The scope field will auto populate with VAR for Variable. Under the address header, enter either %I*
for an input or %Q* for an output variable. The Data Type will default to Byte, but clicking in that field will
produce a button to launch the Input Assistance Dialog:

Once you have added your input and output variable tags, select the BUILD drop down menu and select
Build Solution. There should now be a Untilteld1 Instance under the PLC node. By clicking on it there will
be a list of the variable tags that were created in the previous step. By select a variable tag from the main
list and double clicking it, the dialog will update with the variable tags properties along with a “Linked To”
button. Clicking that button will produce the Attach Variable dialog where individual bytes from the
gateway can be selected. This will link the variable tag to the input and output data from the gateway:

Once the variable tags have been linked to the data from the gateway, the project can be built and saved
once more. The variable tags can now be used in the PLC logic

Cognex Corp., CONFIDENTIAL Page 8 of 7 02/19/21 (6:08 AM)


Customer Satisfaction

You might also like