You are on page 1of 110

s

SIMATIC
VS72x Communication

Manual

Preface
Contents
Introduction

Connecting the Vision Sensor


VS72x to the PG

Simplified communication

Enhanced communication

Using the VS Gateway to


Communicate Between a VS
72x Vision Sensor and a
Profibus Master

Appendices
Important port addresses

Windows diagnostic tools

Index

05/2008
A5E00285838-05

Safety Guidelines
This manual contains notices you have to observe in order to ensure your personal safety, as well as to
prevent damage to property. The notices referring to your personal safety are highlighted in the manual
by a safety alert symbol, notices referring to property damage only have no safety alert symbol. The
notices shown below are graded according to the degree of danger.

Danger

indicates that death or severe personal injury will result if proper precautions are not taken.

indicates that death or severe personal injury may result if proper precautions are not taken.

Warning

Caution
with a safety alert symbol indicates that minor personal injury can result if proper precautions are not
taken.

Caution
without a safety alert symbol indicates that property damage can result if proper precautions are not
taken.

Notice
indicates that an unintended result or situation can occur if the corresponding notice is not taken into
account.
If more than one degree of danger is present, the warning notice representing the highest degree of
danger will be used. A notice warning of injury to persons with a safety alert symbol may also include a
warning relating to property damage.

Qualified Personnel
The device/system may only be set up and used in conjunction with this documentation. Commissioning
and operation of a device/system may only be performed by qualified personnel. Within the context of
the safety notices in this documentation qualified persons are defined as persons who are authorized to
commission, ground and label devices, systems and circuits in accordance with established safety
practices and standards.

Prescribed Usage
Note the following:

Warning
This device and its components may only be used for the applications described in the catalog or the
technical description, and only in connection with devices or components from other manufacturers
which have been approved or recommended by Siemens.
Correct, reliable operation of the product requires proper transport, storage, positioning and assembly
as well as careful operation and maintenance.

Trademarks
All names identified by are registered trademarks of the Siemens AG.
The remaining trademarks in this publication may be trademarks whose use by third parties for their
own purposes could violate the rights of the owner.

Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and
software described. Since variance cannot be precluded entirely, we cannot guarantee full consistency.
However, the information in this publication is reviewed regularly and any necessary corrections are
included in subsequent editions.

Siemens AG
Automation and Drives
Postfach 4848
90437 NRNBERG
GERMANY

A5E00285838-05
05/2008

Copyright Siemens AG 2008


Technical data subject to change

Preface
Purpose of the Manual
This manual gives you a complete overview of programming with
SIMATIC Spectation. It helps you during installation and commissioning. The
procedures involved in creating programs, the structure of user programs and the
individual language elements are described.
It is intended for persons who are responsible for the realization of control tasks
using SIMATIC automation systems.
We recommend that you familiarize yourself with the Getting Started.
For further information about data exchange with the SIMATIC Automation System
refer to the "VS 72x Communication manual".

Required Basic Knowledge


You require a general knowledge in the field of automation engineering to be able
to understand this manual.
In addition, you should know how to use computers or devices with similar
functions (e.g. programming devices) under Windows 2000 or Windows XP
operating systems.

Where is this Manual valid?


This manual is valid for the software SIMATIC Spectation V 2.6 or higher.

Place of this Documentation in the Information Environment


This manual forms as a PDF part of the CD SIMATIC Spectation.

CE Labeling
VS Link, VS Link-PROFIBUS and SIMATIC VS 72x products fulfill the requirements
and protection guidelines of the following EU directives:

EC Directive 89/336/EWG "EMC directive"

VS72x Communication
A5E00285838-05

iii

Preface

Further Support
If you have any technical questions, please get in touch with your Siemens
representative or office.
You will find your contact partner at:
http://www.siemens.com/automation/service&support
For questions of support visit:
http://www.siemens.de/automation/support-request
For further Information to Factory Automation Sensors, visit:
http://www.siemens.de/simatic-sensors

Training Centers
Siemens offers a number of training courses to familiarize you with the
SIMATIC Machine Vision VS72x and the SIMATIC S7 automation system. Please
contact your regional training center or our central training center in D 90327
Nuremberg, Germany for details:
Telephone: +49 (911) 895-3200.
Internet:

http://www.sitrain.com

Service & Support on the Internet


In addition to our documentation, we offer our Know-how online on the internet at:
http://www.siemens.com/automation/service&support
where you will find the following:

iv

The newsletter, which constantly provides you with up-to-date information on


your products.

The right documents via our Search function in Service & Support.

A forum, where users and experts from all over the world exchange their
experiences.

Your local representative of automation & Drives.

Information on field service, repairs, spare parts and more under "Services".

VS72x Communication
A5E00285838-05

Contents
Preface

iii

Contents

Introduction
1.1
1.2
1.2.1
1.2.2
1.2.2.1
1.2.2.2
1.2.2.3

1-1

Description of communication modes ......................................................... 1-1


Technical requirements for communication................................................ 1-3
Software for all communication modes............................................................. 1-3
Hardware .......................................................................................................... 1-4
PROFIBUS DP communication: SIMATIC Vision Sensor VS72x .................... 1-4
PROFINET communication: SIMATIC Vision Sensor VS72x........................... 1-9
Ethernet Communication: SIMATIC Vision Sensor VS72x ............................ 1-10

Connecting the Vision Sensor VS72x to the PG

2-1

Simplified communication

3-1

3.1
3.2
3.2.1
3.2.2
3.2.3
3.2.4
3.3
3.3.1
3.3.2
3.3.3
3.3.4
3.4
3.5
3.5.1
3.5.2
3.6
3.6.1
3.6.2
3.6.3
3.7
3.7.1
4

Overview .......................................................................................................... 3-1


Requests to VS72x ......................................................................................... 3-2
Standard functions (byte n+0): ......................................................................... 3-3
Test program number (bytes n+2 and n+3)...................................................... 3-4
User data area (starting at byte n+4)................................................................ 3-5
Script camera.................................................................................................... 3-7
Responses of Vision Sensor VS72x ............................................................. 3-8
Frame header ................................................................................................... 3-9
Output bits Out User 1 to 8 (bytes n+3).......................................................... 3-11
User data area ................................................................................................ 3-11
Measured value output ................................................................................... 3-12
Description of the function blocks ............................................................. 3-14
PROFIBUS DP simplified communication: VS72x sensor SIMATIC PLCs3-18
Integration into your STEP 7 project............................................................... 3-19
Configuration of VS Link .................................................................................3-22
PROFINET simplified communication: VS72x sensor SIMATIC PLCs 3-26
Integration in your STEP 7-Project ................................................................. 3-27
Communication between CPU-300 and VS72x via CP343............................ 3-29
Communication between CPU-400 and VS72x via CP443............................ 3-29
Ethernet simplified communication: VS72x Sensor SIMATIC PLCs ... 3-30
Integration into your STEP 7 project............................................................... 3-31

Enhanced communication
4.1
4.1.1
4.1.2
4.2
4.2.1
4.2.2
4.2.3
4.3
4.3.1

4-1

Overview of enhanced functionality ............................................................. 4-1


Input bytes ........................................................................................................ 4-3
Output bytes ..................................................................................................... 4-4
Enhanced communication with PROFIBUS DP / Modbus .......................... 4-5
Configuring the connection between VS Link PROFIBUS DP and the sensor 4-8
Transferring data to the CPU, example with a 314C-2DP CPU ..................... 4-13
Adapting the settings on VS Link PROFIBUS DP .......................................... 4-14
Enhanced communication with Ethernet ................................................... 4-18
System driver..................................................................................................4-19

VS72x Communication
A5E00285838-05

Contents

4.3.2
4.3.3
5

Data Link driver............................................................................................... 4-20


Integration into your STEP 7 project............................................................... 4-24

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a


Profibus Master
5-1
5.1
5.2
5.2.1
5.2.2
5.3
5.3.1
5.3.1.1
5.3.1.2
5.3.2
5.3.2.1
5.3.2.2
5.3.2.3
5.4
5.4.1
5.4.2
5.4.3
5.4.4
5.5
5.5.1
5.5.2
5.5.3
5.6
5.6.1
5.6.2
5.7
5.8
5.9

Overview .......................................................................................................... 5-1


Installing and Configuring the AnyBus-X Generic Gateway and Ethernet
Interface........................................................................................................... 5-2
Configuration Options ....................................................................................... 5-2
Configuring the VS Gateway Ethernet Interface using IPconfig....................... 5-2
VS Gateway Communications with VS 72x Vision Sensors using Modbus
TCP................................................................................................................... 5-3
VS Gateway and Modbus TCP......................................................................... 5-3
Input Register Map ........................................................................................... 5-4
Holding Register Map ....................................................................................... 5-4
Modbus TCP Communications with VS 72x Vision Sensors............................ 5-5
Operation .......................................................................................................... 5-5
Transfer Setup .................................................................................................. 5-6
Example ............................................................................................................ 5-7
Configuring the VS Gateway Profibus Slave ............................................. 5-11
Profibus Introduction....................................................................................... 5-11
AnyBus Profibus Support............................................................................. 5-11
Input Buffer ..................................................................................................... 5-12
Output Buffer ..................................................................................................5-12
Configuration of the IO Buffer of the Gateway .......................................... 5-13
Communication Settings................................................................................. 5-13
5.4.2.3.3 Change Configuration.................................................................... 5-14
Profibus Slave Configuration .......................................................................... 5-15
Hardware Configuration............................................................................... 5-17
Slave/Master Configuration ............................................................................ 5-17
Mechanical Specifications .............................................................................. 5-18
Installation Instructions ................................................................................. 5-1
Connecting the VS Gateway to the Camera................................................. 5-1
Additional Information ................................................................................... 5-2

Appendix A

Important port addresses

Appendix B

Windows diagnostic tools

Index 3

vi

VS72x Communication
A5E00285838-05

Introduction

Introduction

1.1

Description of communication modes


With Vision Sensors of the VS72x family we basically distinguish between three
communication modes:

Communication via TCP/IP

Communication via PROFINET (from Spectation 2.8.1.)

Communication via PROFIBUS DP

The following options can be selected for communication via TCP/IP and
PROFIBUS DP, with limitations:

Simplified communication

Enhanced communication

PROFINET only supports simplified communication. The differences between


simplified and enhanced communication are explained below.

Simplified communication
For this type of communication you can use the function blocks provided on your
CD. Select the appropriate block based on your hardware configuration.
This communication mode allows you to use the standard functions of the Vision
Sensors:

Start/stop inspections

Teach-in / Save

Import values (user data)

Output measured value (user data)

Error feedback of the Vision Sensor

For information on the length of user data, refer to chapter 3.4: Description of the
function blocks.

Enhanced communication
For this type of communication you usually use a system / data link driver
configuration or script programs, which you have created based on your hardware
configuration.
This communication mode allows you to execute all Vision Sensor functions, see
CommandList in the Spectation Online Help.

VS72x Communication
A5E00285838-05

1-1

Introduction

Decision table for communication mode


The following table shows you which communication mode you can select:
Communication mode

Import of Measured
values
value output

Communication mode
Simplified

Enhanced

DP+VS Link via VDX

28 bytes

28 bytes

DP+VS Link via Modbus

512 bytes

512 bytes

PROFINET via VDX

60 bytes

60 bytes

Ethernet via VDX

60 bytes

60 bytes

System Terminal / Data Link

The number of supported Vision Sensors depends on:

1-2

The drivers used

The amount of transferred data per Vision Sensor.

Depends on the respective communication partner

VS72x Communication
A5E00285838-05

Introduction

1.2

Technical requirements for communication

1.2.1

Software for all communication modes

SIMATIC Spectation Version 2.8.1 or higher

STEP 7 Version 5.2 SP 1 or higher

NCM S7 Industrial Ethernet Version 5.2 SP 1 or higher

NCM S7 PROFIBUS DP Version 5.2 SP 1 or higher

Enhanced communication also requires a corresponding block for the CP

For PROFIBUS DP communication, you also need the engineering software


VS Link Version 1.2.5 or higher with the associated GSD file

Certain communication functions require a test program which has been


created in Spectation and handles the image processing tasks.

A certain version of the function block only can be used with a certain
Spectation version.

Version of the function block

Spectation Version

FB72 V1.1 / FC72 V1.0

2.6.4 -2.7.6

FB72 V1.2 / FC72 V1.1

2.7.7 or higher

FB72 V1.2 / FB73 V1.1 / FC72 V1.1

2.8.1 or higher

Note

For detailed information, refer to the STEP 7 documentation.

Detailed information on the function blocks can be found on the Spectation


CD, under VS72X.HLP.

The specified programs and program modules should be installed on your


PC/programming device.

VS72x Communication
A5E00285838-05

1-3

Introduction

1.2.2

Hardware

1.2.2.1

PROFIBUS DP communication: SIMATIC Vision Sensor VS72x


Many devices also communicate over a PROFIBUS DP interface, including the
CPU (314C-2 DP).
A module must therefore be implemented in the existing system which converts the
Ethernet TCP/IP into PROFIBUS DP communication. This conversion is carried out
by the VS Link PROFIBUS DP module. Up to 4 Vision Sensors can be operated
simultaneously from one switch (e.g. SIMATIC NET Scalance X104).
The following components are used:

Vision Sensor VS72x

S7 CPU 314C-2DP

VS Link PROFIBUS

ESM TP40 switch

Programming device/PC

CPU314C2DP

PROFIBUS-DP

VS Link PROFIBUS

Vision Sensor

GND/24V
PROFIBUS-DP
Video Out

PC / PG

RS232

L+ M

Ethernet

Ethernet

Ethernet/TCP/IP

Fig. 1-1: Example of PROFIBUS DP communication with VS72x

1-4

VS72x Communication
A5E00285838-05

