Professional Documents
Culture Documents
SIMATIC
VS72x Communication
Manual
Preface
Contents
Introduction
Simplified communication
Enhanced communication
Appendices
Important port addresses
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
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".
CE Labeling
VS Link, VS Link-PROFIBUS and SIMATIC VS 72x products fulfill the requirements
and protection guidelines of the following EU directives:
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
iv
The right documents via our Search function in Service & Support.
A forum, where users and experts from all over the world exchange their
experiences.
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
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
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
VS72x Communication
A5E00285838-05
Contents
4.3.2
4.3.3
5
Appendix A
Appendix B
Index 3
vi
VS72x Communication
A5E00285838-05
Introduction
Introduction
1.1
The following options can be selected for communication via TCP/IP and
PROFIBUS DP, with limitations:
Simplified communication
Enhanced communication
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
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
Import of Measured
values
value output
Communication mode
Simplified
Enhanced
28 bytes
28 bytes
512 bytes
512 bytes
60 bytes
60 bytes
60 bytes
60 bytes
1-2
VS72x Communication
A5E00285838-05
Introduction
1.2
1.2.1
A certain version of the function block only can be used with a certain
Spectation version.
Spectation Version
2.6.4 -2.7.6
2.7.7 or higher
2.8.1 or higher
Note
VS72x Communication
A5E00285838-05
1-3
Introduction
1.2.2
Hardware
1.2.2.1
S7 CPU 314C-2DP
VS Link PROFIBUS
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
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:
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
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).
1-6
VS72x Communication
A5E00285838-05
Introduction
VS72x Communication
A5E00285838-05
1-7
Introduction
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
Programming device/PC
CPU319-3 PN/DP
PROFINET
PROFIBUS-DP
Vision Sensor
L+ M
Ethernet
PC / PG
VS72x Communication
A5E00285838-05
1-9
Introduction
1.2.2.3
S7 CPU 314C-2DP
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
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
VS72x Communication
A5E00285838-05
2-1
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.
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
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
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.
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:
User data area Bytes n+4 to n+31 with PROFIBUS DP or Byte n+63 with
PROFINET or ETHERNET communication.
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
.
.
.
Byte n+63
3-2
VS72x Communication
A5E00285838-05
Simplified communication
3.2.1
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.
VS72x Communication
A5E00285838-05
3-3
Simplified communication
3.2.2
3-4
VS72x Communication
A5E00285838-05
Simplified communication
3.2.3
Byte
Integer
Floating-point number
String
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
Byte:
Integer:
Floating-point number:
String:
Note
Index declares the respective start byte.
Valid values:
0 to 27 with PROFIBUS DP
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.
3-7
Simplified communication
3.3
Frame header (status messages, error code, cycle counter) Bytes n+0 to n+2
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
.
.
.
Byte n+31
.
.
.
Byte n+63
3-8
VS72x Communication
A5E00285838-05
Simplified communication
3.3.1
Frame header
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
VS72x Communication
A5E00285838-05
3-9
Simplified communication
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.
3-10
VS72x Communication
A5E00285838-05
Simplified communication
3.3.2
The first 8 user-defined outputs are written to byte 3 of the response frame.
3.3.3
VS72x Communication
A5E00285838-05
3-11
Simplified communication
3.3.4
Byte:
Integer:
String:
Byte:
Integer:
int =
String:
VDX_GetOutputInteger(int index);
Note
Index declares the respective start byte.
Valid values:
0 to 27 with PROFIBUS DP
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.
3-12
VS72x Communication
A5E00285838-05
Simplified communication
VS72x Communication
A5E00285838-05
3-13
Simplified communication
3.4
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
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
CPU314C2DP
PROFIBUS-DP
VS Link PROFIBUS
Vision Sensor
GND/24V
PROFIBUS-DP
Video Out
PC / PG
RS232
L+ M
Ethernet
Ethernet
Ethernet
3-18
VS72x Communication
A5E00285838-05
Simplified communication
3.5.1
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.
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.
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
LADDR_CAM2
LADDR_CAM3
HW-Config
LADDR_CAM4
RECV
Received data
SEND
Transmitted data
RET_VAL_RECV:=MW300
RET_VAL_SEND:=MW302
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:
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
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).
VS72x Communication
A5E00285838-05
3-23
Simplified communication
3-24
VS72x Communication
A5E00285838-05
Simplified communication
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
PROFIBUS-DP
Vision Sensor
L+ M
Ethernet
PC / PG
3-26
VS72x Communication
A5E00285838-05
Simplified communication
3.6.1
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.
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.
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 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 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
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
3-30
VS72x Communication
A5E00285838-05
Simplified communication
3.7.1
Hardware
You have configured your hardware in HW-Config.
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.
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
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 section below shows the assignment between registers and inputs/outputs.
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
Bit 54
Bit 53
Bit 52
Bit 51
Bit 50
Bit 49
Bit 48
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
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
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
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
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.
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
Busy (bit 3)
Shows that the Vision Sensor is executing an inspection.
4-4
VS72x Communication
A5E00285838-05
Enhanced communication
4.2
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
VS72x Communication
A5E00285838-05
4-5
Enhanced communication
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:
Note
The dummy program must be selected as the start program in the SIMATIC Spectation
program.
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.
VS72x Communication
A5E00285838-05
4-7
Enhanced communication
4.2.1
Note
Please note that one Modbus register occupies two bytes, and one Siemens
SIMATIC PLC register occupies only one byte.
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:
Freely selectable
Slave IP address
IP address of VS Link
Command
Number of registers
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
VS72x Communication
A5E00285838-05
4-9
Enhanced communication
class MapToVirtual_IO
{
public static void main()
{
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));
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.
VS72x Communication
A5E00285838-05
4-11
Enhanced communication
Open the Edit menu in the SIMATIC Spectation program, and then the dialog
"Background script":
Click Properties in the dialog "Background script", and activate the option box
RUN.
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
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.
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.
CALL
"DPRD_DAT"
LADDR
:=W#16#0
RET_VAL:=MW16
RECORD :=P#DB16.DBX0.0 BYTE 4
CALL
"DPWR_DAT"
LADDR
:=W#16#0
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
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
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
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).
4-16
VS72x Communication
A5E00285838-05
Enhanced communication
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
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
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.
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).
VS72x Communication
A5E00285838-05
4-19
Enhanced communication
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
4-20
VS72x Communication
A5E00285838-05
Enhanced communication
Note
Measured values are only output when inspection mode is enabled.
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
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-16: Enabling inspection mode; standard bar on the left, enhanced bar on the right
VS72x Communication
A5E00285838-05
4-23
Enhanced communication
4.3.3
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.
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
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
ID :=1
LADDR
:=W#16#100
SEND
LEN
DONE
:=M2.0
of a job
ERROR
:=M2.1
Indicates whether
an error is present
STATUS
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
LADDR
:=W#16#100
RECV
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
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
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.
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:
VS72x Communication
A5E00285838-05
5-1
Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master
5.2
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
5-2
VS72x Communication
A5E00285838-05
Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master
Once the device has been identified and listed, you can edit its network settings by
double-clicking it in the list.
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
5.3.1
VS72x Communication
A5E00285838-05
5-3
Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master
Function
Code
Function Name
Mapped to
Buffer...
Input
Input
Output
Diagnostics
16
Output
22
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
5.3.1.2
5-4
VS72x Communication
A5E00285838-05
Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master
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
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
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.
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
5-8
VS72x Communication
A5E00285838-05
Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master
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:
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
VS72x Communication
A5E00285838-05
Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master
5.4
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
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.
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.
5-12
VS72x Communication
A5E00285838-05
Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master
5.5
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
VS72x Communication
A5E00285838-05
5-13
Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master
6. Done.
Power up the gateway and proceed with the steps
described on the following pages.
5.5.2
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
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
VS72x Communication
A5E00285838-05
5-15
Using the VS Gateway to Communicate Between a VS 72x Vision Sensor and a Profibus Master
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.
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.
5-18
Power Supply
Temperature
Mounting
DIN-rail
Protection Class
IP20
EMC Certification
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:
5.8
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
Port
Assignment
23
Standard port for Telnet, e.g. for deleting the Flash memory.
502
3246
3247
Data Link for transmitting and receiving data to and from external devices.
5003
5004
7500
VS72x Communication
A5E00285838-05
A-1
Appendix B
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.
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
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
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
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