Onboard ProfiNET - IS - v1 - 3
Onboard ProfiNET - IS - v1 - 3
V1.3
The information contained in this document has been developed solely for the purpose of
providing general guidance to Cognex customers who need to configure communications
between an In-Sight® sensor and a SIMATIC S7-300 PLC via ProfiNET protocol and data
contained in this document serves informational purposes only.
The information in this document is proprietary to Cognex. No part of this document may be
reproduced or transmitted in any form or by any means, electronic or mechanical, including
photocopying, without the written permission of Cognex.
Information in this document does not represent a commitment on the part of Cognex and in
especially is not intending to be binding upon Cognex to any particular course of business.
Cognex assumes no responsibility for errors or omissions in this document. Cognex does not
make any express or implied representation or warranty as to the accuracy or completeness of
the information for a particular purpose. Cognex shall have no liability for damages of any
kind including without limitation direct, special, indirect, or consequential damages that may
result from the use of this document.
This section shows the software, firmware versions of the equipments and the hardware elements that were
used for creating this document.
• Operating Systems
- Windows XP Service Pack 3
• In-Sight Environment
- In-Sight Explorer version 4.5.0 (build 474)
- Camera type: In-Sight Micro 1400-10
- Camera Firmware version: 4.5.0 (build 233
• Siemens S7 Environment
- STEP 7 version 5.4 + Service Pack 5
- CPU type: 315-2 PN/DP
3. In the Protocol Services section of the dialog, select PROFINET protocol and press OK.
4. Restart the In-Sight vision system, and the PROFINET service will be enabled upon completion of the
power cycle.
1. Open a new project in the SIMATIC Manager and insert a new station for your CPU.
2. Select the inserted SIMATIC station and double click to the Hardware object on the right side to configure
the hardware settings.
4. Drag and drop the correct CPU type to the rail and on the Parameters tab configure the IP settings then click
to the New button.
Save and Compile your project, download the configuration to the PLC.
6. If this is the first In-Sight sensor to be added to the PROFINET network, the In-Sight GSD file (provided by
Cognex) will need to be installed. To install the In-Sight GSD file, follow these steps:
• From the HW Config tool, select Options > Install GSD Files from the menu.
• Press the Browse button and select the GSD folder from the In-Sight Explorer installation CD-ROM.
• Press the Select All button, then click the Install button to install the hardware description for the In-
Sight vision sensors.
To add an In-Sight sensor to a PROFINET network, browse to the In-Sight node of the Hardware Catalog
(PROFINET IO > Additional Field Devices > Sensors > Cognex Vision Sensors), and then drag an instance
of the In-Sight sensor into the PROFINET-IO-System in the hardware configuration. (The PROFINET-IO-
System is marked with red on the above image.)
7. Right click on the IS camera > Select object properties. On the General tab you can set the device name then
click to the Ethernet button and set the IP address finally click to the OK button.
Note: If an underscore was used in the In-Sight camera’s name in In-Sight Explorer then the underscore
will be displayed as a hyphen in the sensor’s name on the PROFINET network in the STEP7 software. For
instance, if the camera name is InSight_1 then it will be shown as InSight-1 on the PROFINET network in
STEP7.
Note: Do not use ‘.’ in the name of the device. It might happen that the device name is displayed like
InSight.PROFINET-IO-System. In this case right click on the PROFINET-IO-System symbol (the
PROFINET-IO-System is marked with red on the above image) and select Object Properties, disable the
option Use name in IO device/controller.
The Siemens STEP7 software will assign default I/O addresses to each of the modules added for the In-
Sight vision system based on the definitions of each module in the In-Sight GSD file (see the above figure).
It is allowed to change any or all of these I/O addresses. All of the modules that map out discrete bit data
(acquisition control and status, inspection control and status, and soft event control) must be assigned to
addresses that are within the process-image input and output memory areas of the PLC. The newest
firmware on Siemens S7 series PLCs allow the sizes of this memory area to be changed (default size is 256
bytes, I0.0 - I255.7, Q0.0 - Q255.7). Other older firmware or models that are not configurable (consult
Siemens PLC documentation) have a fixed size, usually 256 bytes. This can be seen in the picture above
where each of the discrete bit data modules are mapped into I/O addresses starting at 0 and the byte/word
modules are assigned to addresses starting just above the process-image input and output memory areas of
the PLC (256 and higher).
A typical use case would be a configuration as shown in the figures below, which keeps each In-Sight vision
systems' I/O addresses in a more contiguous block than what the STEP7 software assigns. In order for the
PLC logic to access the new I/O bit addresses, open the HW configurator in STEP7 software, open the
properties of the PLC (CPU), go to the Cycle/Clock Memory tab of the dialog and the Size of the process-
image input area and Size of the process-image output area. In the example the sizes of the input and output
areas should be changed to 912 to so that the discrete bit data for the In-Sight vision system is accessible
using the PLC's I and Q addresses for the vision system. If these process-image sizes are not changed, the
bit values will not be read or written to correctly, although byte/word values will update correctly. Refer to
the Siemens PLC documentation for the additional memory overhead required when these process image
sizes are changed.
Note: If the update time is left at the default value of 1 ms, a significant reduction in vision tool
performance may be observed when the PLC is connected to an In-Sight vision system. This reduction can
be alleviated by increasing the cyclic update time to either 8 ms or 16 ms.
10. Go to the SIMATIC Manager and select Options\Set PG/PC interface and select the TCP/IP based
communication interface. Please note that your PC has to be in the same network range and must be able to
communicate with the PLC.
Open the Hardware Configuration window and select the Station/Open ONLINE point. If the camera is
displayed with a red cross on the top left corner, than there is a communication issue. Please make sure that the
camera is accessible for the PLC and the ProfiNET communication is enabled in the camera as described in
chapter I.
Camera icon shown with a red cross, Camera icon showed without the
indicating that there is a communication red cross, indicating that the
issue in the network. communication is ok.
If you can not verify the camera name (shown in the image below), then click on the Assign Name button.
Select the camera in the available devices list and the Device name from the drop down list box in the
Assign device name window and click on the Assign name button.
After you have closed the above window the device should be assigned automatically.
Note: If the SIMATIC system is shown with a red square this means that the CPU has a System Fail
Error. This usually happens if the flash card of the CPU was not cleared before building your project and
contains some parts of a previous project.
Note: If the In-Sight system is shown with a red square instead of green it means that the camera is not
accessible. Please double check the IP settings of the camera and if the ProfiNET communication is
enabled for the camera. Please make sure that you have done correctly the settings detailed in chapter I.
Save and compile than download the project. Now you can close the hardware configuration window.
13. In the SIMATIC Manager window save and download your project to the PLC once again.
• Acquisition Status: Indicates the image acquisition and Online/Offline status for In-Sight sensors.
• Inspection Status: Indicates the status of job execution and inspection results.
Note: This bit only functions when the job load was initiated by the PLC
using PROFINET.
5 Job Load This bit is toggled upon the completion of a job load operation.
Complete
Note: This bit only functions when the job load was initiated by the PLC
using PROFINET.
6 Job Load This bit is set when the last job load attempt failed. It is cleared the next time
Failed a job is successfully loaded.
Note: This bit only functions when the job load was initiated by the PLC
using PROFINET.
7 Reserved Unused.
Note: The default Job ID prefix is 0, indicating that the job will not be changed.
Note: Do not use a Job ID prefix of 255. When a job without a Job ID prefix is loaded via In-Sight
Explorer, an input byte of 255 will be returned to the PLC. Therefore, it would be unclear if a job with a
Job ID prefix of 255 is loaded, or a job without a Job ID prefix is loaded.
• Soft Event Control: Allows spreadsheet soft events to be triggered. Setting any of these bits causes the
associated soft event in the In-Sight Explorer spreadsheet to be triggered.
• User Data: This data can be read from the In-Sight spreadsheet, using the ReadProfinetBuffer function.
• Inspection Results: This is the data that is written from the In-Sight spreadsheet, using the
WriteProfinetBuffer function. If the Buffer Results Enable bit of the Inspection Control Module is set,
then the inspection results will remain unchanged until the acknowledged by pulsing the Inspection
Results Ack bit.
1. While working Offline, perform the Siemens configuration steps, which were outlined in the Creating
the HW configuration and setting up the connection section.
2. Download the completed project to the Siemens controller and set the Operating Mode to Run.
3. Open the HW Config tool online. The In-Sight vision system should show no errors, which indicates
that the I/O connection was completed successfully.
4. To verify the correct, 2-way transfer of I/O data between an In-Sight vision system and a Siemens
controller, connect to the In-Sight vision system using In-Sight Explorer. From the In-Sight vision
system's Spreadsheet View, open the AcquireImage property sheet (cell A0) and set the Trigger
parameter to External. Next, place the vision system Online.
5. From the HW Config tool, with the In-Sight vision system selected, right-click on the Acquisition
Control Module and select Monitor/Modify.
7. After this bit has been set, whenever Input bit 1 is changed from false to true, the In-Sight vision system
will acquire an image.
8. From the Monitor/Modify window of the Inspection Status module, if the Run conditionally checkbox is
checked for Monitor, the Inspection Completed bit (Bit 1) can be observed changing state when the
inspection completes by repeating step 6.
The following steps explain how to format the data that will be sent from an In-Sight vision system to a
Siemens PLC.
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 to open the Insert Function dialog. From the left
pane, click on the Input/Output category, then double-click the FormatOutputBuffer function, from the
right pane, 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, click on the Add button again. This will initiate the cell selection
mode; select the count cell of the AcqCounter snippet.
9. Set the WriteProfinetBuffer function's Buffer parameter as a cell reference to the recently created
FormatOutputBuffer function's Buffer data structure.
11. In the SIMATIC Manager, create a new Variable Table by right-clicking on your PLC and selecting
Variable Table from the Insert New Object menu. Open the new Variable Table.
Note: The addresses assume that the Inspection Results module is at input address 257. If the Inspection
Results module is at a different address, apply the specified offset to the input address to set the correct
address.
13. In the SIMATIC Manager, open Configured PLC from the PLC > Connect To menu, and then select
Monitor from the Variable menu; the values displayed should be identical to those displayed in the In-
Sight Explorer spreadsheet.
Note: If you are using the CP-343 communication module, then you need to use the FC11 "PNIO_SEND"
FC12 "PNIO_RECV functions for sending and receiving data.
For this example, create a new job within In-Sight Explorer and then perform the following steps to configure
the data that will be received by the Siemens PLC.
1. Open the AcquireImage cell and set the Trigger parameter to Continuous.
2. Right-click an empty cell and select Insert Function to open the Insert Function dialog. From the left
pane, click on the Input/Output category, then double-click the FormatInputBuffer function, from the
right pane, to insert it into the spreadsheet.
3. From the FormatInputBuffer dialog, click on the Add button and add a 32-bit float and a 32-bit integer to
the list.
5. Right-click an empty cell and select Insert Function to open the Insert Function dialog. From the left
pane, click on the Input/Output category, then double-click the ReadProfinetBuffer function, from the
right pane, to insert it into the spreadsheet.
6. Set the ReadProfinetBuffer function's Buffer parameter as a cell reference to the recently created
FormatInputBuffer function's Buffer data structure.
7. The Vision Data Access functions will automatically be added to the spreadsheet based on the fields
added to the FormatInputBuffer function.
9. In the SIMATIC Manager, create a new Variable Table by right-clicking on your PLC and selecting
Variable Table from the Insert New Object menu. Open the new Variable Table.
Note: The addresses assume that the Inspection Results module is at input address 257. If the Inspection
Results module is at a different address, apply the specified offset to the input address to set the correct
address.
11. In the SIMATIC Manager, click on the PLC > Connect To > Configured PLC menu.
12. Enter values for the two items added to the Variable Table and then select the Activate Modify Values
from the Variable menu.
13. The values in the In-Sight Explorer spreadsheet should change to the entered values.
Note: The In-Sight system uses single precision floating precision values in the background. The
specification for single precision floating point values, that allows 24 bits of precision, reserving 1 bit for a
sign, and the remaining 7 bits for the exponent. This means the current implementation of the 32-bit integer
is not useful for any type of ID that is more than 24 bits in length. However the rounding errors can usually
be tolerated for any type of vision parameter or non-id based vision result.
Although it is possible to access the In-Sight camera through the process-image input and output area
(described on page 7-9), you might need consistent data from the camera. Below is a short description how to
create the consistent data access. For this you will need the following system functions:
• SFC14 (DPRD_DAT) for reading the data
• SFC15 (DPWR_DAT) for writing the data
The following example will show how to access the User Data and Result in the camera. The image below
shows the IO addresses. The example will use these addresses. In your project these addresses can be different
so please modify the sample code accordingly.
Open an Organization Block that suits your application best. In our environment we used OB1 to get the data
in all cycles. In our example we used STL language.
To read data from the In-Sight camera call the SFC14 system function:
CALL "DPRD_DAT"
LADDR :=W#16#101
RET_VAL:=MW100
RECORD :=P#M 120.0 BYTE 68
LADDR – The IO address represented in hexadecimal number. In our case the User Data start address is 257
(decimal) which is 101 (hexadecimal). The address expects the data in WORD data type.
RET_VAL – If there is an error, the error identification number will be stored here. We used a merker
address to store this information. For more details regarding the error ID numbers please refer to the help in
STEP7.
RECORD – Points to the merker address where the data should be stored. We used merker block starting at
address 120 to store the user data. “M 120.0” is the start address and “byte 68” shows the ordering of the data
block where 68 is the data block size in bytes. In the above image the result data is from the address 257 till
324, which is a 68 byte block. You should copy the complete block. You can use smaller or larger blocks,
please find details in chapter III point 8.
CALL "DPWR_DAT"
LADDR :=W#16#101
RECORD :=P#M 220.0 BYTE 64
RET_VAL:=MW200
LADDR – The IO address represented in hexadecimal number. In our case the Result start address is 257
(decimal) which is 101 (hexadecimal). The address expects the data in WORD data type.
RECORD – Points to the merker address from where the data should be copied to the camera. We used
merker block starting at address 220. “M 220.0” is the start address and “byte 64” shows the ordering of the
data block where 64 is the data block size in bytes. In the above image the result data is from the address 257
till 320, which is a 64 byte block. You should copy the complete block. You can use smaller or larger blocks,
please find details in chapter III point 8.
RET_VAL – If there is an error, the error identification number will be stored here. We used a merker
address to store this information. For more details regarding the error ID numbers please refer to the help in
STEP7.