Introduction

Configuration of VS Link
PROFIBUS DP address
Set the PROFIBUS DP address of the device on the VS Link PROFIBUS DP.
There are two rotary switches for this on the device itself:

Fig. 1-2: Setting of address on the VS Link PROFIBUS DP

As an example, set the address "3" here, i.e. set the upper of the two switches to
the value "0", and the lower to the value "3" (address read from right to left: 03).
Tip: The address can always be calculated as follows:
Address = 10 x upper value + lower value

VS72x Communication
A5E00285838-05

1-5

Introduction

Configuring I/O areas


Proceed as follows in the VS Link software:
In the menu "Configure -> Project parameters", enter the cyclic data quantity in the
tab "PROFIBUS". If you have connected a VS72x to the VS Link, enter 32 bytes
here (64 bytes for 2 Vision Sensors, 96 bytes for 3 Vision Sensors etc.)

Note
Make sure that the length of the input/output data in the VS-Link coincides with
the total length of the I/O area used in the STEP 7 project (HW Config).

Fig. 1-3: Window "Configuration of project parameters"

1-6

VS72x Communication
A5E00285838-05

Introduction

Configuration of connection to the Vision Sensor


In the menu item "Add -> Connection", enter the IP address of the VS72x. Also set
the port number 3246 here, and select the option "Use Vision Data Exchange
(VDX)". You can also set the Update Rate here, as well as the Data Block to be
used (in this case "Block 1").
Update Rate is the repetition rate of the frame between VS Link and Vision Sensor
in milliseconds. It should not be less than 100 ms.
The Data Block parameter assigns the incoming and outgoing 32-byte data
packets to a Vision Sensor. Block 1 corresponds to the first submodule in STEP 7
(HW Config), Block 2 the second module, etc.

Fig. 1-4: Window "Connection of configuration"

Downloading of project to the VS Link

Fig. 1-5: Window "Configuration of remote system"

VS72x Communication
A5E00285838-05

1-7

Introduction

1. In the Configuration menu, click on Remote System.


2. Following selection of the correct communications interface, click on
"Connect". The dialog box "Administer Remote System" is displayed.
3. In the first tab, click on "Download project and save on VS Link".
4. Check that the Ethernet setting is correct, and confirm "Save project in Flash
memories on VS Link" with "yes".

Fig. 1-6: Window "Administer Remote System"

Note
The Ethernet parameters indicate the IP address, the mask, and the gateway of the
VS Link unit. These do not refer to the PC with which the VS Link project was created.
The VS Link unit applies these settings during runtime. The Ethernet parameters of the
PC are used in the case of test mode on the PC.

5. Click OK when you have defined the parameters. Close the dialog box
"Administer Remote System", and switch the VS Link unit off and on again.
This step is important for registration of the Ethernet parameters within the unit.

1-8

VS72x Communication
A5E00285838-05

Introduction

1.2.2.2

PROFINET communication: SIMATIC Vision Sensor VS72x


The following components are used in the example configuration for PROFINET
communication:

Vision Sensor VS72x

S7 CPU 319-3 PN/DP

Programming device/PC

CPU319-3 PN/DP

PROFINET

PROFIBUS-DP

Vision Sensor

L+ M

Ethernet

PC / PG

Fig. 1-7: Example of PROFINET communication with VS72x

This hardware configuration only supports communication via PROFINET interface.


For information on communication with CP343 and CP443, refer to chapters 3.6.2
and 3.6.3

VS72x Communication
A5E00285838-05

1-9

Introduction

1.2.2.3

Ethernet Communication: SIMATIC Vision Sensor VS72x


The following components are used in the example configuration for PROFINET
communication:

Vision Sensor VS72x

S7 CPU 314C-2DP

Communication processor CP 343-1, standard version

Switch ESM TP40

PG/PC

CPU314C

ESM TP40

CP 343-1

Ports/Inputs
1 2 3 4

1 2 3

V24

Port 1

Port 2

Port 3

Port 4

Netzwerkanbindung

Ethernet

Ethernet

PROFIBUS-DP

Vision Sensor

PC / PG

L+ M

Ethernet

Fig. 1-8: Example of Ethernet communication with VS72x

This hardware configuration only supports communication via Ethernet TCP/IP


interface.

Note
The communication structure has been tested with components selected from the
catalog CA 01 (Automation and Drives).

1-10

VS72x Communication
A5E00285838-05

Introduction

VS72x Communication
A5E00285838-05

1-11

Connecting the Vision Sensor VS72x to the PG

Connecting the Vision Sensor VS72x to


the PG
In order to establish the connection between the Vision Sensor VS72x and the
programming device/PC, it is necessary to determine the IP address of the Vision
Sensor. The IP address is automatically determined by Spectation.
Procedure for establishment of connection with automatic determination of
IP address
1. Start the program SIMATIC Spectation.
The PC Communication dialog box opens automatically.
2. Click the plus sign of the Network folder, and select the sensor.
After a search delay of a few seconds, the network data of the sensor are
shown on the next dialog box.

Fig. 2-1: Verification of IP address and subnet mask

VS72x Communication
A5E00285838-05

2-1

Connecting the Vision Sensor VS72x to the PG

3. The first two number groups of the IP address shown here must correspond
with those of your PC/PG. The fourth group must be different.
This can be set user-specific. Always make sure that this IP address is unique
within your network. If uncertain, consult your system administrator. Click Edit
to modify the entry accordingly, and then click OK to close the dialog box.

Fig. 2-2: Entry of IP address and subnet mask

4. Also verify that the subnet mask of the PC corresponds with the Mask entry in
Spectation. If the addresses differ, modify accordingly (IP Config / All).
5. In the PC Communications dialog box, click Connect.

2-2

VS72x Communication
A5E00285838-05

Connecting the Vision Sensor VS72x to the PG

Use of the VDX driver in Spectation


The VDX driver (Vision Data Exchange) is an alternative to the Modbus protocol for
establishment of the connection between a SmartImage sensor and a VSLink
station on the PROFIBUS. In the basic setting, the VDX driver is activated. If the
driver is not used, it should be disabled in the Input/Output menu. When the VDX
driver is enabled, it starts in the background, and cyclically exchanges data with
VSLink stations.

Fig. 2-3: Activation/disabling of driver

Note: VDX driver activated, and Modbus connection to VS Link

If the VDX driver is activated when using simplified communication (see


Fig. 2-3) and a Modbus connection to the VS Link configured at the same time
(see Fig. 2-4), you cannot read values out of the VS Link in the defined areas
of the Modbus.

The output value determined over the fast VDX driver is present briefly in the
defined registers.

If the data transfer is executed over the slower Modbus, these values in the
defined registers are overwritten.

VS72x Communication
A5E00285838-05

2-3

Connecting the Vision Sensor VS72x to the PG

Fig. 2-4: Input/Output

Fig. 2-5: Modbus master


Remedy:
Delete all Modbus connections to the VS Link.

Note
Other Modbus connections, e.g. to other sensors, are not affected.

2-4

VS72x Communication
A5E00285838-05

Simplified communication

Simplified communication

3.1

Overview
Spectation V2.6 or higher provides you with simplified functions for communication
between a SIMATIC S7 PLC and Vision Sensor 72x over PROFIBUS DP and
ETHERNET. (Version V2.8.1 also supports communication via PROFINET). This
type of communication is run via the data areas and provides the following
requests:

Trigger

Load

Teach-in

Save

Reset

Trigger mode

Run mode.

However, simplified communication has reduced functionality compared to the


enhanced communication with PROFIBUS DP / Modbus described in chapter 4:

The standard functions (Trigger, Load, Teach-in, Save, Reset, Trigger mode
and Run mode) are available to the user.

On PROFIBUS DP, the system provides 28 bytes for value import and 28
bytes for measured value output.

On PROFINET and ETHERNET, the system provides 60 bytes for value import
and for measured value output.

VS72x Communication
A5E00285838-05

3-1

Simplified communication

3.2

Requests to VS72x
The requests to the Vision Sensors VS72x comprise:

Standard functions (Trigger, Load, ) Byte n+0

Number of test program Bytes n+2 and n+3

User data area Bytes n+4 to n+31 with PROFIBUS DP or Byte n+63 with
PROFINET or ETHERNET communication.

Table 3-1 Request structure


Bit

Byte n+0

Reserve

Byte n+1
Byte n+2
Byte n+3
Byte n+4

Run mode

Trigger
mode

Reset

Save

Teach-in

Load

Trigger

(inspection)

Reserve
Test program number
Start of value import area

.
.
.

Byte n+31

End of area for PROFIBUS DP

.
.
.

Byte n+63

3-2

End of area for PROFINET and Ethernet

VS72x Communication
A5E00285838-05

Simplified communication

3.2.1

Standard functions (byte n+0):

Trigger (bit 0)
Triggers a measurement when external trigger mode is set.

Note
The trigger is not reset automatically.

Load (bit 1)
Loads the test program which has the digital test program ID specified in bytes 2/3.
Up to 32768 test programs can be selected.

Teach-in (bit 2)
Teaches all SoftSensors enabled for digital teach-in mode.

Save (bit 3)
Saves the learned SoftSensors.

Reset (bit 4)
Resets the error code and cycle counter.

Trigger mode (bit 5)


Toggles between external and internal trigger mode.

0: internal trigger mode

1: external trigger mode

Run mode, inspection (bit 6)


Enables/disables inspection mode.

0: disables inspection mode

1: enables inspection mode

VS72x Communication
A5E00285838-05

3-3

Simplified communication

3.2.2

Test program number (bytes n+2 and n+3)


This specifies the digital ID of the test program to be loaded. The digital ID is
assigned in the test program management dialog box of the test program menu.

Fig. 3-1: Test program management

3-4

VS72x Communication
A5E00285838-05

Simplified communication

3.2.3

User data area (starting at byte n+4)


The area starting at byte 4 is available for value import.
Format of data to be transferred:

Byte

Integer

Floating-point number

String

Mixed formats are also possible.

Value import
A script must be used to access the respective values in the request frame.
Two types of script exist depending on the purpose of use for the data:

SoftSensor script

Background script

Syntax for access to received data:

Byte:

void = VDX_GetImportByte(int index);

Integer:

int = VDX_GetImportInteger(int index);

Floating-point number:

float = VDX_GetImportFloat(int index);

String:

string = VDX_GetImportString(int index).

Note
Index declares the respective start byte.

Valid values:

0 to 27 with PROFIBUS DP

0 to 59 with PROFINET and ETHERNET

VS72x Communication
A5E00285838-05

3-5

Simplified communication

The following table lists possibilities for using the value import and value output
area.
Table 3-2 Index numbers for value import/output
Byte access
Byte n+4

Index 0

Byte n+5

Index 1

Byte n+6

Index 2

Byte n+7

Index 3

Byte n+8
Byte n+9

Index 4

Byte n+10
Byte n+11

Index 6

Byte n+12

Index 8

Byte n+13

Index 9

Byte n+14

Index 10

Byte n+15

Index 11

Byte n+16

Index 12

Byte n+17

Index 13

Byte n+...

Index

Index 5

Integer
access

Float
access

String
access

Mixed
access
Index 0
Byte

Index 0

Index 0

Index 1
String
Index 4

Index 4

Index 7

Index 0
Index 8

Index 8
Floating-point
number

Index 8

Index 12
Byte
Index

Index

Index 13
Byte
Index

Byte access
Indicates the index numbers if values of only one byte are transmitted.

Integer access
Indicates the index numbers if only integers are transmitted.

Float access
Indicates the index numbers if only floating-point numbers are transmitted.

String access
Indicates the index numbers if a string is transmitted.

Mixed access
Indicates the index numbers if different formats are used.
3-6

VS72x Communication
A5E00285838-05

Simplified communication

3.2.4

Script camera
At the receive end, the transmitted data are received by a foreground script.

Example of sensor script: Value import

Fig. 3-2: Example of parameter input for value import

Fig. 3-3: Example script of value import


VS72x Communication
A5E00285838-05

3-7

Simplified communication

3.3

Responses of Vision Sensor VS72x


The response frame consists of:

Frame header (status messages, error code, cycle counter) Bytes n+0 to n+2

Output bits Byte n+3

User data area Bytes n+4 to n+31 or Byte n+63

Table 3-3 Response structure


Bit
Byte n+0

7
Life bit

ACK
(command
acknowledge)

Reserve

Reserve

Wrong
code

Fail

Warn

Pass

Out User
3

Out User
2

Out User
1

Byte n+1

Error code

Byte n+2
Byte n+3
Byte n+4

Cycle counter
Out User
8

Out User
7

Out User
6

Out User
5

Out User
4

Start of measured value output area

.
.
.

Byte n+31

End of area for PROFIBUS DP

.
.
.

Byte n+63

3-8

End of area for PROFINET and Ethernet

VS72x Communication
A5E00285838-05

Simplified communication

3.3.1

Frame header

Status signals (Byte n+0): Pass / Warn / Fail (Bit 0/1/2)


Status of the most recent measurement, according to the test program setting. The
data are transmitted via the VDX driver.

Wrong code (bit 3)


Indicates that a code has been read by a SoftSensor, but that this does not agree
with the specified code.

Response to a command (acknowledge, ACK), bit 6


Spectation 2.7.7 or higher.
A response (ACK) is generated by the VDX driver for the following requests:

Trigger (bit 0)

Load (bit 1)

Teach-in (bit 2)

Save (bit 3)

Trigger mode (bit 5), with status change 0 ->1 and 1-> 0

Run mode inspection (bit 6) with status change 0 ->1 and 1-> 0

The acknowledgment also updates the error code.

Watchdog (life display) bit 7


