View
257
Download
0
Category
Preview:
Citation preview
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 1/62
s
Preface, Contents
Introduction 1
Connecting the Vision Sensorto the PG 2
Simplified communication 3
Enhanced communication onPROFIBUS / Modbus 4
Enhanced communication viaEthernet 5Index
SIMATIC
VS 72x Communication
Manual
Edition 02/2004A5E00285838-01
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 2/62
Copyright © Siemens AG 2004 All rights reserved
The reproduction, transmission or use of this document or itscontents is not permitted without express written authority.Offenders will be liable for damages. All rights, including rightscreated by patent grant or registration of a utility model or design,are reserved.
Siemens AGBereich Automation and DrivesGeschaeftsgebiet Industrial Automation Systems
Postfach 4848, D- 90327 Nuernberg
Disclaimer of Liability
We have checked the contents of this manual for agreement withthe hardware and software described. Since deviations cannot beprecluded entirely, we cannot guarantee full agreement. However,the data in this manual are reviewed regularly and any necessarycorrections included in subsequent editions. Suggestions forimprovement are welcomed.
©Siemens AG 2004
Technical data subject to change.Siemens Aktiengesellschaft A5E00285838-01
Safety Guidelines
This manual contains notices intended to ensure personal safety, as well as to protect the products and
connected equipment against damage. These notices are highlighted by the symbols shown below andgraded according to severity by the following texts:
! Dangerindicates that death, severe personal injury or substantial property damage will result if properprecautions are not taken.
! Warningindicates that death, severe personal injury or substantial property damage can result if properprecautions are not taken.
! Cautionindicates that minor personal injury can result if proper precautions are not taken.
Cautionindicates that property damage can result if proper precautions are not taken.
Noticedraws your attention to particularly important information on the product, handling the product, or to aparticular part of the documentation.
Qualified Personnel
Only qualified personnel should be allowed to install and work on this equipment. Qualified persons
are defined as persons who are authorized to commission, to ground and to tag circuits, equipment, and
systems in accordance with established safety practices and standards.
Correct 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.
This product can only function correctly and safely if it is transported, stored, set up, and installedcorrectly, and operated and maintained as recommended.
TrademarksSIMATIC®, SIMATIC HMI® and SIMATIC NET® are registered trademarks of SIEMENS AG.
Third parties using for their own purposes any other names in this document which refer to trademarks
might infringe upon the rights of the trademark owners.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 3/62
VS 72x Communication
A5E00285838-01 iii
Preface
Purpose of this manual
This manual provides a comprehensive overview of the communication betweenVS72x and SIMATIC controllers. It supports you in creating the variousconnections and contains sample programs.
The target audience are programmers and engineering, commissioning and servicepersonnel occupied in the field automation systems.
Basic knowledge required
A general knowledge of automation engineering is required for handling thismanual.
In addition, the reader should have adequate knowledge in the use of computers orPC-related equipment (e.g. programming devices) operating on a Windows 2000 /XP platform.
Area where this manual applies
This manual applies to the software SIMATIC Spectation V 2.6.
Its place in the information landscape
This manual is provided in PDF format and forms part of the SIMATIC SpectationCD.
CE label
VS Link, VS Link PROFIBUS and the product family SIMATIC VS 72x meet the
requirements and protective objectives of the following EC directives:
• EC directive 89/336/EC "EMC Guideline"
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 4/62
Preface
VS 72x Communication
iv A5E00285838-01
Further support
Your Siemens partner at your regional Siemens offices and centers will provideanswers to any open questions relating to the product described in this manual.
You can find your local Siemens partner under:
http://www.siemens.com/automation/partner
Further information on Machine Vision is available on the Internet:
http://www.ad.siemens.de/machine-vision/index_00.htm
Training Center
Siemens offers corresponding courses in S7 programming and commissioning to
newcomers. Please contact your regional Training Center, or our central Training
Center in D-90327 Nuremberg.
Phone: +49 (911) 895-3200.
Internet: http://www.sitrain.com
Service & Support on the Internet
Our documentation services are complemented with a comprehensive onlineknowledge base on the Internet.
http://www.siemens.com/automation/service&support
There you can find:
• our Newsletter, providing you with up-to-data information relating to yourproduct.
• the right documentation with the help of our Service & Support search engine.
• A bulletin board, where users and specialists exchange their knowledge
worldwide.
• Your local partner for Automation & Drives.
• Information about on-site services, repairs and spare parts. Lots more is
available under "Services“.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 5/62
Preface
VS 72x Communication
A5E00285838-01 v
A&D Technical Support
Worldwide available 24 hours:
Peking
Nürnberg
Johns on City
Worldwide (Nuremberg)
Technical Support
Local time: 0:00 to 24:00 / 365 days
Phone: +49 (180) 5050-222
Fax: +49 (180) 5050-223
E-mail: adsupport@
siemens.com
GMT: +1:00
Europe / Africa (Nuremberg)
Authorization
Local time: Mon. to Fri. 8:00 to 17:00
Phone: +49 (180) 5050-222
Fax: +49 (180) 5050-223
E-mail: adsupport@
siemens.com
GMT: +1:00
United States (Johnson City)
Technical Support and
Authorization
Local time: Mon. to Fri.. 8:00 to 17:00
Phone: +1 (423) 262 2522
Fax: +1 (423) 262 2289
E-mail: simatic.hotline@
sea.siemens.com
GMT: -5:00
Asia / Australia (Beijing)
Technical Support and
Authorization
Local time: Mon. to Fri.. 8:00 to
17:00
Phone: +86 10 64 75 75 75
Fax: +86 10 64 74 74 74
E-mail: adsupport.asia@
siemens.com
GMT: +8:00
German and English are generally spoken at our Technical Support and Authorization Centers.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 6/62
Preface
VS 72x Communication
vi A5E00285838-01
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 7/62
VS 72x Communication
A5E00285838-01 vii
Contents
1 Introduction 1-1
1.1 Description of communication modes...............................................................1-1
1.2 Technical requirements for communication ......................................................1-2
2 Connecting the Vision Sensor to the PG 2-1
3 Simplified communication 3-1
3.1 Overview ...........................................................................................................3-1
3.2
Requests to VS 72x ..........................................................................................3-1
3.2.1
Standard functions (byte 0):..............................................................................3-2
3.2.2 Product ID (bytes 2 and 3) ................................................................................3-2
3.2.3 User data area (starting at byte 4) ....................................................................3-3
3.3 Response of VS 72x .........................................................................................3-3
3.3.1 Status messages (byte 0) .................................................................................3-3
3.3.2 Error code (byte 1) ............................................................................................3-3
3.3.3 Cycle counter (byte 2) .......................................................................................3-4
3.3.4 Out User 1 to 8 (byte 3).....................................................................................3-4
3.3.5 User data area ..................................................................................................3-4
3.4 Use of the VDX driver in Spectation .................................................................3-5
3.4.1 Import of values.................................................................................................3-5
3.4.2 Measured value output......................................................................................3-7
3.5
Description of the function blocks .....................................................................3-8 3.6 PROFIBUS DP communication: VS 72x Sensor – SIMATIC PLCs................3-10
3.6.1 Integration into your STEP 7 project ...............................................................3-11
3.6.2 VS Link configuration ......................................................................................3-13
3.7 Ethernet communication: VS 72x Sensor – SIMATIC PLCs..........................3-17
3.7.1 Integration into your STEP 7 project ...............................................................3-18
4 Enhanced communication on PROFIBUS / Modbus 4-1
4.1
Enhanced functionality ......................................................................................4-1
4.2 Input bytes.........................................................................................................4-3
4.3 Output bytes......................................................................................................4-3
4.4 Configuring the connection between VS Link PROFIBUS and the sensor.......4-7
4.5 Transferring data to the CPU, example with a 314C-2DP CPU .....................4-10
4.6
Adapting the settings on VS Link PROFIBUS.................................................4-12
5 Enhanced communication via Ethernet 5-1
5.1 System driver ....................................................................................................5-2
5.2 Data Link driver .................................................................................................5-4
5.3 Integration into your STEP 7 project .................................................................5-7
Index
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 8/62
Contents
VS 72x Communication
viii A5E00285838-01
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 9/62
VS 72x Communication
A5E00285838-01 1-1
1 Introduction
1.1 Description of communication modes
With Vision Sensors of the VS 72x family we basically distinguish between twocommunication modes:
• Simplified communication and
• Enhanced communication
Simplified communication
For this type of communication you can use the function blocks provided on yourCD. Select the appropriate block based on your hardware configuration. Thiscommunication method allows you to use the standard functions of the VisionSensors:
• Start / stop inspections
• Teach / 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 (block description).
Enhanced communication
For the enhanced communication functions you usually use a system / data linkdriver configuration or script programs, which you have created based on yourhardware configuration.
This communication method allows you to execute all Vision Sensor functions (see
CommandList in the Spectation Online Help).
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 10/62
Introduction
VS 72x Communication
1-2 A5E00285838-01
1.2 Technical requirements for communication
Software
• SIMATIC Spectation Version 2.6 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 communication, you also need the engineering softwareVS Link Version 1.2.3 and the GSD file.
• The communication function requires a product which has been created in
Spectation and is used to process images.
Note
For detailed information, refer to the STEP 7 documentation.
Further details on FBs are found on the Spectation CD, under VS 72X.HLP.
The specified programs and program modules should be installed on your PC/PG.
Hardware
Ethernet communication VS 72x - SIMATIC
We use the following components in our example configuration of Ethernetcommunication:
• Vision Sensor VS 72x
• CPU 314C-2 DP
• Standard CP 343-1
• ESM TP40
• Industrial Ethernet
• SIMATIC Net
• PG / PC
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 11/62
Introduction
VS 72x Communication
A5E00285838-01 1-3
L+ MEther-
net
Vision Sensor
1 2 3 4 1 2 3 4
V24
Port1 Port2 Port3 Port4
S Ports/Inputs
CPU314C CP 343-1 ESM TP40
Networking
PC/PG P R O F I B U S - D P
Ethernet
E t h e r n
e t
Fig. 1-1 Example of an Ethernet communication with VS 72x
This hardware configuration allows communication only via Ethernet TCP/IP
interface.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 12/62
Introduction
VS 72x Communication
1-4 A5E00285838-01
PROFIBUS DP communication: VS 72x Sensor - SIMATIC
However, many devices, for example the CPU (314C-2 DP), require a PROFIBUScommunication interface.
You therefore need to expand the system with a module that converts the EthernetTCP/IP signals into PROFIBUS signals. The VS Link PROFIBUS module performsthis conversion. Up to 16 Vision Sensors can be operated simultaneously.
L+ MEther-
net
Vision Sensor
CPU314C-2DP
GND/24V
Video Out
PROFIBUS-DP
RS232
Ethernet
VS Link PROFIBUS
PC / PG
Ethernet/TCP/IP
PROFIBUS-DP
Fig. 1-2 Example of a PROFIBUS DP communication with VS 72x
Note
The communication was tested using components of catalog CA 01 (10/2003 orlater).
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 13/62
Introduction
VS 72x Communication
A5E00285838-01 1-5
Decision table
The table below shows you which communication mode you can select:
Functions Communication modeCommunicationmode
StandardEnhance
d
Import ofvalues
Measuredvalue
outputSimplified Enhanced
DP+VS Link via VDX x - 28 bytes 28 bytes x -
DP+VS Link via
Modbusx - 512 bytes 512 bytes - x
Ethernet via VDX x - 60 bytes 60 bytes x -
System terminal /DataLink
x x !1 !
1 - x
The number of supported Vision Sensors depends on the driver and the amount of
transferred data per Vision Sensor.
1 Depends on the relevant communication partner
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 14/62
Introduction
VS 72x Communication
1-6 A5E00285838-01
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 15/62
VS 72x Communication
A5E00285838-01 2-1
2 Connecting the Vision Sensor to the PG
In order to be able to establish this connection, you need to define and enter the IPaddress of the Vision Sensor. To do so:
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 areshown on the next dialog box.
Fig. 2-1: Verification of the IP address and of the subnet mask
3. The first three number groups of the IP address shown here must correspondwith 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 uniquewithin your network. If uncertain, consult your system administrator. Click Edit
to modify the entry accordingly, then click OK to close the dialog box.
Also verify that the subnet mask of the PC corresponds with the Mask entry in
Spectation. Modify this address also if it differs (IP Config / All)
On the PC Communications dialog box, click Connect.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 16/62
Connecting the Vision Sensor to the PG
VS 72x Communication
2-2 A5E00285838-01
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 17/62
VS 72x Communication
A5E00285838-01 3-1
3 Simplified communication
3.1 Overview
Spectation V2.6 or higher provides you with simplified functions for thecommunication between an S7 PLC and Vision Sensor 72x via PROFIBUS DP andETHERNET. This type of communication is run via the data areas and provides theTrigger, Load, Teach, Save, Reset, Trigger mode, Run mode requests, but withreduced functionality compared with the communication mode described inchapter 4:
• The standard functions are available to the user
• On PROFIBUS DP, the system provides 28 bytes respectively for value importand measured value output.
• On ETHERNET, the system provides 60 bytes respectively for value importand measured value output.
3.2 Requests to VS 72x
Table 3-1 Request structureBit 7 6 5 4 3 2 1 0
Byte n+0 ReserveRun mode
(Inspection)
Trigger
modeReset Save Teach Load Trigger
Byte n+1 Reserve
Byte n+2
Byte n+3Product ID
Byte n+4 Start of the value import area...
Byte n+31 End of the range for PROFIBUS DP.
..
Byte n+63 End of the range for Ethernet
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 18/62
Simplified communication
VS 72x Communication
3-2 A5E00285838-01
3.2.1 Standard functions (byte 0):
Trigger (bit 0)Triggers a measurement when external trigger mode is set.
Load (bit 1)
Loads the product which has the digital product ID specified in bytes 2 / 3. Up to32768 products 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 byte 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
3.2.2 Product ID (bytes 2 and 3)
This area specifies the digital ID of the products to be loaded. The digital productID is assigned in the product management dialog box of the product menu.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 19/62
Simplified communication
VS 72x Communication
A5E00285838-01 3-3
3.2.3 User data area (starting at byte 4)
The area starting at byte 4 is available for value import. Format of data to betransferred: Byte, Integer, Float or String. Mixed format is also possible (cf. Table3-3 Index numbers for value import)
3.3 Response of VS 72x
Table 3-2 Response structure
Bit 7 6 5 4 3 2 1 0
Byte n+0 Reserve Reserve Reserve ReserveWrong
codeFail Warn Pass
Byte n+1 Error code
Byte n+2 Cycle counter
Byte n+3 Out User8
Out User7
Out User6
Out User5
Out User4
Out User3
Out User2
Out User1
Byte n+4 Start of the value output range...
Byte n+31 End of the range for PROFIBUS DP...
Byte n+63 End of the range for Ethernet
3.3.1 Status messages (byte 0)
Pass/Warn/Fail (bits 0 / 1 / 2)
Status of the most recent measurement, according to the product setting.
Wrong code (bit 3)
Indicates inconsistency between the read and the specified code.
3.3.2 Error code (byte 1)
Possible codes:
1: Error when loading the product
2: Error when saving the product
3: Trigger error
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 20/62
Simplified communication
VS 72x Communication
3-4 A5E00285838-01
3.3.3 Cycle counter (byte 2)
Increments with each measurement.
3.3.4 Out User 1 to 8 (byte 3)
Output bits which can be set based on the results of the SoftSensors.
The first 8 user-defined outputs are written to byte 3 of the answer frame.
3.3.5 User data area
The area starting at byte 4 is available for measured value output. Format of datato be transferred: Byte, Integer, Float or String. Mixed format is also possible(cf. Table 3-3 Index numbers for value import)
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 21/62
Simplified communication
VS 72x Communication
A5E00285838-01 3-5
3.4 Use of the VDX driver in Spectation
The VDX driver is enabled by default. You can disable the driver in the I/O menu
(Fig. 3-1 Enabling / disabling the driver).
Fig. 3-1 Enabling / disabling the driver
3.4.1 Import of values
Access to the relevant values of a request frame is always controlled by script. Thedecision whether to use a SoftSensor script or background script is based on the
application these data are used for.
Syntax for access to received data:
• Byte VDX_GetImportByte(int index);
• Integer VDX_GetImportInteger(int index);
• Float VDX_GetImportFloat(int index);
• String VDX_GetImportString(int index);
With index you declare the relevant start byte. The valid range of values is 0 to 27for PROFIBUS DP, and 0 to 59 for ETHERNET.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 22/62
Simplified communication
VS 72x Communication
3-6 A5E00285838-01
The table below shows you the various options of using the value import area.
Table 3-3 Index numbers for value import
Byte accessInteger
access
Float
access
String
access
Mixed mode
access
Byte n+4 Index 0Index 0Integer
Byte n+5 Index 1
Byte n+6 Index 2
Byte n+7 Index 3
Index 0 Index 0
Byte n+8 Index 4Byte n+9 Index 5
Byte n+10 Index 6Byte n+11
Index 7
Index 4 Index 4
Index 2
String
Byte n+12 Index 8
Byte n+13 Index 9
Byte n+14 Index 10
Byte n+15 Index 11
Index 8 Index 8Index 2
Float
Byte n+16 Index 12Index 12
Byte
Byte n+17 Index 13Index 13
Byte
Byte n+... Index …
Index … Index …
Index 0
Index …
Byte access
Shows the index numbers for the transfer of single-byte values.
Integer access
Shows the index numbers for the transfer of integer values only.
Float access
Shows the index numbers for the transfer of float values only.
String access
Shows the index numbers for the transfer of a string.
Mixed mode access
Shows the index numbers for applications with different formats.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 23/62
Simplified communication
VS 72x Communication
A5E00285838-01 3-7
3.4.2 Measured value output
You should use SoftSensor scripts to output the relevant measured values.
Syntax for write access to measured values in the output area:
• Byte VDX_SetOutputByte(int index);
• Integer VDX_SetOutputInteger(int index);
• Float VDX_SetOutputFloat(int index);
• String VDX_SetOutputString(int index);
Syntax for read access to measured values in the output area:
• Byte VDX_GetOutputByte(int index);
• Integer VDX_GetOutputInteger(int index);
•
Float VDX_GetOutputFloat(int index);• String VDX_GetOutputString(int index);
At index, you declare the relevant start byte. The valid range of values is 0 to 27 forPROFIBUS DP, and 0 to 59 for ETHERNET.For an example of the options of using the output area, refer to Table 3-3 Indexnumbers for value import.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 24/62
Simplified communication
VS 72x Communication
3-8 A5E00285838-01
3.5 Description of the function blocks
FB 72 for PROFIBUS DPFB 72 "VS_S7_DP" is used to establish a simplified communication via PROFIBUSDP between VS Link and an S7-300 or S7-400 PLC with integrated or externalPROFIBUS DP interface. Up to 4 VS72x Vision Sensors can be connected to the VSLink. The function block is simply called cyclically in OB1 or an OB1 subroutine.
Enter the addresses which represent the Vision Sensors on the VS Link at the
"LADDR_Camx" parameters. The addresses from HW Config have to be convertedto hex values. The same I/O addresses are then used for the relevant I/O ranges.
32 bytes input data and 32 bytes output data are used per connected VS72x. Forinformation of the structure of user data for a VS 72x, refer to the Online Help. Withthe maximum number of four Vision Sensors per VS Link, the data area consists of
128 bytes of input data and 128 bytes of output data. The data areas are declaredat the parameters "SEND" and "RECV" (ANY pointers). The data areas alwayshave a fixed length of 128 bytes.
The "RET_VAL_SEND" and "RET_VAL_RECV" parameters return information onthe cause of errors.
For further information, refer to the Online Help.
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 a simplified
communication via industrial Ethernet TCP/IP between a VS 72x and an S7 PLCwith TCP/IP-capable communication processor. In OB1 or an OB1 subroutine, callone FC 72 for each VS 72x.
The "ID" parameter specifies the connection ID from NetPro. Please make
allowances for the maximum communication resources specified in the relevanttechnical data of the CPU and of the communication processor.
The "LADDR" parameter is also returned by NetPro when you view the objectproperties of the configured connection.
FC 72 is used to transmit data with a fixed length of 64 bytes to the Vision Sensor, andto receive data with a fixed length of 64 bytes from the Vision Sensor. For informationon the structure of user data, refer to the Online Help. The data areas are declared atthe parameters "SEND" and "RECV" (ANY pointers). The data areas always have afixed length of 64 bytes.
The "ACT" parameter is used to trigger the send job to the VS72x.72 The data are
then transferred once, and "ACT" is reset. The data are received at every call ofthe FC 72, irrespective of "ACT".
Error-free execution is signaled if the complete user data area was transferred viaEthernet and the value at the "ERROR_SEND " and "ERROR_RECV" parameters is"0". The "RET_VAL_SEND" and "RET_VAL_RECV" parameters should beevaluated when "ERROR_SEND" or "ERROR_RECV" is "1".
For further information, refer to the Online Help.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 25/62
Simplified communication
VS 72x Communication
A5E00285838-01 3-9
Loading function blocks
The function blocks are stored in the VS72x library on the installation CD ofSIMATIC Spectation, in the folder //Communication/Function Blocks/...
In STEP 7, unpack the zipped blocks archives to this folder, then save them inSTEP 7 to .../S7LIBs.
Block overview
Blocks available for simplified communication between VS 72x and SIMATIC:
PLC Block Block name Communicationmode
S7-300/S7-400 FB 72 VS_S7_DP PROFIBUS DP
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 theconfigured communication mode (PROFIBUS or Ethernet) and the PLC (S7-300or S7-400).
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 26/62
Simplified communication
VS 72x Communication
3-10 A5E00285838-01
3.6 PROFIBUS DP communication: VS 72x Sensor –SIMATIC PLCs
Simplified communication PROFIBUS DP + VSLink via PROFIBUS DP allows youthe transfer of up to 28 bytes of user data.
L+ MEther-
net
Vision Sensor
CPU314C-2DP
GND/24V
Video Out
PROFIBUS-DP
RS232
Ethernet
VS Link PROFIBUS
PC / PG
Ethernet
PROFIBUS-DP
Fig. 3-2 Example of a PROFIBUS DP communication with VS 72x
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 27/62
Simplified communication
VS 72x Communication
A5E00285838-01 3-11
3.6.1 Integration into your STEP 7 project
HardwareYou have configured your hardware in HW Config. Open the hardware catalog.Select the entry VS Link under PROFIBUS-DP/Sensor system/VSLink.
Drag-and-drop this entry to your PROFIBUS segment. Set the PROFIBUS DPaddress of the VS Link in the properties menu. This address must correspond withthe hardware coding switch settings on the module.
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 double-click.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 28/62
Simplified communication
VS 72x Communication
3-12 A5E00285838-01
Software
Copy FB 72 from the Block catalog/Libraries/VS72xSensor/PROFIBUS folder toOB1.
Add the instance data block DB 72 to the instruction set.
STL: Explanation:CALL "VS_S7_DP" , DB72LADDR_CAM1 :=W#16#00 The start addressesLADDR_CAM2 : of the I/O areaLADDR_CAM3 :LADDR_CAM4 :RECV :=P#DB75.DBX0.0 BYTE 128 received dataSEND :=P#DB75.DBX128.0 BYTE 128 send dataRET_VAL_RECV :=MW10 // Status display
// receiptRET_VAL_SEND :=MW302 // Status display send
Declare the addresses which represent the Vision Sensors on the VS Link at the"LADDR_Camx" parameters. The addresses from HW Config have to be convertedto hex values. The same I/O addresses have to be used for the respective inputand output ranges.
32 bytes input data and 32 bytes output data are used per connected VS72x. Forinformation on the structure of user data for a VS 72x, refer to the Online Help.With the maximum number of four Vision Sensors per VS Link, the data areaconsists of 128 bytes of input data and 128 bytes of output data. The data areasare declared at the parameters "SEND" and "RECV" (ANY pointers). The dataareas always have a fixed length of 128 bytes.
The "RET_VAL_SEND" and "RET_VAL_RECV" parameters return information onthe cause of errors.
Note
Always ensure that the length of user data in the I/O area of the FB correspondswith the size you configured in your STEP 7 project (HW Config).
For further information, refer to the Online Help.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 29/62
Simplified communication
VS 72x Communication
A5E00285838-01 3-13
3.6.2 VS Link configuration
DP addressAt the VS Link PROFIBUS, set the module's PROFIBUS address you have definedin the hardware configuration in STEP 7. This is set directly at the device by meansof two dials:
Fig. 3-3 Setting the address on VS Link PROFIBUS
Set address "3", i.e. set the upper one of the dials to "0", the lower one to "3"(the address is read from the right to the left: 03).
Tip: You can generally calculate the address as follows:Address = 10 x upper + lower value)
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 30/62
Simplified communication
VS 72x Communication
3-14 A5E00285838-01
Configuring the I/O areas
In your VS Link software, proceed as follows:
Open the "Configure -> Project parameters" menu, select the "PROFIBUS" tab and
set the data volume for cyclic transfer. If you have connected a VS 72x to VS Link,enter 32 bytes (for two Vision Sensors 64 bytes, for three Vision Sensors 96 bytesetc.)
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 31/62
Simplified communication
VS 72x Communication
A5E00285838-01 3-15
Configuring the connection to the Vision Sensor
Select the "Add -> Connection" menu, then enter the IP address of the VS 72x an.Also, set port number 3246 and the "Use Vision Data Exchange (VDX) option. In
addition, you can define the update rate and the DB to be used (in this case,"Block 1").
Update rate: Specifies the time interval in [ms] between frames exchangedbetween VS Link and the Vision Sensor. The intervals should be shorter than theCPU scan cycle time, for example, 10 ms.
DataBlock1: Address range of Vision Sensor 1 etc.
Downloading the configuration data to VS Link
1. In the "Configure" menu, click "Remote System"
Fig. 3-4: "Configure remote system" view
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 32/62
Simplified communication
VS 72x Communication
3-16 A5E00285838-01
2. After having selected the appropriate communication interface, click "Connect".The "Manage remote system" dialog box appears.
3. On the first tab, click "Download configuration data" and "Save to VS Link."
4. Verify your Ethernet settings and confirm "Save configuration data to Flash" onthe VS Link with "Yes".
Fig. 3-5: "Manage remote system" view
Note
The Ethernet network parameters indicate the IP address, mask and gateway of theVS Link station. These data do not refer to the PC on which you have created theVS Link project. The VS Link station uses these settings in runtime. The Ethernetparameters of the PC are used for test mode.
5. Click OK to confirm your parameter settings. Close the "Manage remotesystem" dialog box, then cycle power on the VS Link station. This step isrequired in order to initialize the Ethernet parameters in the internal memory ofthe device.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 33/62
Simplified communication
VS 72x Communication
A5E00285838-01 3-17
3.7 Ethernet communication: VS 72x Sensor –SIMATIC PLCs
Communication via Ethernet and VDX driver allows you to transfer up to 60 bytesof user data.
L+ MEther-
net
Vision Sensor
1 2 3 4 1 2 3 4
V24
Port1 Port2 Port3 Port4
S Ports/Inputs
CPU314C CP 343-1 ESM TP40
Networking
PC/PG P R O F I B U S - D P
Ethernet
E t h e r n e t
Fig. 3-6 Example of an Ethernet communication with VS 72x
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 34/62
Simplified communication
VS 72x Communication
3-18 A5E00285838-01
3.7.1 Integration into your STEP 7 project
HardwareOpen NetPro to create a new TCP connection to a non-specified partner. Selectactive connection from the "General" tab.
On the "Address" tab, enter the IP address of the Vision Sensor(cf. chapter 2: Connecting the Vision Sensor to the PG) and port number 7500.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 35/62
Simplified communication
VS 72x Communication
A5E00285838-01 3-19
Software
Select the corresponding FB for your system family form theLibraries/VS72xSeries/Industrial Ethernet catalog and add it to OB1.
To add FC 72 for Ethernet to your STEP 7 program:
STL: Explanation:CALL "VS_300_IE"ID:=1 Connection ID from
NetPro, Block parameterLADDR:=W#16#100 Base address of the
IE-CP, Block parameterSEND:=P#DB75.DBX0.0 BYTE 128 Send user data areaRECV:=P#DB75.DBX128.0 BYTE 128 Receive area
user dataRET_VAL_SEND :=MW300 // Status display sendRET_VAL_RECV :=MW300 // Status display
// receiptERROR_SEND:=M0.0 Error analysisERROR_RECV:=M0.2 Error analysis
ACT:=M0.1 Job initiation
The "ID" parameter specifies the connection ID from NetPro. Please makeallowances for the maximum communication resources specified in the relevanttechnical data of the CPU and of the communication processor.
The "LADDR" parameter is also received from NetPro when you view the objectproperties of the configured connection.
FC 72 is used to transmit data with a fixed length of 64 bytes to the Vision Sensor, andto receive data with a fixed length of 64 bytes from the Vision Sensor. For informationon the structure of user data, refer to the Online Help. The data areas are declared atthe parameters "SEND" and "RECV" (ANY pointers). The data areas always have afixed length of 64 bytes.
The "ACT" parameter is used to trigger the send job to the VS72x.72 The data arethen transferred once, and "ACT" is reset. The data are received at every call ofthe FC 72, irrespective of "ACT".
Error-free execution is signaled if the complete user data area was transferred viaEthernet and the value at the "ERROR_SEND " and "ERROR_RECV" parameters is
"0". The "RET_VAL_SEND" and "RET_VAL_RECV" parameters should beevaluated when "ERROR_SEND" or "ERROR_RECV" is "1".
For further information, refer to the Online Help.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 36/62
Simplified communication
VS 72x Communication
3-20 A5E00285838-01
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 37/62
VS 72x Communication
A5E00285838-01 4-1
4 Enhanced communication onPROFIBUS / Modbus
In this communication mode, data are exchanged between the CPU and the VisionSensor via PROFIBUS and Modbus, with signals being converted by VS LINKPROFIBUS DP.
In order to control the Vision Sensor or output measured values when this methodis used, you need to run scripts which map the data to the virtual I/Os. You couldalso control the Vision Sensor by means of background script and output the status
bits.For further information on virtual I/Os and script programming, refer to theSpectation Online Help.
Special features of this communication method:
• VS Link always operates in slave mode on PROFIBUS and Modbus.
• Frames are exchanged cyclically with the Vision Sensor via Ethernet.
• VS Link maps the user data in the frame from Modbus to PROFIBUS and vice
versa.
4.1 Enhanced functionality
• More values can be transferred
• 14 additional user-defined inputs
• 8 additional user outputs
• 24 additional user-defined outputs
• Additional status bits: Busy, 3 Strobe, Resource Conflict, Select Pass, SelectFail, Acquiring, Inspecting, Inspect Toggle
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 38/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
4-2 A5E00285838-01
SIMATIC VS 72x Register and I/O Map
Bit PositionSiemens-
Register 7 6 5 4 3 2 1 0Type
Bit 63 Bit 62 Bit 61 Bit 60 Bit 59 Bit 58 Bit 57 Bit 560
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 481
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 402
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 323
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 244
Output 31 Output 30 Output 29 Output 28 Output 27 Output 26 Output 25 Output 24
Bit 23 Bit 22 Bit 21 Bit 20 Bit 19 Bit 18 Bit 17 Bit 16
5Reserve
Wrong
CodeStrobe 2 Strobe 3 Reserve
Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8
6 Inspect
toggle
Inspecting Acquiring Reserve
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
7 Select Fail Select
Pass
Res.
Conflict
Strobe Busy Fail Warn Pass
Output
Bit 31 Bit 30 Bit 29 Bit 28 Bit 27 Bit 26 Bit 25 Bit 248
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 169
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 810
Prod Id 13 Prod Id 12 Prod Id 11 Prod Id 10 Prod Id 9 Prod Id 8 Prod Id 7 Prod Id 6
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 011
Prod Id 5 Prod Id 4 Prod Id 3 Prod Id 2 Prod Id 1 Prod Id 0 Select Trigger
Input
12Reg 12
Bit 7
Reg 12
Bit 6
Reg 12
Bit 5
Reg 12
Bit 4
Reg 12
Bit 3
Reg 12
Bit 2
Reg 12
Bit 1
Reg 12
Bit 0
-- ---
16382 Reg 16382
Bit 7
Reg 16382
Bit 6
Reg 16382
Bit 5
Reg 16382
Bit 4
Reg 16382
Bit 3
Reg 16382
Bit 2
Reg 16382
Bit 1
Reg 16382
Bit 0
16383 Reg 16383
Bit 7
Reg 16383
Bit 6
Reg 16383
Bit 5
Reg 16383
Bit 4
Reg 16383
Bit 3
Reg 16383
Bit 2
Reg 16383
Bit 1
Reg 16383
Bit 0
General
Purpose
Table 4-1: SIMATIC VS 72x Register and I/O Map
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 39/62
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 40/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
4-4 A5E00285838-01
Resource Conflict (Bit 5)
Shows that both image memories for the Vision Sensor are full and that noadditional images can be acquired.
Select Pass / Select Fail (Bit 6 und Bit 7)
Shows that has been successfully transferred.
Acquiring (Bit 13)
Shows that an image is being acquired.
Inspecting (Bit 14)
Shows that the product is running.
Inspect toggle (Bit 16)
Toggles at each inspection..
Wrong code (bit 21)
Indicates inconsistency between the read and the specified code.
Output (Bit 24–31 und Bit 48–63)Virtual outputs which cannot be set by the system. These can be set with scripts.
User (Bit 32–47)
These are outputs which can be set by the SoftSensors.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 41/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
A5E00285838-01 4-5
Sample configuration
L+ MEther-
net
Vision Sensor
CPU314C-2DP
GND/24V
Video Out
PROFIBUS-DP
RS232
Ethernet
VS Link PROFIBUS
PC / PG
Ethernet/Modbus
PROFIBUS-DP
Fig. 4-1 Example of a PROFIBUS DP communication with VS 72x
Triggering a measurement
Prerequisite for triggering the Vision Sensors is, that the registers have beenmapped, external trigger mode is set and inspection mode is enabled. If all theseconditions are met, a measurement is triggered at each positive edge of the triggerbit.
You should create an empty dummy program in order to ensure automaticactivation of the inspection mode. The system loads this program automaticallyafter POWER ON. You only need to do this if you have not defined a "startinspection" program yet.
Reloading the product
You load the products based on the digital ID set in the product managementdialog. 15 product ID bits are available at the virtual inputs. You need to write theID of the required product in binary format to these bits. Please note, that you donot have two complete reserved bytes available when you write the product ID, andthat these 15 bits are distributed across 3 bytes or registers. A positive edge on theSelect bit loads a product.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 42/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
4-6 A5E00285838-01
Import of values
Additional values which may need to be transferred alongside with the controlfunctions must be located in the data area and appended to the instruction set
containing the control functions. Because you only have up to four bytes for controlfunctions, the area for the import of values starts at byte n+4.
The imported values are processed with scripts. Whether a SoftSensor script or
background script is used, is determined by your application.
The example below shows a SoftSensor script named "Position" that returns acoordinate for the product.
class Position
{
public void inspect()
{
this.Point.X=RegisterReadFloat(204);
this.Point.X=RegisterReadFloat(208);
}
}
A float number is read from the registers 204 and 208 and output by the script ascoordinate. This allows you to reference other SoftSensors to this coordinate. Bothvalues use four registers, because the value is read from the register in floatformat. 204 and 208 define the start register for reading the value.
Measured value output
Same as for value import, you need to make sure that you output measured values
only to areas which do not overlap your virtual outputs. Hence, the output area formeasured values would start at byte n+8, because you only have up to eight bytesfor virtual outputs.
Measured value output is controlled by script, same as the value import function.The decision whether to use a SoftSensor or background script is determined bythe way measured values are generated.
The example below shows you a SoftSensor script named "Result", which returnsthe 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 registers108-111. These four registers are required, because the value is written in integerformat. 108 defines the start register for writing the value.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 43/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
A5E00285838-01 4-7
4.4 Configuring the connection betweenVS Link PROFIBUS and the sensor
In order to transfer measurement data to the PLC via PROFIBUS, you need toestablish a bi-directional Modbus communication to VS Link PROFIBUS. Proceedas follows:
1. In SIMATIC Spectation, select the Input/Output > Modbus Master command.
2. On the next dialog box, click New.
A new connection is inserted.
3. Click the new connection to select it, then click Edit.
4. In the Slave IP address box, enter the VS Link PROFIBUS address. Make the
other entries according to the figure below:
Fig. 4-2: Configuring the connection to VS Link PROFIBUS
Note
Please note that one Modbus register occupies two bytes, and one Siemensregister occupies only one byte
5. Click OK to close the dialog box
6. On the Modbus Master dialog box, click New again to insert a further
connection
7. Select this new connection also, then click Edit
8. In the Slave IP Master box, enter the same address as the one for the
connection you created earlier. Make the other entries according to the figure
below:
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 44/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
4-8 A5E00285838-01
Fig. 4-3: Configuration of the connection from VS Link PROFIBUS
9. Click OK to close the dialog box.
10. In the Modbus Master dialog box, click Start.
11. Click OK to close the dialog box.
Description of the parameters
Parameter name Description
Name user-specific
Slave IP IP address of VS Link
Command • Read Multiple Register (fetch data from VS Link)
• Write Multiple Register (write data from VS Link)
Register start slave Start register of the used area in VS Link
• Register 1000-1511 data from Modbus to PROFIBUS
• Register 2000-2511 data from PROFIBUS to Modbus
Register start Start register of the used area in the Vision Sensor
Number of registers Length of send data
Polling stations Frame interval between VS Link and Vision Sensor in [ms]. The polling rateshould be shorter than the CPU scan cycle time, for example, 10 ms.
Timeout Timeout for VS Link
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 45/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
A5E00285838-01 4-9
Mapping of the virtual inputs
In order to be able to control the Vision Sensor via Modbus, you need to programan 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 onModbus.
The background script below shows you the simplest way of transferring therequired data:
class MapToVirtual_IO{
public static void main(){
//Maps the virtual outputs//to the outputs registers of ModbusRegisterWriteByte(100,0);RegisterWriteByte(101,1);RegisterWriteByte(102,2);RegisterWriteByte(103,3);RegisterWriteByte(104,4);RegisterWriteByte(105,5);RegisterWriteByte(106,6);RegisterWriteByte(107,7);
//maps the first four input registers of Modbus//to the virtual inputsRegisterWriteByte(8,200);
RegisterWriteByte(9,201);RegisterWriteByte(10,202);RegisterWriteByte(11,203);
}}
The first instruction set writes the virtual outputs (register 07) to registers 100–107.The second instruction set writes the registers 200–203 to the virtual inputs(registers 8–11).
The script property "Run after power on" must be set.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 46/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
4-10 A5E00285838-01
4.5 Transferring data to the CPU, example with a 314C-2DPCPU
Hardware
You have configured your hardware in HW Config. Open the hardware catalog.Select the entry VS Link under PROFIBUS-DP/Sensor system/VSLink.
Drag-and-drop this entry to your PROFIBUS segment. Set the PROFIBUS DPaddress of the VS Link in the properties menu. This address must correspond withthe hardware coding switch settings on the module.
Under VS Link, fetch the universal module from the hardware catalog.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 47/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
A5E00285838-01 4-11
Software
Copy SFCs 14 and 15 from the Block catalog/Libraries/Standard library/SystemFunction Blocks folder to OB1.
// Receiving data via PROFIBUSCALL "DPRD_DAT"
LADDR :=W#16#0RET_VAL:=MW16RECORD :=P#DB16.DBX0.0 BYTE 4
// Sending data via PROFIBUSCALL "DPWR_DAT"
LADDR :=W#16#0RECORD :=P#DB16.DBX0.0 BYTE 4RET_VAL:=MW16
Enter the addresses which represent the Vision Sensors on the VS Link in the"LADDR" parameters. The addresses from HW Config have to be converted to hexvalues. Write the addresses for the input area to SFC 14, and those for the outputarea to SFC 15.
For further information, refer to the Online Help.
This concludes the configuration of data transfer to the CPU via PROFIBUS DP.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 48/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
4-12 A5E00285838-01
4.6 Adapting the settings on VS Link PROFIBUS
DP address
At VS Link PROFIBUS, set the module's PROFIBUS address you have defined inyour hardware configuration in STEP 7. This is set directly at the device by meansof two dials:
Fig. 4-4 Setting the address on VS Link PROFIBUS
Set address "2", i.e. set the upper one of the dials to "0", the lower one to "2" (theaddress is read from the right to the left: 02).
Tip: You can generally calculate the address as follows:Address = 10 x upper + lower value)
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 49/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
A5E00285838-01 4-13
Configuring the I/O areas
In your VS Link software, proceed as follows:
Open the "Configure -> Project parameters" menu, select the "PROFIBUS" tab and
enter the data volume for cyclic transfer. Enter the I/O lengths as defined inHW Config.
Next, select "Configuration -> Remote system" to download the configuration datato VS Link. In the next view, "Configure remote system", download yourconfiguration data to VS Link.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 50/62
Enhanced communication on PROFIBUS / Modbus
VS 72x Communication
4-14 A5E00285838-01
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 51/62
VS 72x Communication
A5E00285838-01 5-1
5 Enhanced communication via Ethernet
Sample configuration
L+ M Ether-net
Vision Sensor
1 2 3 4 1 2 3 4
V24
Port1 Port2 Port3 Port4
S Ports/Inputs
CPU314C CP 343-1 ESM TP40
Networking
PC/PG P R
O F I B U S - D P
Ethernet
E t
h e r n e t
Fig. 5-1 Example of an Ethernet communication with VS 72x
Two modes are available for enhanced communication via Ethernet:
1.System / Data Link driver:
These two standard drivers are offered by the Spectation firmware. The systemdriver is used to control the Vision Sensor, and is also used in the Spectationsoftware to configure the Vision Sensor. The Data Link driver is used to outputmeasured values. Both drivers are based on the TCP/IP protocol and provide userdata in ASCII format.
2. Socket objects and background script
This version allows you to program a user-specific frame based on backgroundscript and on the socket objects included in Spectation. This allows you to establishconnections to almost any station capable of operating via Ethernet and TCP/IP.
For detailed information, refer to the Spectation Online Help
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 52/62
Enhanced communication via Ethernet
VS 72x Communication
5-2 A5E00285838-01
5.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, youcan also use this driver to call all Command List functions.
Extract from the Command List:
• Modifying communication settings
• Creating, deleting and modifying products
• 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 product data
• Reading SoftSensor data
For detailed information, refer to the Spectation Online Help
Frame structure
All commands output to the Vision Sensor by means of the system driver consist ofan init character "#", the command itself, e.g. Y+, and of 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) andcontinuous (continuous mode) measurements.
For continuous mode, the internal trigger of the sensor is set, inspection mode isinitiated by the "#Y+<CrLf> " command, and stopped with "#Y-<CrLf> ".
In single-mode, the sensor is triggered by external signals. This function is enabled
with a "#Yp-<CrLf> " command, and disabled with "#Yp+<CrLf> ".A measurement is triggered with the "#YI<CrLf> " command. Inspection mode must
be enabled, same as for continuous mode.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 53/62
Enhanced communication via Ethernet
VS 72x Communication
A5E00285838-01 5-3
Reloading products
Inspection products are reloaded based on the product ID assigned by the system.This has nothing to do with the digital product ID.
The product is selected with the "#PIxx<CrLf> " command; xx stands for therelevant product ID.
You can view the product ID on a Telnet terminal, by entering "#PQ<CrLf> " at the
command line.
On the Windows taskbar, click Start > Run.On the command line, type in Telnet (IP address of the Vision Sensors) 3246, thenclick OK.Next, type in the command "#PQ " and press Enter. A list of all created products
and their ID appears.
Import of valuesYou can write values directly to the Vision Sensor registers. This requires thecommand "#RsxxYzz<CrLf>" ; 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 float format to register 100.
For a list of available formats and their identifiers, refer to the Spectation OnlineHelp.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 54/62
Enhanced communication via Ethernet
VS 72x Communication
5-4 A5E00285838-01
5.2 Data Link driver
You can use the Data Link deriver to output measured values. Up to 10 output
strings can be configured and assigned separate send conditions. In addition, youcan configure substitutions for faulty measurements.
The configuration of the output string is associated with the product, i.e. eachproduct is assigned a separate configuration. It is not possible to create aconfiguration without having first selected a product.
Note
Measured values are only output when inspection mode is enabled.
Configuring data output
To configure the Data Link driver, select the item Data Link 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 configuredSoftSensors.
SIMATIC S7 CPs require a constant data length. Usually, you should configureonly one string that contains all vital data. If your application requires more thanone 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 product, thesestrings must, of course, have the same length.
The string content is declared in the String register. You can enter user-specifictexts, or insert measured values from a SoftSensor shown in the selection box onthe right.
Press the Enter key or click "EOL" to insert an end-of-line character. This may berequired for some communication partners. SIMATIC S7 CPs do not use an "EOL"character for TCP connections.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 55/62
Enhanced communication via Ethernet
VS 72x Communication
A5E00285838-01 5-5
With a click on Format you can call a function that allows you to set fixed formatsand lengths for the measured values returned by the SoftSensors. This is alwaysrequired for communication partners which do not respond to an "EOL" character,but rather to a fixed frame length.
Type in "Test SIMATIC 724" at the input box, then press Return or click "EOL".
General settings can be made in the "General" tab.
Under "Error code", you can set substitution values. You should select the "Value"entry when using a SIMATIC S7 CP. This maintains a constant length of the outputstring after an error has occurred, and thus ensures error-free data transfers to theSIMATIC S7 CPs.
At the "Transmission rate" parameter, you can 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 arephysically shorter than the formatted length, the value is assigned a placeholderprefix. You can choose one of two types of placeholder: Zeroes or spacecharacters.
If a communication partner is unable to interpret data formatted in XML, you canhere enable this output format.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 56/62
Enhanced communication via Ethernet
VS 72x Communication
5-6 A5E00285838-01
Enabling inspection mode
Enable inspection mode
Fig. 5-2 Enabling inspection mode; standard bar on the left, enhanced bar on the right
Testing measured value output
Next, verify data output using the standard WindowsTelnet terminal: On the Windows taskbar, click Start > Run. On the command line,
type in Telnet (IP address of the Vision Sensors) 3247, then click OK.
If everything has been configured correctly, the "Test VS 724" message should beoutput.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 57/62
Enhanced communication via Ethernet
VS 72x Communication
A5E00285838-01 5-7
5.3 Integration into your STEP 7 project
Hardware
Open NetPro and then create two new TCP connection to a non-specified partner.On the "General" tab, select active login for each connection.
On the "Address" tab, enter the IP address of the Vision Sensors
(cf. chapter 2: Connecting the Vision Sensor to the PG) and port number 3246 forthe system driver, or 3247 for the Data Link driver.
Fig. 5-3 System driver
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 58/62
Enhanced communication via Ethernet
VS 72x Communication
5-8 A5E00285838-01
Fig. 5-4 Data Link driver
Software
Function block FC5 "AG_SEND" is required to control the Vision Sensor by meansof the system driver. This function block transfers the data from the CPU to the CP.Based on the previously configured connection and this block, the CP automaticallygenerates the TCP/IP frame and embeds the user data in this frame.
According to your system family, select this function block from theLibraries/SIMATIC_NET_CP catalog and add it to OB1.
STL: Explanation:CALL "AG_SEND"
ACT :=M1.0 Starts the send operationID :=1 Connection ID from NetProLADDR :=W#16#100 Base address of the CPSEND :=P#DB1.DBX 0.0 BYTE 20 Data area to be
transferredLEN :=20 Length of data to be sentin [bytes]DONE :=M2.0 Indicates completion of a
jobERROR :=M2.1 Indicates errorsSTATUS :=MW4 Indicates the block status
Note
Make sure that each frame is terminated with the "End-of-Line" character <CrLf>.The "LEN" parameter should only contain the actual number of bytes used.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 59/62
Enhanced communication via Ethernet
VS 72x Communication
A5E00285838-01 5-9
A string is output at the Data Link port after each measurement, provided this portis configured. The CP receives the frames based on the configured connection.The CP automatically removes the TCP/IP frame and provides the data to theCPU. 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 theLibraries/SIMATIC_NET_CP catalog and add it to OB1.
STL: Explanation:CALL "AG_RECV"ID :=2 Connection ID from NetProLADDR :=W#16#100 Base address of the CPRECV :=P#DB2.DBX 0.0 BYTE 17 Target area for received
dataNDR :=M3.0 Indicates the presence of
new data
ERROR :=M3.1 Indicates errorsSTATUS :=MW6 Indicates the block statusLEN :=MW8 Number of received bytes
The setting at parameter "Recv" is of importance for this block. A data area isopened on the CP based on the number of received bytes. After these 17 bytes arefilled with data, the data are transferred to the CPU, i.e. when the length ofreceived data is shorter than the configured, the bytes of the next frame aretransferred to this data block and vice versa. The consequence is, that the DBstarts processing these received data, i.e. the start point of a data block thereforefluctuates within the DB.
All numerical values in the Data Link are initially interpreted as ASCII-based string.STEP 7 provides various conversion blocks for reconverting this string into anumber format. Be aware, however, of the different structure of the string format inSIMATIC S7 and Spectation. In SIMATIC S7, the string content is added a two-byte prefix. The first byte contains the total number of characters reserved for thevariable, and the second contains the actual number of characters used.Spectation does not provide these two bytes.As a consequence, when using a conversion block, you first need to cut therelevant numerical value from the data block and then add the two-byte prefix tothe 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.
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 60/62
Enhanced communication via Ethernet
VS 72x Communication
5-10 A5E00285838-01
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 61/62
VS 72x Communication
A5E00285838-01 Index-1
Index
B
Block nameVS_300_IE................................................. 3-9VS_400_IE................................................. 3-9VS_S7_DP................................................. 3-9
Byte access ................................................... 3-6
C
communicationenhanced ................................................... 1-1simplified.................................................... 1-1
CommunicationEnhanced................................................ . 4-10Ethernet ................................................... 3-17
Communication mode.................................... 1-5DP+VS Link via Modbus ............................ 1-5DP+VS Link via VDX.................................. 1-5Ethernet via VDX ....................................... 1-5System terminal / DataLink........................ 1-5
Configuring connections ................................ 4-7Configuring data output.................................. 5-4Configuring the I/O areas.................... 3-14, 4-13Connection configuration ............................. 3-15
D
Data Link driver.............................................. 5-4Decision table ............................................... . 1-5Downloading configuration data................... 3-15
E
Enabling inspection mode.............................. 5-6Enhanced communication via Ethernet.......... 5-1Enhanced functionality................................... 4-1Example
Ethernet connection.......................... 1-4, 3-17
PROFIBUS DP........................................... 4-5PROFIBUS-DP ................................. 1-4, 3-10
F
FB 72 for PROFIBUS DP............................... 3-8FC 72 "VS_300_IE“ for S7-300........... .......... 3-8FC 72 "VS_400_IE for S7-400...................... 3-8Float access................................................... 3-6Frame structure.............................................. 5-2Function blocks
Description................................................. 3-8loading .............................................. ......... 3-9
H
Hardware requirements..................................1-2
I
Import of values............................... 3-5, 4-6, 5-3Integer access........................................... .....3-6Integration into your STEP 7 project............3-11,
......................................................... .3-18, 5-7
M
Mapping of the virtual inputs...........................4-9Measured value output............................3-7, 4-6Mixed mode access........................................3-6
P
Parameter description ....................................4-8PROFIBUS DP communication........ ............3-10
Block overview ...........................................3-9Configuration ............................................3-13configuring............................................... .4-13
R
Reloading products ........................................5-3Reloading the product ....................................4-5Request structure ...........................................3-1Requests to VS 72x........................................3-1Response of VS 72x.......................................3-3
S
Setting the address .............................3-13, 4-12Socket objects and background script............5-1Software requirements ...................................1-2Standard functions ..................................1-1, 3-2
Error feedback / diagnostics.......................1-1Import values..............................................1-1Load (bit 1) ............................................... ..3-2Output measured value ..............................1-1Reset (bit 4)................................................3-2Run mode (bit 6).........................................3-2Save (bit 3).................................................3-2Teach / Save ........................................... ...1-1Teach-in (Bit 2)...........................................3-2Trigger (bit 0)..............................................3-2Trigger mode (bit 5)....................................3-2
Start / stop inspections...................................1-1Status messages............................................3-3
7/24/2019 Vs 72x Communication b
http://slidepdf.com/reader/full/vs-72x-communication-b 62/62
Recommended