Spectation 2.7.7 or higher
The watchdog bit (life bit) is used to monitor the status of the sensor and of the
connection (is there a problem in communication; is the sensor switched on ...).
The life bit is present in the response frame byte n+0, bit 7.
The life bit toggles every 1000 ms. With each change, the VS72x sends a complete
frame (64 bytes).
Inversion of the life bit by the VS72x also takes place following a regular request. In
addition to the life bit, the remaining values (bytes n+0 to n+63) also change
according to the processed request.
The FB/FC72 resp FB73 evaluates the life bit. If an error occurs, i.e. if the life bit
does not toggle within 1000 ms, the FB sets the new output CONN_OK_CAMx to
the value FALSE. This output can be displayed by the user.

VS72x Communication
A5E00285838-05

3-9

Simplified communication

The output is automatically reset following elimination of the error.


If no errors are present, the output CONN_OK_CAMx has the value TRUE.

Note
With FB72 (PROFIBUS), CONN_OK_CAMx represents the four outputs
CONN_OK_CAM1 to CONN_OK_CAM4, with FB73 (PROFINET) and FC72
(Industrial Ethernet), it represents the output CONN_OK_CAM.

Error code (byte n+1)


Possible codes:
1: Error when loading the test program
2: Error when saving the test program
3: Trigger error

Cycle counter (byte n+2)

Spectation 2.7.6 or older:


The cycle counter is incremented following each measurement. The first
measurement request enters the value "0" in the cycle counter.
There is no response for the user at the PLC end in the case of all other
requests.

3-10

Spectation 2.7.7 or higher:


The cycle counter is incremented following each measurement. Following the
first measurement request, the counter has the value "1".

VS72x Communication
A5E00285838-05

Simplified communication

3.3.2

Output bits Out User 1 to 8 (bytes n+3)


Output bits which can be set based on the results of the SoftSensors.
The bits are defined in Spectation in the Input/Output, Datalink menu.

Fig. 3-4: Example of Datalink outputs

The first 8 user-defined outputs are written to byte 3 of the response frame.

3.3.3

User data area


The area starting at byte n+4 is available for measured value output. Format of
data to be transferred: byte, integer, floating-point number or string. A mixed format
is also possible, see chapter 3.2.3: User data area (starting at byte n+4) Table 3-2: Value import.

VS72x Communication
A5E00285838-05

3-11

Simplified communication

3.3.4

Measured value output


Syntax for write access to measured values in the output area:

Byte:

VDX_SetOutputByte(int index, byte value);

Integer:

VDX_SetOutputInteger(int index, int value);

Floating-point number: VDX_SetOutputFloat(int index, float value);

String:

VDX_SetOutputString(int index, string value).

Syntax for read access to measured values in the output area:

Byte:

byte = VDX_GetOutputByte(int index);

Integer:

int =

Floating-point number: float = VDX_GetOutputFloat(int index);

String:

VDX_GetOutputInteger(int index);

string = VDX_GetOutputString(int index).

Note
Index declares the respective start byte.
Valid values:

0 to 27 with PROFIBUS DP

0 to 59 with PROFINET and ETHERNET

A table with the possible applications of the output area can be found in chapter
3.2.3: User data area (starting at byte n+4) - Table 3-2: Value import.
You should use the SoftSensor scripts in order to output the respective measured
values.

Fig. 3-5: Example of parameter input for result

3-12

VS72x Communication
A5E00285838-05

Simplified communication

Fig. 3-6: Example script for result

VS72x Communication
A5E00285838-05

3-13

Simplified communication

3.4

Description of the function blocks

FB 72

for PROFIBUS DP
FB 72 "VS_S7_DP" is used to establish simplified communication over
PROFIBUS DP between an S7-300 or S7-400 PLC with integral or external
PROFIBUS DP interface (except CP342-5) and the VS Link. Up to
4 Vision Sensors VS72x can be connected to the VS Link per call of the function
block. The function block is simply called cyclically in OB 1 or an OB 1 subroutine.
Enter the I/O addresses which represent the Vision Sensor on the VS Link in the
"LADDR_CAMx" parameters. The I/O addresses from HW-Config have to be
converted into hexadecimal values and must be identical for the input and output
areas of a camera.
32 bytes input data and 32 bytes output data are used per connected VS72x. For
information on the structure of user data for a VS72x, please refer to chapter 3.2
(Table 3-1) and chapter 3.3 (Table 3-3) or to the online help. With the maximum
number of 4 Vision Sensors per VS Link, the data area therefore consists of
128 bytes of input data and 128 bytes of output data. The data areas are declared
in the "SEND" and "RECV" parameters (ANY pointers). The data areas always
have a fixed length of 128 bytes.
The "RET_VAL_SEND" and "RET_VAL_RECV" parameters return information on
the cause of errors.
The error codes are described in the online help.

Monitoring the connection status (from Spectation 2.7.7 together with VSLink
1.2.5)
The CONN_OK_CAM1 to CONN_OK_CAM4 parameters are used to monitor the
status of the sensor and of the connection (is there a problem in communication; is
the sensor switched on ...). The life bit of the sensor is evaluated for this purpose
(cf. chapter 3.3.1).
The life bit toggles every 1000 ms. Inversion of the life bit by the VS72x also takes
place following a regular request.
If an error occurs, i.e. if the life bit does not toggle within 1000 ms, the FB sets the
output CONN_OK_CAMx to the value FALSE. The output is automatically reset
following elimination of the error.
If no errors are present, the output CONN_OK_CAMx has the value TRUE.
You can find further information in the online help on the CD under
Communication\Online Help.

3-14

VS72x Communication
A5E00285838-05

Simplified communication

FB 73

for PROFINET
FB 73 "VS72x_S7_PN" is used to establish a simplified communication via PROFINET
between an S7-300 or S7-400 PLC with integrated PROFINET interface. FB 73 is
called cyclically in OB 1 or in an OB 1 sublevel for each VS72x system.
At parameter "LADDR_CAM", declare the I/O address which represents the Vision
Sensor in the address space of the CPU. Convert the I/O address defined in HW
Config into a HEX value. Always use the same I/O addresses for the I/O areas of
the camera.
VS72x requires 64 bytes of input data and 64 bytes of output data. For information
on the structure of user data for an VS72x, refer to chapter 3.2 (Table 3-1) and to
chapter 3.3 (Table 3-3), or to the online help. These data areas are declared at the
parameters "SEND" and "RECV" (ANY Pointer) and always have a fixed length of
64 bytes.
The "RET_VAL_SEND" and "RET_VAL_RECV" parameters return information
pertaining to causes of error.
The error codes are described in the online help.
Monitoring the connection status
Parameter CONN_OK_CAM is used to monitor the connection status and the
sensor (is there a problem in communication; is the sensor switched on ...). The life
flag of the sensor is evaluated accordingly (cf. chapter 3.3.1).
The life flag is toggled at intervals of 1000 ms. VS72x also inverts the life flag after
a normal job was completed.
The FB sets output CONN_OK_CAM = TRUE after an error was detected, that is, if
life flag is no longer toggled at intervals of 1000 ms. The output is reset
automatically after the error was cleared.
Output CONN_OK_CAM = TRUE if no errors are active.
For further information, refer to the Online Help on your CD, section
Communication\Online-Help.

VS72x Communication
A5E00285838-05

3-15

Simplified communication

FC 72 "VS_300_IE" for S7-300 and


FC 72 "VS_400_IE" for S7-400
FC 72 "VS_300_IE" and FC 72 "VS_400_IE" are used to establish simplified
communication over Industrial Ethernet TCP/IP between an S7 PLC with TCP/IPcapable communications processor and a VS72x. In OB 1 or a OB 1 subroutine,
call one FC 72 for each VS72x system.
The "ID" parameter specifies the connection ID from NetPro. Please make
allowances for the maximum communication resources specified in the respective
technical data of the CPU and communications processor.
The "LADDR" parameter is also returned by NetPro when you view the object
properties of the configured connection.
FC 72 is used to transmit data with a fixed length of 64 bytes to the Vision Sensor,
and to receive data with a fixed length of 64 bytes from the Vision Sensor. For
information on the structure of user data, please refer to chapter 3.2 (Table 3-1)
and chapter 3.3 (Table 3-3) or to the online help. The data areas are declared in
the "SEND" and "RECV" parameters (ANY pointers). The data areas always have
a fixed length of 64 bytes each.
The "ACT" parameter is used to trigger the send job to the VS72x. The data are
then transferred once, and "ACT" is reset. The data are received at every call of
the FC 72, irrespective of "ACT".
Error-free execution is signaled if the complete user data area was transferred over
Ethernet and the value of the "ERROR_SEND" and "ERROR_RECV" parameters
is "0". The "RET_VAL_SEND" and "RET_VAL_RECV" parameters should be
evaluated when "ERROR_SEND" or "ERROR_RECV" is "1".
The error codes are described in the online help.

Monitoring the connection status (from Spectation 2.7.7)


The CONN_OK_CAM parameter is used to monitor the status of the sensor and of
the connection (is there a problem in communication; is the sensor switched on ...).
The life bit of the sensor is evaluated for this purpose (cf. chapter 3.3.1).
The life bit toggles every 1000 ms. Inversion of the life bit by the VS72x also takes
place following a regular request.
If an error occurs, i.e. if the life bit does not toggle within 1000 ms, the FB sets the
output CONN_OK_CAM to the value FALSE. The output is automatically reset
following elimination of the error.
If no errors are present, the output CONN_OK_CAM has the value TRUE.
The MON_START_TICK and MON_PREV_VAL parameters are used internally by
the FC, and need only be linked by the user.
You can find further information in the online help on the CD under
Communication\Online Help.

Loading function blocks


The function blocks are stored in the VS72x library on the installation CD of
SIMATIC Spectation in the folder Communication\Function Blocks.
3-16

VS72x Communication
A5E00285838-05

Simplified communication

In STEP 7, unpack the zipped blocks in this folder, and save them in STEP7 to
.../S7LIBs.

Block overview
Blocks available for simplified communication between VS72x and SIMATIC:
Table 3-4 Block overview
PLC

Block

Block name

Communication mode

S7-300/S7-400

FB 72

VS_S7_DP

PROFIBUS DP

S7-300/S7-400

FB 73

VS72x_S7_PN

PROFINET

S7-300

FC 72

VS_300_IE

TCP/IP

S7-400

FC 72

VS_400_IE

TCP/IP

Note
Always make sure that the function block you are using is compatible with the
configured communication mode (PROFIBUS DP, PROFINET or Ethernet) and
the PLC (S7-300 or S7-400).

VS72x Communication
A5E00285838-05

3-17

Simplified communication

3.5

PROFIBUS DP simplified communication:


VS72x sensor SIMATIC PLCs
Simplified PROFIBUS DP + VSLink communication over PROFIBUS DP allows
you to transfer up to 28 bytes of user data by way of Vision Sensor.

CPU314C2DP

PROFIBUS-DP

VS Link PROFIBUS

Vision Sensor

GND/24V
PROFIBUS-DP
Video Out

PC / PG

RS232

L+ M

Ethernet

Ethernet

Ethernet

Fig. 3-7: Example of PROFIBUS DP communication with VS72x

3-18

VS72x Communication
A5E00285838-05

Simplified communication

3.5.1

Integration into your STEP 7 project

Hardware

You have configured your hardware in HW-Config. Open the hardware catalog,
and select the entry VS Link under PROFIBUS DP/Sensor system/VSLink.

Drag-and-drop this entry to your PROFIBUS DP segment. Set the


PROFIBUS DP address of the VS Link in the properties menu (e.g. 3). The
address must correspond with the hardware coding switch settings on the
module, see chapter 3.5.2.

The universal modules are located under VS Link in the hardware catalog.

Add one universal module per Vision Sensor to the VS Link table with doubleclick.

In each universal module, set the "Unit" parameter to "Byte", and the
"Consistency" parameter to "Complete length". The input and output addresses
must have the same value.

Fig. 3-8: Example with HW-Config for integration in STEP 7

VS72x Communication
A5E00285838-05

3-19

Simplified communication

Software
Copy FB 72 from the VS72x Series library to your S7 project, and call it in OB1 or a
subordinate block:

STL:
CALL

Explanation:
" VS_S7_DP " , DB72

LADDR_CAM1

:=W#16#00

The start addresses

LADDR_CAM2

of the I/O area from

LADDR_CAM3

HW-Config

LADDR_CAM4

RECV

:=P#DB75.DBX0.0 BYTE 128

Received data

SEND

:=P#DB75.DBX128.0 BYTE 128

Transmitted data

RET_VAL_RECV:=MW300

Status display: receive

RET_VAL_SEND:=MW302

Status display: send

CONN_OK_CAM1:=M304.0

Connection monitoring

CONN_OK_CAM2:
CONN_OK_CAM3:
CONN_OK_CAM4:

Enter the I/O addresses which represent the Vision Sensors on the VS Link in the
"LADDR_CAMx" parameters. The I/O addresses from HW-Config have to be
converted into hexadecimal values and must be identical for the corresponding
input and output areas.
32 bytes input data and 32 bytes output data are used per connected VS72x. For
information on the structure of user data for a VS72x, please refer to chapter 3.2
(Table 3-1) and chapter 3.2 (Table 3-3) or to the online help. With the maximum
number of 4 Vision Sensors per VS Link, the data area therefore consists of
128 bytes of input data and 128 bytes of output data. The data areas are declared
in the "SEND" and "RECV" parameters (ANY pointers). The data areas always
have a fixed length of 128 bytes.
The "RET_VAL_SEND" and "RET_VAL_RECV" parameters return information on
the cause of errors. The error codes are described in the online help.
The CONN_OK_CAMx parameter is used to monitor the status of the sensor and
of the connection (is there a problem in communication; is the sensor switched on
...). The life bit of the sensor is evaluated for this purpose (cf. chapter 3.3.1).
The life bit toggles every 1000 ms. Inversion of the life bit by the VS72x also takes
place following a regular request.
If an error occurs, i.e. if the life bit does not toggle within 1000 ms, the FB sets the
output CONN_OK_CAMx to the value FALSE. The output is automatically reset
following elimination of the error.

3-20

VS72x Communication
A5E00285838-05

Simplified communication

If no errors are present, the output CONN_OK_CAMx has the value TRUE.

Note
Make sure that the length of the input/output data in the VS-Link coincides with
the total length of the I/O area used in the STEP 7 project (HW-Config).

You can find further information in the online help on the CD under
Communication\Online Help.

VS72x Communication
A5E00285838-05

3-21

Simplified communication

3.5.2

Configuration of VS Link

PROFIBUS DP address
On the VS Link PROFIBUS DP, set the module's PROFIBUS DP address you have
defined in the hardware configuration in STEP 7 (cf. chapter 3.5.1). There are two
rotary switches for this on the device itself:

Fig. 3-9: Setting the address on VS Link PROFIBUS DP

As an example, set the address "3" here, i.e. set the upper of the two switches to
the value "0", and the lower to the value "3" (address read from right to left: 03).
Tip: The address can always be calculated as follows:
Address = 10 x upper value + lower value

3-22

VS72x Communication
A5E00285838-05

Simplified communication

Configuring I/O areas


Proceed as follows in the VS Link software:
In the menu "Configure -> Project parameters", enter the cyclic data quantity in the
tab "PROFIBUS". If you have connected a VS72x to the VS Link, enter 32 bytes
here (64 bytes for 2 Vision Sensors, 96 bytes for 3 Vision Sensors etc.)

Note
Make sure that the length of the input/output data in the VS-Link coincides with
the total length of the I/O area used in the STEP 7 project (HW-Config).

Fig. 3-10: Window "Configuration of project parameters"

VS72x Communication
A5E00285838-05

3-23

Simplified communication

Configuration of connection to the Vision Sensor


In the menu item "Add -> Connection", enter the IP address of the VS72x. Also set
the port number 3246 here, and select the option "Use Vision Data Exchange
(VDX)". You can also set the Update Rate here, as well as the Data Block to be
used (in this case "Block 1").
Update Rate is the repetition rate of the frame between VS Link and Vision Sensor
in milliseconds. It should not be less than 100 ms.
The Data Block parameter assigns the incoming and outgoing 32-byte data
packets to a Vision Sensor. Block 1 corresponds to the first submodule in STEP 7
(HW-Config), Block 2 the second module, etc.

Fig. 3-11: Window "Connection of configuration"

Downloading of project to the VS Link


1. In the Configuration menu, click on Remote System.

Fig. 3-12: Window "Configuration of remote system"

3-24

VS72x Communication
A5E00285838-05

Simplified communication

2. Following selection of the correct communications interface, click on


"Connect". The dialog box "Administer Remote System" is displayed.
3. In the first tab, click on "Download project and save on VS Link".
4. Check that the Ethernet setting is correct, and confirm "Save project in Flash
memories on VS Link" with "yes".

Fig. 3-13: Window "Administer Remote System"

Note
The Ethernet parameters indicate the IP address, the mask, and the gateway of the
VS Link unit. These do not refer to the PC with which the VS Link project was created.
The VS Link unit applies these settings during runtime. The Ethernet parameters of the
PC are used in the case of test mode on the PC.

5. Click OK when you have defined the parameters. Close the dialog box
"Administer Remote System", and switch the VS Link unit off and on again.
This step is important for registration of the Ethernet parameters within the unit.

VS72x Communication
A5E00285838-05

3-25

Simplified communication

3.6

PROFINET simplified communication:


VS72x sensor SIMATIC PLCs
Communication via PROFINET with VDX drivers supports the transfer of up to 60
bytes of user data per Vision Sensor.
CPU319-3 PN/DP

PROFINET

PROFIBUS-DP

Vision Sensor

L+ M

Ethernet

PC / PG

Fig. 3-14: Example of PROFINET communication with VS72x

3-26

VS72x Communication
A5E00285838-05

Simplified communication

3.6.1

Integration in your STEP 7-Project

Hardware

You created the hardware configuration in HW Config. The VDX module entry
is available in the hardware catalog, PROFINET IO/Sensors/Spectation.

Drag-and-drop this entry to your PROFINET segment. Enter the device name
of the VS72x in the properties menu. The device name must match the name
configured under Spectation.

A VDX interface is already available in the inserted VDX module.

Enter the required I/O addresses in the properties menu of the VDX interface
Note that the input and output addresses must be identical. Set the value
"OB1-PI" at the "process image" parameters.

Fig. 3-15: Example of HW Config for implementation in STEP 7

VS72x Communication
A5E00285838-05

3-27

Simplified communication

Software

Copy FB 73 from the VS72x series library to your S7 project and call it in OB1
or in a sublevel block.
AWL:
CALL " VS72x_S7_PN " , DB73
LADDR_CAM :=W#16#00
RECV :=P#DB75.DBX0.0 BYTE 64
SEND :=P#DB75.DBX64.0 BYTE 64
RET_VAL_RECV:=MW300
RET_VAL_SEND:=MW302
CONN_OK_CAM :=M304.0

Comment:
Start address I/O area
Receive data
Send data
Receive status display
Send status display
Connection monitoring

Enter the I/O address which represents the Vision Sensor in the address space of
the CPU at parameter "LADDR_CAM". Convert the I/O address from HW Config
into a HEX value. Always use the same address for the I/O areas.
VS72x requires 64 bytes of input data and 64 bytes of output data. For information
on the structure of user data for an VS72x, refer to chapter 3.2 (Table 3-1) and to
chapter 3.3 (Table 3-3), or to the online help. These data areas are declared at the
parameters "SEND" and "RECV" (ANY Pointer) and always have a fixed length of
64 bytes.
The "RET_VAL_SEND" and "RET_VAL_RECV" parameters return information to
error causes. For information on error codes, refer to the online help.
The CONN_OK_CAMx parameter is used to monitor the status of the sensor and
of the connection (is there a problem in communication; is the sensor switched on
...). The life bit of the sensor is evaluated for this purpose (cf. chapter 3.3.1).
The life bit toggles every 1000 ms. Inversion of the life bit by the VS72x also takes
place following a normal request.
If an error occurs, i.e. if the life bit does not toggle within 1000 ms, the FB sets the
output CONN_OK_CAM to the value FALSE. The output is automatically reset
following elimination of the error.
Output CONN_OK_CAM = TRUE if no errors are active.

3-28

VS72x Communication
A5E00285838-05

Simplified communication

3.6.2

Communication between CPU-300 and VS72x via CP343

Communication with VS72x cameras via PROFINET is not supported with CP343,
as this CP allows consistent reading of data blocks with a length to 32 bytes.
CP343 EX30 features an 64Byte internal I/O area.
For this reason, device-specific access to this I/O is not possible within FB73. FC11
(PNIO_SEND) and FC12 (PNIO_RECV) are available for handling read and write
operations in this I/O area. You always have to read and write the entire I/O area.
(See the manual NCM-S7 ("S7-CPs for Industrial Ethernet")

All inputs of the CP must be read at the start of the cycle by calling FC12 and can
be created in a DB or in the memory bit area. All devices, that is, their associated
FBs, access this input image and write their outputs to a corresponding output
image. The output image is transferred to the CPU at the end of the cycle by
calling FC11.

3.6.3

Communication between CPU-400 and VS72x via CP443

Communication with VS72x cameras via PROFINET is not supported with CP443,
as this CP allows consistent reading of data blocks with a length to 32 bytes.

VS72x Communication
A5E00285838-05

3-29

Simplified communication

3.7

Ethernet simplified communication: VS72x Sensor


SIMATIC PLCs
Communication over Ethernet with VDX driver allows you to transfer up to 60 bytes
of user data per Vision Sensor.
CPU314C

ESM TP40

CP 343-1

Ports/Inputs
1 2 3 4

1 2 3

V24

Port 1

Port 2

Port 3

Port 4

Network connection

Ethernet

Ethernet

PROFIBUS-DP

Vision Sensor

PC / PG

L+ M

Ethernet

Fig. 3-16: Example of Ethernet communication with VS72x

3-30

VS72x Communication
A5E00285838-05

Simplified communication

3.7.1

Integration into your STEP 7 project

Hardware
You have configured your hardware in HW-Config.

Fig. 3-17: Example with HW-Config for integration in STEP 7

Open NetPro to create a new TCP connection to a non-specified partner. Select


"Active connection establishment" in the "General information" tab.

Fig. 3-18: Window "Properties TCP connection: "General information" tab"

VS72x Communication
A5E00285838-05

3-31

Simplified communication

In the "Addresses" tab, enter the IP addresses of the Vision Sensor (see also
chapter 2:) and port number 7500. The local port number is assigned
automatically, and you need not change it.

Fig. 3-19: Window "Properties TCP connection: "Addresses" tab"

Software
Copy the function corresponding to your system family from the VS72x Series
library to your S7 project, and call it in OB1 or a subordinate block:
You can add the FC 72 for Ethernet to your STEP 7 program as follows:
STL:
CALL "VS_300_IE"
ID:=1
LADDR:=W#16#100
SEND:=P#DB75.DBX0.0 BYTE 64
RECV:=P#DB75.DBX128.0 BYTE 64
RET_VAL_SEND:=MW300
RET_VAL_RECV:=MW300
ERROR_SEND:=M0.0
ERROR_RECV:=M0.2
CONN_OK_CAM:=M20.0
MON_START_TICK:=MD22
MON_PREV_VAL :=MB30
ACT:=M0.1

3-32

Explanation:
Connection ID from
NetPro, block parameter
Base address of the IE-CP,
block parameter
Send user data area
Receive area
User data
Status display: send
Status display: receive
Error analysis
Error analysis
Connection monitoring
Internal parameter
Internal parameter
Job initiation
VS72x Communication
A5E00285838-05

Simplified communication

The "ID" parameter specifies the connection ID from NetPro. Please make
allowances for the maximum communication resources specified in the respective
technical data of the CPU and communications processor.
The "LADDR" parameter is also returned by NetPro when you view the object
properties of the configured connection.
FC 72 is used to transmit data with a fixed length of 64 bytes to the Vision Sensor,
and to receive data with a fixed length of 64 bytes from the Vision Sensor. For
information on the structure of user data, please refer to chapter 3.2 and chapter
3.3 or to the online help. The data areas are declared in the "SEND" and "RECV"
parameters (ANY pointers). The data areas always have a fixed length of 64 bytes
each.
The "ACT" parameter is used to trigger the send job to the VS72x. The data are
then transferred once, and "ACT" is reset. The data are received at every call of
the FC 72, irrespective of "ACT".
Error-free execution is signaled if the complete user data area was transferred over
Ethernet and the value of the "ERROR_SEND" and "ERROR_RECV" parameters
is "0". The "RET_VAL_SEND" and "RET_VAL_RECV" parameters should be
evaluated when "ERROR_SEND" or "ERROR_RECV" is "1".
The CONN_OK_CAM parameter is used to monitor the status of the sensor and of
the connection (is there a problem in communication; is the sensor switched on ...).
The life bit of the sensor is evaluated for this purpose (cf. chapter 3.3.1).
The life bit toggles every 1000 ms. Inversion of the life bit by the VS72x also takes
place following a regular request.
If an error occurs, i.e. if the life bit does not toggle within 1000 ms, the FB sets the
output CONN_OK_CAM to the value FALSE. The output is automatically reset
following elimination of the error.
If no errors are present, the output CONN_OK_CAM has the value TRUE.
The MON_START_TICK and MON_PREV_VAL parameters are used internally by
the FC, and need only be linked by the user.
You can find further information in the online help on the CD under
Communication\Online Help.

VS72x Communication
A5E00285838-05

3-33

Enhanced communication

Enhanced communication

4.1

Overview of enhanced functionality


Spectation V2.6 provides enhanced functionality for communication between a
SIMATIC S7 PLC and Vision Sensor 72x via PROFIBUS DP and ETHERNET. This
type of communication is not available for PROFINET IO.
Enhanced communication differs from simplified communication by having the
following additional functionality:

More values can be transferred

14 user-defined inputs

16 user outputs

24 user-defined outputs

Status bits: Busy, 3 Strobe, Resource Conflict, Select Pass, Select Fail,
Acquiring, Inspecting, Inspect Toggle

The range of values can be scaled

The section below shows the assignment between registers and inputs/outputs.

SIMATIC VS72x registers and I/O assignments


Table 4-1 SIMATIC VS72x registers and I/O assignments
Siemens
register

0
1
2
3
4

Bit position
7

6
Bit 63

Bit 62

4
Bit 61

3
Bit 60

2
Bit 59

1
Bit 58

Type

0
Bit 57

Bit 56

Output

Output 63 Output 62 Output 61 Output 60 Output 59 Output 58 Output 57 Output 56


Bit 55

Bit 54

Bit 53

Bit 52

Bit 51

Bit 50

Bit 49

Bit 48

Output 55 Output 54 Output 53 Output 52 Output 51 Output 50 Output 49 Output 48


Bit 47

Bit 46

Bit 45

Bit 44

Bit 43

Bit 42

Bit 41

Bit 40

User 16

User 15

User 14

User 13

User 12

User 11

User 10

User 09

Bit 39

Bit 38

Bit 37

Bit 36

Bit 35

Bit 34

Bit 33

Bit 32

User 08

User 07

User 06

User 05

User 04

User 03

User 02

User 01

Bit 31

Bit 30

Bit 29

Bit 28

Bit 27

Bit 26

Bit 25

Bit 24

Output 31 Output 30 Output 29 Output 28 Output 27 Output 26 Output 25 Output 24


Bit 23

Bit 22

Reserved
Bit 15

Inspect
toggle

Bit 7

Bit 14

Bit 21

Bit 20

Bit 19

Wrong
code

Strobe 2

Strobe 3

Bit 13

Bit 12

Bit 11

Inspecting Acquiring
Bit 6

Bit 5

Bit 18

Bit 17

Bit 16

Reserved
Bit 10

Bit 9

Bit 8

Bit 1

Bit 0

Reserved
Bit 4

Bit 3

Bit 2

VS72x Communication
A5E00285838-05

4-1

Enhanced communication

Table 4-1 SIMATIC VS72x registers and I/O assignments


Siemens
register

Bit position
7
Select Fail

4-2

5
Select
Pass

4
Res.
Conflict

3
Strobe

2
Busy

1
Fail

Type

0
Warn

Pass

VS72x Communication
A5E00285838-05

Enhanced communication

Table 4-1 SIMATIC VS72x registers and I/O assignments


Siemens
register
8
9
10

Bit position
7

Bit 31

Bit 30

Bit 29

Bit 28

Bit 27

Bit 26

Bit 25

Bit 24

Input 31

Input 30

Input 29

Input 28

Input 27

Input 26

Input 25

Input 24

Bit 23

Bit 22

Bit 21

Bit 20

Bit 19

Bit 18

Bit 17

Bit 16

Input 23

Input 22

Input 21

Input 20

Input 19

Input 18

Relearn

Prod Id 14

Bit 15

Bit 14

Bit 13

Bit 12

Bit 11

Bit 10

Bit 9

Bit 8

Prod Id 8

Prod Id 7

Prod Id 6

Prod Id 13 Prod Id 12 Prod Id 11 Prod Id 10 Prod Id 9

11
12

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

Prod Id 5

Prod Id 4

Prod Id 3

Prod Id 2

Prod Id 1

Prod Id 0

Select

Trigger

Reg 12

Reg 12

Reg 12

Reg 12

Reg 12

Reg 12

Reg 12

Reg 12

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

--

---

16382
16383

4.1.1

Type

Input

General
purpose

Reg 16382

Reg 16382

Reg 16382

Reg 16382

Reg 16382

Reg 16382

Reg 16382

Reg 16382

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

Reg 16383

Reg 16383

Reg 16383

Reg 16383

Reg 16383

Reg 16383

Reg 16383

Reg 16383

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

Input bytes

Trigger (bit 0)
Starts an inspection if the trigger source is set to external.

Select (bit 1)
Loads the test program which has the digital test program ID specified in bytes 911. Up to 32768 test programs can be selected.

Prod ID (bits 216)


This specifies the digital ID of the test program to be loaded. The digital ID is
assigned in the test program management dialog box of the test program menu.

Relearn (bit 17)


Teaches all SoftSensors enabled for digital teach-in mode.

INPUT (1831)
Virtual entries which do not have a system function. These can be read or used
with scripts.
VS72x Communication
A5E00285838-05

4-3

Enhanced communication

4.1.2

Output bytes

Pass / Warn / Fail (bits 0/1/2)


Status of the most recent measurement, according to the test program setting.

Busy (bit 3)
Shows that the Vision Sensor is executing an inspection.

Strobe / Strobe 2 / Strobe 3 (bit 4/bit 19/bit 20)


Outputs for controlling strobe lights.

Resources Conflict (bit 5)


Shows that both image memories of the Vision Sensor are full and that no
additional images can be acquired.

Select Pass / Select Fail (bit 6 and bit 7)


Shows that programs have been successfully transferred.

Acquiring (bit 13)


Shows that an image is being acquired.

Inspecting (bit 14)


Shows that the test program is running.

Inspect toggle (bit 16)


Toggles at each inspection.

Wrong code (bit 21)


Indicates that a code has been read, but that this does not agree with the specified
code.

Output (bits 2431 and bits 4863)


Virtual outputs which cannot be set by the system. These can be set with scripts.

User (bits 3247)


These are outputs which can be set by the SoftSensors.

4-4

VS72x Communication
A5E00285838-05

Enhanced communication

4.2

Enhanced communication with


PROFIBUS DP / Modbus

Example configuration
CPU314C2DP

PROFIBUS-DP

VS Link PROFIBUS

Vision Sensor

GND/24V
PROFIBUS-DP
Video Out

PC / PG

RS232

L+ M

Ethernet

Ethernet

Ethernet/Modbus

Fig. 4-1: Example of PROFIBUS DP communication with Vision Sensor VS72x

This type of communication is used to implement functionality for controlling data


exchange between the CPU and the Vision Sensor via PROFIBUS DP and
Modbus. VS LINK PROFIBUS DP is sued to convert the signals.
In order to be able to control the Vision Sensor or output measured values using
this process you need to implement scripts for mirroring the data to the virtual I/O.
You can also choose to activate a background script to control the Vision Sensor
and to output the status flags.
For further information re virtual I/O and script programming, refer to the Spectation
Online Help system.

VS72x Communication
A5E00285838-05

4-5

Enhanced communication

Special features of this type of communication:

VS Link is a slave in PROFIBUS DP and in Modbus.

Message frames are exchanged cyclically with the Vision Sensor via Ethernet

VS Link mirrors the user data of the message frames from Modbus to
PROFIBUS DP and vice versa

Triggering a measurement
The Vision Sensor can only be triggered if, as described previously:

The registers have been mapped

A test program has been selected for inspection

External trigger mode is set

Inspection mode is enabled.

If these conditions are met, a measurement is triggered by a positive edge of the


triggered bit.
You should create an empty dummy program in order to ensure automatic
activation of the inspection mode. The system loads this program automatically
after POWER ON. You only need to do this if you have not defined a start
inspection program.

Note
The dummy program must be selected as the start program in the SIMATIC Spectation
program.

Reloading the test program


The test programs are loaded based on the digital ID set in the test program
management dialog. 15 test program ID bits are available at the virtual inputs. You
need to write the ID of the required test program in binary format to these bits. Note
that you do not have two complete bytes reserved for you when writing the test
program ID; the 15 bits are distributed across 3 bytes or registers. A test program
is loaded by the positive edges on the Select bit.

4-6

VS72x Communication
A5E00285838-05

Enhanced communication

Value import
Additional values which may need to be transferred alongside with the control
functions must be located in the data area following the control functions. Because
you only have up to 4 bytes for control functions, the area for value import starts at
byte n+4.
The imported values are processed with scripts. Whether a SoftSensor script or
background script is used depends on the application of the values.
The example below shows a SoftSensor script named "Position" that provides a
coordinate for the test program.
class Position
{
public void inspect()
{
this.Point.X=RegisterReadFloat(204);
this.Point.Y=RegisterReadFloat(208);
}
}
Floating-point numbers are read from the registers 204 and 208 and output by the
script as coordinate. This allows you to reference other SoftSensors to this
coordinate. Both values use four registers since the value is read from the register
as a floating-point number. 204 and 208 define the start register for reading the
value.

Measured value output


Just as with the value import, you need to make sure that you output measured
values only to the areas which do not overlap with your virtual outputs. Hence, the
output area for measured values would start at byte n+8, because you only have
up to 8 bytes for virtual outputs.
Measured value output is controlled by script, just like the value import function.
The decision whether to use a SoftSensor or background script is determined by
the manner in which the measured values are generated.
The following example shows a SoftSensor script named "Result" which returns the
number of Blobs found by the Blob Selector tool.
class Result
{
public void inspect()
{
RegisterWriteInteger(108 , Blob_Selector.NumBlobs);
}
}
The "Blob_Selector" SoftSensor writes the "NumBlobs" value to the
registers 108-111. These four registers are required because the value is written in
integer format. 108 defines the start register for writing the value.

VS72x Communication
A5E00285838-05

4-7

Enhanced communication

4.2.1

Configuring the connection between VS Link PROFIBUS DP and


the sensor
In order to transfer measurement data to the PC over PROFIBUS DP, you need to
establish bidirectional Modbus communication to VS Link PROFIBUS DP. Proceed
as follows:
1. In SIMATIC Spectation, select Input/Output > Modbus Master.
2. In the next dialog box, click New.
A new connection is inserted.
3. Click the new connection to select it. Then click the Edit button.
4. In the Slave IP address box, enter the VS Link PROFIBUS DP address. Make
the other entries according to the figure below:

Fig. 4-2: Configuring the connection to VS Link PROFIBUS DP

Note
Please note that one Modbus register occupies two bytes, and one Siemens
SIMATIC PLC register occupies only one byte.

5. Close the dialog box with OK.


6. In the Modbus Master dialog box, click New again to insert a further
connection.
7. Also select this new connection, and then click Edit.

4-8

VS72x Communication
A5E00285838-05

Enhanced communication

8. In the Slave IP Master box, enter the same address as for the connection just
created. Make the other entries according to the figure below:

Fig. 4-3: Configuring the connection from VS Link PROFIBUS DP

9. Close the dialog box with OK.


10. In the Modbus Master dialog box, click Start.
11. Close the dialog box with OK.

Description of the parameters


Table 4-2 Description of the modbus parameters
Parameter name
Description
Name

Freely selectable

Slave IP address

IP address of VS Link

Command

Read Multiple Registers (fetch data from VS Link)

Write Multiple Registers (write data to VS Link)

Slave register start

Master register start

Start register of the used area in VS Link

Register 1000-1511 data from Modbus to PROFIBUS DP

Register 2000-2511 data from PROFIBUS DP to Modbus

Start register of the used area in Vision Sensor

Number of registers

Length of data to be sent

Poll rate

Frame interval between VS Link and Vision Sensor in milliseconds. The poll
rate should be shorter than the cycle time of the CPU, e.g. 10 ms

Timeout

Timeout for VS Link

VS72x Communication
A5E00285838-05

4-9

Enhanced communication

Mapping of the virtual inputs


In order to be able to control the Vision Sensor over Modbus, you need to program
an interconnection between the registers from VS Link and the virtual inputs. You
also need this connection in order to output the status bits of the virtual outputs on
Modbus.
The background script below shows you the simplest way of transferring the
required data:

class MapToVirtual_IO
{
public static void main()
{

//Maps the virtual outputs


//to the output registers of Modbus

RegisterWriteByte(100,RegisterReadByte(0));
RegisterWriteByte(101,RegisterReadByte(1));
RegisterWriteByte(102,RegisterReadByte(2));
RegisterWriteByte(103,RegisterReadByte(3));
RegisterWriteByte(104,RegisterReadByte(4));
RegisterWriteByte(105,RegisterReadByte(5));
RegisterWriteByte(106,RegisterReadByte(6));
RegisterWriteByte(107,RegisterReadByte(7));

//Maps the first 4 input registers of Modbus


//to the virtual inputs

RegisterWriteByte(8,RegisterReadByte(200));
RegisterWriteByte(9,RegisterReadByte(201));
RegisterWriteByte(10,RegisterReadByte(202));
RegisterWriteByte(11,RegisterReadByte(203));
}
}

The first instruction set writes the virtual outputs (registers 07) to registers
100-107. The second instruction set writes the registers 200-203 to the virtual
inputs (registers 811).

4-10

VS72x Communication
A5E00285838-05

Enhanced communication

So that the script runs following a sensor power off, the property "Run after power
on" of the background script must be activated, cf. following figures.

Fig. 4-4: SIMATIC Spectation program

VS72x Communication
A5E00285838-05

4-11

Enhanced communication

Open the Edit menu in the SIMATIC Spectation program, and then the dialog
"Background script":

Fig. 4-5: Dialog "Background scripts"

Click Properties in the dialog "Background script", and activate the option box
RUN.

Fig. 4-6: Dialog "Configure background script"

4-12

Click on the OK button. You then return to the dialog "background script", cf.
figure.

VS72x Communication
A5E00285838-05

Enhanced communication

4.2.2

Transferring data to the CPU, example with a 314C-2DP CPU

Hardware
You have configured your hardware in HW-Config. Open the hardware catalog,
and select the entry VS Link under PROFIBUS DP/Sensor system/VSLink.
Drag-and-drop this entry to your PROFIBUS DP segment. Set the PROFIBUS DP
address of the VS Link in the properties menu (e.g. 3). The address must
correspond with the hardware coding switch settings on the module.
A universal module is located under VS Link in the hardware catalog, insert this.

Fig. 4-7:Example with HW-Config for data transmission to the CPU

VS72x Communication
A5E00285838-05

4-13

Enhanced communication

Software
Copy SFCs 14 and 15 from the Block catalog/Libraries/Standard library/System
Function Blocks folder to OB 1.

// Receiving data via PROFIBUS DP

CALL

"DPRD_DAT"
LADDR

:=W#16#0

RET_VAL:=MW16
RECORD :=P#DB16.DBX0.0 BYTE 4

// Sending data via PROFIBUS DP

CALL

"DPWR_DAT"
LADDR

:=W#16#0

RECORD :=P#DB16.DBX0.0 BYTE 4


RET_VAL:=MW16

In the "LADDR" parameters, enter the base address of the used I/O area which
represents the Vision Sensor on the VS Link. The addresses from HW-Config have
to be converted into hexadecimal values. Write the addresses for the input area to
SFC 14, and those for the output area to SFC 15.
You can find further information in the online help on the CD under
Communication\Online Help.
This concludes configuration of data transfer to the CPU over PROFIBUS DP.

4.2.3

Adapting the settings on VS Link PROFIBUS DP

PROFIBUS DP address
On the VS Link PROFIBUS DP, set the module's PROFIBUS DP address you have
defined in the hardware configuration in STEP 7 (cf. chapter 4.2.2). There are two
rotary switches for this on the device itself:

4-14

VS72x Communication
A5E00285838-05

Enhanced communication

Fig. 4-8: Setting the address on VS Link PROFIBUS DP

As an example, set the address "3" here, i.e. set the upper of the two switches to
the value "0", and the lower to the value "3" (address read from right to left: 03).
Tip: The address can always be calculated as follows:
Address = 10 x upper value + lower value

VS72x Communication
A5E00285838-05

4-15

Enhanced communication

Configuring I/O areas


Proceed as follows in the VS Link software:
In the menu "Configure -> Project parameters", enter the cyclic data quantity in the
tab "PROFIBUS". If you have connected a VS72x to the VS Link, enter 32 bytes
here (64 bytes for 2 Vision Sensors, 96 bytes for 3 Vision Sensors etc.)

Note
Make sure that the length of the input/output data in the VS-Link coincides with
the total length of the I/O area used in the STEP 7 project (HW-Config).

Fig. 4-9: Window "Configuration of project parameters"

4-16

VS72x Communication
A5E00285838-05

Enhanced communication

Downloading of project to the VS Link


1. In the Configuration menu, click on Remote System.

Fig. 4-10: Window "Configuration of remote system"

2. Following selection of the correct communications interface, click on


"Connect". The dialog box "Administer Remote System" is displayed.
3. In the first tab, click on "Download project and save on VS Link".
4. Check that the Ethernet setting is correct, and confirm "Save project in Flash
memories on VS Link" with "yes".

Fig. 4-11: Window "Administer Remote System"

Note
The Ethernet parameters indicate the IP address, the mask, and the gateway of the
VS Link unit. These do not refer to the PC with which the VS Link project was created.
The VS Link unit applies these settings during runtime. The Ethernet parameters of the
PC are used in the case of test mode on the PC.
5. Click OK when you have defined the parameters. Close the dialog box
"Administer Remote System", and switch the VS Link unit off and on again.
This step is important for registration of the Ethernet parameters within the unit.

VS72x Communication
A5E00285838-05

4-17

Enhanced communication

4.3

Enhanced communication with Ethernet

Example configuration
CPU314C

ESM TP40

CP 343-1

Ports/Inputs
1 2 3 4

1 2 3

V24

Port 1

Port 2

Port 3

Port 4

Netzwork connection

Ethernet

Ethernet

PROFIBUS-DP

Vision Sensor

PC / PG

L+ M

Ethernet

Fig. 4-12: Example of Ethernet communication with VS72x

Two modes are available for enhanced communication over Ethernet:


1. System / Data Link
These two standard drivers are offered by the Spectation firmware. The system
driver is used to control the Vision Sensor, and is also used in the Spectation
software to configure the Vision Sensor. The Data Link driver is used to output
measured values. Both drivers are based on the TCP/IP protocol and provide
user data in ASCII format.
2. Socket objects and background script
This version allows you to program a user-specific frame based on a
background script and on the socket objects included in Spectation. This
allows you to establish connections to almost any station capable of operating
with Ethernet and TCP/IP.
For detailed information, refer to the Spectation online help.

4-18

VS72x Communication
A5E00285838-05

Enhanced communication

4.3.1

System driver
The Spectation firmware automatically starts the system driver in server mode, and
connects it to port 3246 of the Vision Sensor. In addition to standard functions, you
can also use this driver to call all Command List functions.

Extract from the Command List:

Modifying communication settings

Creating, deleting and modifying test programs

Creating, deleting and modifying SoftSensors

Direct read/write access to a register

Transferring image data

Output of script debug messages

Switching the Vision Sensor to diagnostics mode

Reading system data

Reading test program data

Reading SoftSensor data

For detailed information, refer to the Spectation online help.

Frame structure
All commands sent to the Vision Sensor by means of the system driver consist of
an init character "#", the command itself, e.g. Y+, and the "End of Line" character
<CrLf> (decimal value Cr=13, Lf=10).

Triggering the Vision Sensor


The Vision Sensor can be set to perform event-triggered (single mode) and
continuous (continuous mode) measurements.
For continuous mode, the internal trigger of the sensor is set, inspection mode is
initiated by the "#Y+<CrLf>" command, and stopped by "#Y-<CrLf>".
In single mode, the sensor is triggered by external signals. This function is enabled
by a "#Yp-<CrLf>" command, and disabled by "#Yp+<CrLf>".
A measurement is triggered by the "#YI<CrLf>" command. Inspection mode must
be enabled, just as for continuous mode.

VS72x Communication
A5E00285838-05

4-19

Enhanced communication

Reloading the test programs


Reloading of test programs for the inspection is based on the test program ID
assigned by the system. This has nothing to do with the digital test program ID.
The test program is selected by the "#PIxx<CrLf>" command, where xx stands for
the relevant test program ID.
You can view the test program ID using Telnet software and the "#PQ<CrLf>"
command.
On the Windows taskbar, click Start > Run.
Enter Telnet in the dialog box (IP address of Vision Sensor) 3246, and then click
OK.
Then type in the "#PQ" command and press Enter. A list of all created test
programs and their IDs appears.

Value import
You can write values directly to the Vision Sensor registers. This requires the
"#RsxxYzz<CrLf>" command, where xx stands for the start register, Y for the
format, and zz for the numerical value.
e.g.: #Rs100F72.01
The numerical value 72.01 is written in floating-point format to register 100.
A list of available formats and their identifiers can be found in the following table
and in the Spectation online help.
Table 4-3 Description of parameters for value import
Format
Value
B
I
I
F
D
L
s
k

4.3.2

UINT8
UINT16
UINT32
FLOAT32
DOUBLE
UINT64
String
Block as UINT8s

Data Link driver


You can use the Data Link driver to output measured values after each
measurement. You can configure up to 10 output strings, and assign separate
send conditions. In addition, you can configure substitutions for faulty
measurements.
The configuration of the output string is associated with the test program, i.e. each
test program is assigned a separate configuration. It is not possible to create a
configuration without having first selected a test program.

4-20

VS72x Communication
A5E00285838-05

Enhanced communication

Note
Measured values are only output when inspection mode is enabled.

Configuring data output


To configure the Data Link driver, select the Data Link item from the I/O menu.
The send conditions for output strings are defined in the Sensors tab. You can
decide to send a string always, never, or in association with the configured
SoftSensors.

Fig. 4-13: Window "Datalink parameters Sensors tab"

SIMATIC S7 CPs require a constant data length. Usually, you should configure
only one string that contains all vital data. If your application requires more than
one string, always send only one string per measurement, making sure that all
strings are of the same length.
Because of the fact that one Data Link output is configured for each test program,
the strings must, of course, have the same length.
The string content is defined in the String register. You can enter user-specific
texts, or insert measured values from a SoftSensor shown in the selection box on
the right.
Press the Enter key or click "EOL" to insert an end-of-line character. This may be
required for some communication partners. SIMATIC S7 CPs do not use an "EOL"
character for TCP connections.
When you click on Format, you can call a function that allows you to set fixed
formats and lengths for the measured values returned by the SoftSensors. This is
always required for communication partners that do not respond to an "EOL"
character, but rather to a fixed frame length.

VS72x Communication
A5E00285838-05

4-21

Enhanced communication

Fig. 4-14: Window "Datalink parameters Strings tab"

Type "Test SIMATIC 724" in the input box, then press Return or click EOL.
General settings can be made in the "General" tab.
Under "Fail character", you can set substitution values. You should select the
"Value" entry when using a SIMATIC S7 CP. This maintains a constant length of
the output string after an error has occurred, and thus ensures error-free data
transfer to the SIMATIC S7 CP.
Use the "Transmission rate" parameter to specify the number of measurements to
be performed before a string is output.
If you have used the Format button to define measured values, and these are
physically shorter than the formatted length, the value is assigned a placeholder
prefix. You can choose from two types of placeholder: zeros or space characters.

4-22

VS72x Communication
A5E00285838-05

Enhanced communication

If a communication partner can interpret data formatted in XML, you can enable
this output format here.

Fig. 4-15: Window "Datalink parameters General tab"

Enabling inspection mode


Enable inspection mode

Fig. 4-16: Enabling inspection mode; standard bar on the left, enhanced bar on the right

Testing measured value output


Next, verify data output using the standard Windows program Telnet.
On the Windows taskbar, click Start > Run. Enter Telnet in the dialog box
(IP address of Vision Sensor) 3247, and then click OK.
If everything has been configured correctly, "Test VS724" should be output.

VS72x Communication
A5E00285838-05

4-23

Enhanced communication

4.3.3

Integration into your STEP 7 project

Hardware
Open NetPro to create two new TCP connections to a non-specified partner. Select
"Active connection establishment" for every connection in the "General information"
tab.

Fig. 4-17: TCP connection

In the "Addresses" tab, enter the IP addresses of the Vision Sensor (see also
chapter 2) and port number 3246 for the system driver, or 3247 for the Data Link
driver.

4-24

VS72x Communication
A5E00285838-05

Enhanced communication

Fig. 4-18: System driver

Fig. 4-19: Data Link driver

Software
Function block FC5 "AG_SEND" is required to control the Vision Sensor by means
of the system driver. This function block transfers the data from the CPU to the CP.
Based on the previously configured configuration and this block, the CP
automatically generates the TCP/IP frame, and embeds the user data in this frame.
According to your system family, select this function block from the
Libraries/SIMATIC_NET_CP catalog and add it to OB 1.
STL:
CALL

Explanation:
"AG_SEND"

VS72x Communication
A5E00285838-05

4-25

Enhanced communication

ACT

:=M1.0

Starts the send operation

ID :=1

Connection ID from NetPro

LADDR

:=W#16#100

SEND

:=P#DB1.DBX 0.0 BYTE 20 Data area to be


transferred

LEN

:=20 Length of data to be


sent in bytes

DONE

:=M2.0
of a job

ERROR

:=M2.1
Indicates whether
an error is present

STATUS

:=MW4 Indicates the status


of the block

Base address of the CP

Indicates completion

Note
Make sure that each frame is terminated by the "End-of-Line" character <CrLf>.
The "LEN" parameter should only contain the actual number of bytes used.

A string is output at the Data Link port after each measurement, provided this port
is configured. The CP receives the frames based on the configured connection.
The CP automatically removes the TCP/IP frame and provides the data to the
CPU. In order to transfer the data from the CP to the CPU, execute function block
FC6 "AG_Recv".
According to your system family, select this function block from the
Libraries/SIMATIC_NET_CP catalog and add it to OB 1.
STL:
CALL

Explanation:
"AG_RECV"

ID :=2

Connection ID from NetPro

LADDR

:=W#16#100

RECV

:=P#DB2.DBX 0.0 BYTE 17 Target area


for received
data

NDR

:=M3.0
Indicates the presence
of new data

ERROR

:=M3.1
Indicates whether
an error is present

STATUS

:=MW6
Indicates the status
of the block

LEN

:=MW8 Number of received


bytes

Base address of the CP

The setting of the "Recv" parameter is of importance for this block. A data area is
opened on the CP based on the number of received bytes; after these 17 bytes
have been filled with data, the data are transferred to the CPU. This means that
when the length of received data is shorter than that configured, the bytes of the
4-26

VS72x Communication
A5E00285838-05

Enhanced communication

next frame are transferred to this data block, and vice versa. The consequence is
that the DB starts processing these received data, i.e. the start point of a data
block therefore fluctuates within the DB.
All numerical values in the Data Link are initially interpreted as an ASCII-based
string. STEP 7 provides various conversion blocks to reconvert this string into a
number format. However, watch that the string formats of SIMATIC S7 and
Spectation are different. In SIMATIC S7, the string content is extended by a twobyte prefix. The first byte contains the total number of characters reserved for the
variable, and the second byte contains the actual number of characters used.
Spectation does not provide the two bytes.
As a consequence, when using a conversion block, you first need to cut the
relevant numerical value from the data block and then add the two-byte prefix to
the new string.
This also applies, of course, if you want to view this string on an HMI device.
For further information on these blocks, refer to the SIMATIC STEP 7 online help.

VS72x Communication
A5E00285838-05

4-27

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

Using the VS Gateway to Communicate


Between a VS 72x Vision Sensor and a
Profibus Master
Note: The AnyBus X-Gateway is also known as theVS Gateway, the name that is
used throughout this chapter. In Spectation, the camera is connected to the
Gateway device using the VS Gateway settings. See Connecting the VS Gateway
to the Camera on page 5-46 Chapter 5.7.

5.1

Overview
This chapter explains how to establish communication between a VS 72x vision
sensor and a Profibus master device through the VS Gateway device.
The VS Gateway has two network interfaces and the device exchanges data via
two pairs of exchange buffers.

Figure 5-1: VS Gateway

Up to 512 bytes of data can be forwarded between network interfaces. The input
buffer on one interface is routed through the output buffer on the other.
In the figure shown above, the gateway is configured with an Ethernet interface on
one side and a Profibus interface on the other. The gateway device can act as
Modbus TCP slave or EtherNet/IP slave on its Ethernet Interface and Profibus
slave on its Profibus interface. This document explains how to set up
communications with a VS 72x vision sensor via Modbus TCP. The VS Gateway
device also supports access via HTTP, FTP, and Telnet.
This chapter describes the following:

How to configure the Ethernet interface of the VS Gateway device.

How to establish communications between a VS 72X vision sensor and the


gateway via Modbus TCP.

How to configure the Profibus slave interface on the VS Gateway.

VS72x Communication
A5E00285838-05

5-1

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

5.2

Installing and Configuring the AnyBus-X Generic


Gateway and Ethernet Interface

5.2.1

Configuration Options
VS 72x vision sensors use Modbus TCP to communicate with the VS Gateway
device over Ethernet. The VS Gateway, in turn, communicates through Profibus
with the Master device.
In order to communicate with the VS 72X vision sensor over Modbus TCP, the VS
Gateways Ethernet interface needs to be configured, which is described in this
section. You can refer to the AnyBus-X Generic Gateway User Manual and the
AnyBus-X Ethernet Network Interface Addendum for more information. These
can be downloaded from the HMS website (www.hms-networks.com).
There are several methods available to configure the Ethernet interface network
settings.

5.2.2

Dip SwitchesIf an address of type 192.168.0.x is desired, the configuration


dip switches on the Ethernet interface can be used to specify the last octet.
The switches would be used to create a binary representation (8 bits for 0-255)
of the last octet. The subnet mask in this case is fixed at 255.255.255.0 and a
gateway address is not set.

IPconfig UtilityA utility program called IPconfig is provided by HMS to


configure the AnyBus-X Ethernet interface network parameters. This utility
implements the HMS IP Configuration Protocol (HICP) and can be downloaded
from the HMS website (www.hms-networks.com). The next section discusses
how to configure network settings with AnyBus IPconfig.

Other Configuration MethodsThere are other methods of configuring the


Ethernet interface network settings such as loading configuration files and
through the VS Gateways web interface. These are not discussed in this
integration note but are covered in the Addendum documents available on the
HMS website.

Configuring the VS Gateway Ethernet Interface using IPconfig


Download the AnyBus IPconfig utility from the HMS website; install it and start it
up. Upon startup the program scans the network for AnyBus devices with Ethernet
interfaces.

5-2

VS72x Communication
A5E00285838-05

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

Figure 5-2: IPConfig Utility

Once the device has been identified and listed, you can edit its network settings by
double-clicking it in the list.

Figure 5-3: Gateway Configuration

In the new window that appears, you can set the IP address, subnet mask, default
gateway address and primary and secondary DNS addresses. You can also
specify a host name and a password to lock the network settings. Finally, click the
Set button to configure the device with the new parameters.

5.3

VS Gateway Communications with VS 72x Vision


Sensors using Modbus TCP

5.3.1

VS Gateway and Modbus TCP


The AnyBus-X Gateway Ethernet interface supports Modbus TCP. The following
table lists the Modbus function codes supported by the Ethernet interface (from the
AnyBus-X Ethernet Network Interface Addendum document):

VS72x Communication
A5E00285838-05

5-3

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

Table 5-1: Modbus Function Codes

Function
Code

Function Name

Mapped to
Buffer...

Read multiple registers (Read Holding Registers)

Input

Read input registers

Input

Write single register

Output

Read exception status

Diagnostics

16

Force multiple registers (Write Holding Registers)

Output

22

Mask write register

Output

23

Read/Write registers

Output

The Input and Output Buffers in the AnyBus-X Gateway Ethernet interface are
mapped to Input and Holding Registers respectively.

5.3.1.1

Input Register Map


The Input Buffer is mapped to Input Register 1 and on. Depending on the type of
gateway and how it has been set up to operate, up to 5 words (registers 1 to 5)
may be occupied by the Status Word and the Live List, as shown in the following
figure from the AnyBus-X Ethernet Network Interface Addendum document:

Figure 5-4: Input Register Map

Note: From the AnyBus-X Ethernet Network Interface Addendum document:


The Live List is only available on master-slave gateway versions. Consult the
AnyBus-X Generic Gateway user manual for further information.

5.3.1.2

Holding Register Map


The Output Buffer is mapped to holding register 1 and on. Depending on how the
gateway is set to operate, holding register 1 may be occupied by the Control Word,
as shown in the following figure from the AnyBus-X Ethernet Network Interface
Addendum document:

5-4

VS72x Communication
A5E00285838-05

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

Figure 5-5: Holding Register Map

Refer to the AnyBus-X Generic Gateway User Manual and AnyBus-X Ethernet
Network Interface Addendum documents for further details.
Note that the Input Buffer (data coming from the Profibus network) is mapped to
Modbus Input Register 1 and the Output Buffer (data forwarded to the Profibus
network) is mapped to Modbus Holding Register 1. Input registers are accessed at
Modbus address 0 if function 4 (Read Input Registers) is used and address 1024 if
function 3 (Read Multiple Registers) is used. Holding Registers are accessed at
address 0 using function 16 (Write Multi Registers) or function 6 (Write Single
Register). That is, if you want to use Modbus class 0 function codes, you can use
Read Holding Registers (function code 3) and read the VS Gateway input registers
(linked to the Profibus network) with an offset of 1024 and you can use Write
Holding Registers (function code 16) with an offset of 0 to write to the Profibus
network.
In order to configure the input and output buffer size for the Modbus slave interface
you need to access the Gateway Configuration Interface. This is done by
connecting to the RS-232 programming port on the AnyBus-X Gateway using any
ASCII-capable terminal program such as Microsoft HyperTerminal. For more
information refer to Chapter 5 Gateway Config Interface (RS232) in the
AnyBus-X Generic Gateway User Manual. You would also use this interface to
configure the Profibus interface parameters.

5.3.2

Modbus TCP Communications with VS 72x Vision Sensors

5.3.2.1

Operation
Modbus Communications is one of the most widely used industrial protocols for
communication between industrial devices. It is a class-structured protocol. VS 72x
vision sensors implement all Class 0 function codes (Read and Write Multiple
Registers) and most Class 1 function codes (Read Status, Read Input Discretes,
Read Multiple Coils, Write Coil, Read Input Registers, Write a single Register).
The VS 72X vision sensor can be configured as either a Modbus master or as a
slave. To have the VS 72X vision sensor act as a Modbus slave, you would set the
Enabled property to true. However, in this case, the AnyBus-X Ethernet interface
acts as the Modbus slave; so you need to configure the VS 72X vision sensor as a
Modbus master.

VS72x Communication
A5E00285838-05

5-5

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

There are two methods to perform Modbus communications as a master on a


VS 72X vision sensor. One method is to use an instance of the MBTransfer class
through a script; in this case, you could execute any class 0 or class 1 function
codes supported by the VS 72x vision sensor. The second method is to configure
Modbus master transfers through the Modbus Master in Spectation; in this case,
only class 0 function codes (Read and Write Holding Registers) are supported.
This document covers the second method.

5.3.2.2

Transfer Setup
This section covers the graphical method of establishing Modbus communications
as a Modbus master from a VS 72X vision sensor.
To configure the camera, first connect to it using Spectation. Once you have
established the connection and presuming you have already programmed the
inspection, select the desired product on the camera and proceed to the Modbus
Master setup (I/O > Modbus Master). Click on the New button. Select the new
Modbus Master entry and click the Edit button. Enter the IP address of the
AnyBus-X Ethernet interface, select the command (read or write registers), set
the registers, set the poll rate (if the transfer mode includes a polling mechanism),
and set the timeout. Click the OK button to save the configuration. For each read
or write operation, you add another entry.

Figure 5-6: Editing the Modbus Master

Once each Modbus Master entries has been configured, click the Save button to
save the configuration to the camera. Then click the Start button to enable the
operations.
Note that you can configure more than one read or write operation. This would be
the case if you are transferring output data that does not reside on contiguous
Modbus registers on the camera.
Remember that the Read Input Registers Modbus function (code 4) is not directly
accessible from the Modbus master configuration in the System Explorer. Instead
this configuration uses Read Multiple Registers function (code 3). So a user must
specify the slave start register property starting from address 1024, not 0 when
reading from the input buffer on the VS Gateway.

5-6

VS72x Communication
A5E00285838-05

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

The number of registers transferred must not exceed the number of registers
specified via Telnet on the VS Gateway side.
Several cameras can be configured to communicate with a single AnyBus-X
Gateway. You would need to allocate consecutive blocks of data on the input and
output buffers of the VS Gateway to each camera. From the Modbus standpoint,
you would just add offsets to the slave start registers being accessed by each
camera according to their allotted block. All the allotted blocks, as a single package
would then be propagated through the Profibus network. The Profibus master
would need to know the offsets for each block to distinguish between each camera.
Note that the sizes for the input and output buffers must match for both networks
(Modbus and Profibus) on the AnyBus-X Gateway.

5.3.2.3

Example
For this example, you need to have access to the vision sensors virtual I/O
functions and also exchange some general purpose input and output values (two
16-bit integer values as input to the camera and two 16-bit integer values to output
inspection results from the camera).
The following figures show the Modbus maps.

VS72x Communication
A5E00285838-05

5-7

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

Figure 5-7: Modbus Coil and Virtual Inputs Map

5-8

VS72x Communication
A5E00285838-05

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

Figure 5-8: Modbus Coil and Virtual Inputs Map

If you exchange these registers with the AnyBus-X Gateway accordingly (write
registers 0 through 7 and read into registers 8 through 15) you can have access to
each individual I/O point on the camera from the Profibus device.
Because you need to send two output values resulting from the vision inspection,
you need to write this information starting at register 16 (so as not to write over the
reserved registers above). This means that you cannot send the registers
containing the virtual output functions and the two inspection output values on one
single write operations because the registers are not contiguous. The same can
apply operations if the data is not contiguous.
In this case, however, you receive the two input 16-bit integer values on Modbus
registers 16 and 17 (Modbus registers are 16 bits long) so that you can perform a
single Read Multiple Register operation; where you would read into the cameras
registers 8 through 17 (a total of 10 registers). Then you write the two 16-bit integer
output values into the cameras registers 18 and 19. So you need to create two
write operations: one that would transfer out registers 0 through 7 and another that
would write out registers 18 and 19.

VS72x Communication
A5E00285838-05

5-9

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

The final configuration would be the same as the one shown in the following figure
and table:

Figure 5-9: Example Configuration

Table 5-2: Modbus Operations

5-10

Modbus
Operation

Modbus Registers on VS
72x Vision Sensor (Master)

Modbus Registers on
AnyBus-X Gateway
(Slave)

Write Holding
Registers

0 7 (Sensors Virtual
Output)

0-7

Write Holding
Registers

18 19 (Two integer
inspection result values)

8-9

Read Holding
Registers

8 17 (Sensors Virtual Input


+ Two integer input values)

1024 1033 (offset of


1024 applied to Holding
Registers)

VS72x Communication
A5E00285838-05

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

5.4

Configuring the VS Gateway Profibus Slave

5.4.1

Profibus Introduction
Profibus stands for Process Field Bus. Profibus is an international, vendorindependent, open fieldbus standard. European standards EN 50170 and EN
50254 ensure vendor-independence and openness. The standard allows devices
from multiple vendors to communicate without special interface adjustments.
Profibus can be used for both complex communication tasks and high-speed time
critical applications.
Profibus offers functionally graduated communication protocols (Communication
Profiles): DP and FMS. Depending on the application, the transmission
technologies (Physical Profiles) RS-485, IEC 1158-2 or fiber optics are available.
Profibus Communication Profiles define how users transmit their data serially via
the common transmission medium. DP is the most frequently used communication
profile. It is optimized for speed, efficiency and low connection costs and is
designed especially for communication between automation systems and
distributed peripherals. DP is suitable as a replacement for conventional, parallel
signal transmission with 24 volts in manufacturing automation as well as for analog
signal transmission with 4 ... 20 mA or Hart in process automation.
The media of this Fieldbus is a shielded copper cable composed of a twisted pair.
The baud rate for the bus is between 9.6k baud to a maximum of 12M baud. The
Profibus network can consist of 126 nodes and the total amount of data for
Profibus-DP is 244 Byte out and 244 Byte in per module (node 126 should not be
used to exchange user data. This node is used for commissioning purposes).

5.4.2

AnyBus Profibus Support


In order to communicate with the master device over Profibus, the VS Gateways
Profibus slave interface needs to be configured. This step is described in this
section. The user can refer to the AnyBus-X Generic Gateway User Manual, the
AnyBus-X Profibus Slave Network Interface Addendum and the AnyBus-X
Profibus Slave Installation Sheet for more information. These can be downloaded
from the HMS website (www.hms-networks.com).
From the AnyBus-X Profibus Slave Network Interface Addendum: On Profibus,
data from the gateway is represented as cyclical I/O data (DP) and Acyclical I/O
data (DPV). The amount of data that is represented as Cyclical I/O data vs. the
amount that is represented as acyclical I/O data can be configured via the Gateway
Config interface. The Slave interface can handle up to 244 bytes of I/O data in
each direction. However, the total data size (input + output) cannot exceed 416
bytes.
The AnyBus-X Profibus Slave interface offers complete slave functionality
according to extensions of EN 50170 (DPV1). It supports Class 1 and Class 2
services as well as the standard DP functionality. The original version, designated
DPV0, has been expanded to include version DPV1, offering acyclic data
exchange between master and slave.

VS72x Communication
A5E00285838-05

5-11

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

5.4.3

Input Buffer
From the AnyBus-X Profibus Slave Network Interface Addendum: Depending on
the type of gateway and how it has been configured, up to 10 bytes of the data
produced by the gateway may be occupied with status information.
Note: The Live List is only available on master-slave gateway versions.

Figure 5-10: Input Buffer

5.4.4

Output Buffer
From the AnyBus-X Profibus Slave Network Interface Addendum: Depending on
how the gateway is configured, the first two bytes consumed by the gateway may
be interpreted as control information.
Note: The Live List is only available on master-slave gateway versions.

Figure 5-11: Output Buffer

5-12

VS72x Communication
A5E00285838-05

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

5.5

Configuration of the IO Buffer of the Gateway

General Information
Generally, the X-gateway requires very little effort to get up and running. However,
since all networks are different, certain settings may need to be adjusted slightly to
fit a particular application. This is achieved through the Gateway Config Interface,
which features a text based user interface that can be accessed using standard
terminal emulation software (such as the Microsoft HyperTerminal).
From the physical point of view, this is a standard RS232 interface with the
following properties:
Baudrate: 57600
Stop bits: 1
Parity: None
Flow control: None
Note: This document covers common settings available on all gateway
configurations (with some minor exceptions). Network-specific settings are, when
applicable, described separately in the interface addendums for your product.

5.5.1

Communication Settings
1. Connect a null-modem cable between the Gateway
Config Interface and a COM-port on the PC.
2. Start the Windows HyperTerminal
3. HyperTerminal will prompt for a name to use for
the new connection. Name the connection Gateway
Config connection, and click OK

4. Specify which interface to use for the connection


(select the COM port that is connected to the
gateway, in this particular case COM1), and click
OK.

VS72x Communication
A5E00285838-05

5-13

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

5. HyperTerminal will now prompt for the communication


properties for the interface. Ensure that
the settings match that of the Gateway Config Interface
and click OK.

6. Done.
Power up the gateway and proceed with the steps
described on the following pages.

5.5.2

5.4.2.3.3 Change Configuration


This menu is used when specifying basic operational properties for the gateway
and the on-board network interfaces. It may be necessary for the gateway to go
offline. In such case, the following message will be appear:
Both networks will go offline
Is this OK? (Y/N)

To continue, press Y. The available settings will now be listed in three sections;
settings for the upper network interface, settings for the lower network interface,
and general gateway settings.
5-14

VS72x Communication
A5E00285838-05

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

Use + and - to toggle between different possible settings. Numerical values are
changed by typing the new value in decimal format followed by <Enter>.
---------------------------------------------Change configuration
---------------------------------------------Ethernet IP + MBTCP + WEB Slave (Upper)
Input I/O data size (bytes):
32
Output I/O data size (bytes):
32
Offline option (+/-):
Clear
Control / Status word (+/-):
Disabled
Modbus Address Mode (+/-):
Enabled
---------------------------------------------Modbus RTU Slave (Lower)
Input I/O data size (bytes):
32
Output I/O data size (bytes):
32
Input Parameter data size (bytes):
0
Output Parameter data size (bytes):
0
Offline option (+/-):
Clear
Control / Status word (+/-):
Disabled
Offline timeout (ms/0=disabled):
0
---------------------------------------------Gateway configuration
Reboot after disconnection (+/-):

Enabled

You need for each camera 32 Byte.


When done, the gateway will ask if the changes shall be stored.
Store Configuration (Y/N)? Yes

To store the changes, press Y. The gateway must be restarted in order for any
changes to have effect.
Configuration stored!
Do you want to restart gateway to execute all changes (Y/N)? Yes

Press Y to restart the gateway. Once the gateway has restarted, the new settings
will become active.
For more Informations about the Configuration have a look at the User Manual,
which you can download from the HMS website (www.hms-networks.com).

5.5.3

Profibus Slave Configuration


Several parameters need to be configured to establish communications with the
AnyBus-X Profibus Slave interface. First, the node address should be configured
by using the on board rotary switches as shown in the following figure. In the
figure, the Profibus node address is 42 ((4 x 10) & (2 x 1)).
Note: The orientation of the switches are different from this figure depending on if
the slave interface is top or bottom mounted.

VS72x Communication
A5E00285838-05

5-15

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

Figure 5-12: Profibus Node Address

You would also need to install the .GSD file, which you can download from the
HMS website (www.hms-networks.com). This file is used to add the AnyBus-X
Gateway Profibus interface as a Profibus slave device on the Profibus network.
In order to configure the input and output buffer size for the Profibus slave interface
you need to access the Gateway Configuration Interface. This is done by
connecting to the RS-232 programming port on the AnyBus-X Gateway using any
ASCII-capable terminal program such as Microsoft HyperTerminal. For more
information refer to Chapter 5 Gateway Config Interface (RS232) in the
AnyBus-X Generic Gateway User Manual. You would also use this interface to
configure the Modbus interface parameters.

5-16

VS72x Communication
A5E00285838-05

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

5.6

Hardware Configuration

5.6.1

Slave/Master Configuration
In this example, where there is only 1 PLC (Master) in the installation, the VS
Gateway consists of a Slave/Master combination. The PLC is a master and the VS
Gateway Profibus interface is a Slave.
On the EtherNet/IP side, the VS Gateway would contain an EtherNet/IP
Adapter/Slave interface to which up to 8 VS 72x cameras could then be added.
Each connected camera uses its own set of registers, which you allocate from the
VS-Gateway settings in Spectation.

Figure 5-13: VS Gateway Configuration

The VS Gateway Ethernet interface consists of an embedded Ethernet 10/100


Mbit/s interface with IT-functionality such as a Web-server, SSI-scripts, Flash file
system, FTP-server, e-mail client and Telnet. It is possible to build web pages
which display and control a factory floor process with data from the other
connected network.

VS72x Communication
A5E00285838-05

5-17

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

5.6.2

Mechanical Specifications
The following figure shows the VS Gateway features.

Figure 5-14: VS Gateway Features

The mechanical specifications are:


Size
126 x 110 x 42mm (L x W x H)
4.96 x 4.33 x 1.65in (L x W x H )

5-18

Power Supply

24V 10% Consumption: Max 280 mA on 24V


Typically 100 mA

Temperature

Operating 0C to + 65C : Non-Opeating -40C to + 85C

Mounting

DIN-rail

Protection Class

IP20

EMC Certification

CE marked, UL,cUL, Haz .Loc and Atex certification

Conformance

Tested and verified for Fieldbus/Ethernet conformance

VS72x Communication
A5E00285838-05

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

5.7

Installation Instructions
The following installation sheets are included with the Gateway device:

AnyBus-X Generic Gateway Installation Sheet

AnyBus-X Ethernet Interface Network Installation Sheet

AnyBus-X Profibus Slave Network Installation Sheet

These installation sheets provide pinouts, LED display descriptions, switch


settings, product diagrams, and installation instructions.

5.8

Connecting the VS Gateway to the Camera


Each camera has to be connected to the VS Gateway using the VS-Gateway
setting in Spectation.
To configure the camera, first connect to it using Spectation. Once you have
established the connection and presuming you have already programmed the
inspection, select the desired product on the camera and proceed to the VDX
options setup (I/O > VDX Options). Select the VS Gateway as the Interface Type.
Enter the IP address of the AnyBus-X Ethernet interface, set the poll rate (if the
transfer mode includes a polling mechanism), and set the block size. Click the OK
button to save the configuration.

Figure 5-15: Connecting the Camera to the Gateway

Once the settings are correct, click the OK button to save the configuration to the
camera.

VS72x Communication
A5E00285838-05

5-1

Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master

5.9

Additional Information
For further reading and more detailed coverage of the configuration steps and
specification of the AnyBus-X Gateway interfaces, please refer to the following
documents accessible through the HMS website (www.hms-networks.com):
AnyBus-X Generic Gateway User Manual, AnyBus-X Ethernet Network
Interface Addendum, AnyBus-X Ethernet Interface Network Installation Sheet,
AnyBus-X Profibus Slave Network Interface Addendum and the AnyBus-X
Profibus Slave Installation Sheet.

5-2

VS72x Communication
A5E00285838-05

Appendix A

Important port addresses

Port

Assignment

23

Standard port for Telnet, e.g. for deleting the Flash memory.

502

Modbus standard for setting of Vision Sensor as Modbus slave.

3246

Port for opening an Ethernet connection to the system.

3247

Data Link for transmitting and receiving data to and from external devices.

5003

VDX port for setting up a TCP / IP server.

5004

VDX port for setting up a TCP / IP client.

7500

VDX Port PROFINET IO

VS72x Communication
A5E00285838-05

A-1

Appendix B

Windows diagnostic tools

Arp
Shows entries of the ARP cache (Address Resolution Protocol), or modifies such
entries. This cache contains tables in which IP addresses and their associated
physical Ethernet or Token Ring addresses are saved. A separate table exists for
each Ethernet or Token Ring network adapter installed in the computer. arp without
parameters displays the help text.

Arp -a [IP-Adr] [-N IP-Adr_Schnittst]


Shows the current ARP cache tables for all interfaces. If you wish to show the ARP
cache entry for a certain IP address, use arp -a with the parameter IP-Adr, where
IP-Adr is an IP address. If you wish to show the ARP cache table for a certain
interface, use the parameter -N IP-Adr_Schnittst, where IP-Adr_Schnittst is the IP
address assigned to the interface. The parameter -N is not case-sensitive.

Ipconfig
Shows all current configuration values of the TCP/IP network, and updates DHCP
(Dynamic Host Configuration Protocol) and DNS settings (Domain Name System).
Without a parameter, ipconfig shows the IP address, the subnet mask, and the
standard gateway for each adapter. Adapters can represent physical interfaces
such as installed network adapters, or logical interfaces such as data
communications connections.

Ipconfig /all
Shows the complete TCP/IP configuration for all adapters.

Netstat
Shows the following information: active TCP connections, connections at which the
computer is ready to receive, Ethernet statistics, the IP routing table, IPv4 statistics
(for the IP, ICMP, TCP and UDP protocols) as well as IPv6 statistics (for the IPv6,
ICMPv6, TCP over IPv6 and UDP over IPv6 protocols). Without using parameters,
netstat shows active TCP connections.

Netstat -a
Shows all active TCP connections as well as the TCP and UDP connections at
which the computer is ready to receive.

VS72x Communication
A5E00285838-05

B-1

Windows diagnostic tools

Ping
A utility for checking connections to one or more remote hosts. The "ping"
command uses the echo packets and echo replies of ICMP to check connectivity
with an IP system in a network. Ping is useful in troubleshooting the IP network or
the router.

Telnet
Terminal emulation protocol frequently used on the Internet for logging-on with
network computers. Telnet also refers to the application which the Telnet protocol
uses for users logging on from remote locations.

Tracert
This command defines the path to a target by sending ICMP echo request
messages (Internet Control Message Protocol) with incrementally increasing TTL
values (time-to-live) to the target. The path shown is a list of adjacent route
interfaces of the routers in the path between a source host and a target. The
adjacent interface is the interface of the router closest to the sending host in the
path. If no parameters are specified, tracert shows the help text.

Note
Detailed descriptions and further information on the Windows commands can be found
in the help and support center of the network environment.

VS72x Communication

B-2

A5E00285838-05

Index
A
AnyBus X-Gateway 5-1

B
Block name
VS_300_IE 3-17
VS_400_IE 3-17
VS_S7_DP 3-17
Byte access 3-6

C
Communication
Enhanced 1-1, 4-13
Ethernet 3-30
PROFIBUS DP 1-1
Simplified 1-1
TCP/IP 1-1
Communication mode 1-2
DP+VS Link via Modbus 1-2
DP+VS Link via VDX 1-2
Ethernet via VDX 1-2
System Terminal / Data Link 1-2
Configuration of connection 1-7, 3-24
Configuring data output 4-21
Configuring I/O areas 1-6, 3-23, 4-16
Configuring the connection 4-8

D
Data Link driver 4-20
Decision table for communication mode 1-2
Description of the parameters 4-9
Download project 1-7, 3-24, 4-17

E
Enabling inspection mode 4-23
Enhanced communication with Ethernet 4-18
Enhanced functionality 4-1
Example
Ethernet communication 1-4
Ethernet connection 3-30
PROFIBUS DP 1-4, 3-18, 3-26, 4-5

F
FB 72 for PROFIBUS DP 3-14, 3-15
FC 72 "VS_300_IE_ for S7-300 3-16
FC 72 "VS_400_IE for S7-400 3-16
Float access 3-6
Frame structure 4-19
Function blocks
Description 3-14
Loading 3-16

H
Holding register map 5-4
HW Config 3-19, 3-27
HW-Config 4-13

I
Input buffer 5-2
Input register map 5-4
Integer access 3-6
Integration in your STEP 7 Project 3-27
Integration into your STEP 7 project 3-19, 3-31,
4-24
IPConfig 5-2

M
Mapping of the virtual inputs 4-10
Master 5-7
Measured value output 3-12, 4-7
Mixed access 3-6
Modbus master 5-6
Modbus register areas 5-7
Modbus TCP 5-3

N
Node address 5-5

O
Output buffer 5-2

P
Profibus 5-1
PROFIBUS DP communication 3-18

VS72x Communication
A5E00285838-05

Index-1

Index

Configuration 1-5, 3-22


PROFIBUS DP Communication 3-26
Block overview 3-17
Profibus slave 5-5

R
Reloading the test program 4-6
Reloading the test programs 4-20
Request structure 3-2
Requests to VS72x 3-2
Responses of Vision Sensor VS72x 3-8

S
Setting of address 1-5
Setting the address 3-22, 4-15
Slave 5-7
Socket objects and background script 4-18
Standard functions 1-1, 3-3
Error feedback / diagnostics 1-1
Import values 1-1
Load (bit 1) 3-3
Output measured value 1-1
Reset (bit 4) 3-3
Run mode (bit 6) 3-3
Save (bit 3) 3-3
Teach-in (bit 2) 3-3
Teach-in / Save 1-1
Trigger (bit 0) 3-3
Trigger mode (bit 5) 3-3
Start/stop inspections 1-1
Status messages
Cycle counter 3-10

Index-2

Error code 3-10


User Out 1 to 8 3-11
Wrong code 3-9
Status signals 3-9
Pass/Warn/Fail 3-9
String access 3-6
System /Data Link driver 4-18
System driver 4-19

T
Technical requirements
Hardware 1-4
Software 1-3
Testing measured value output 4-23
Triggering a measurement 4-6
Triggering the Vision Sensor 4-19

U
User data area 3-5, 3-11

V
Value import 3-5, 4-7, 4-20
VDX driver 2-3
VS Gateway 5-1
Installing 5-2
Settings 5-1
VS Link PROFIBUS DP 4-8

W
Windows diagnostics tools 1

VS72x Communication
A5E00285838-05

You might also like