Sunteți pe pagina 1din 33

Cover

Flexible Decoding and Processing of Data Matrix Codes with S7-1200


with S7-1200, HawkEye HE40, PC Access and KTP600 Configuration Example x27 January 2010

Applications & Tools


Answers for industry.

Industry Automation and Drives Technologies Service & Support Portal This article is taken from the Service Portal of Siemens AG, Industry Automation and Drives Technologies. The following link takes you directly to the download page of this document. http://support.automation.siemens.com/WW/view/en/40603943

For questions about this document please use the following e-mail address: online-support.automation@siemens.com

Copyright Siemens AG 2010 All rights reserved

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

Automation Task

1 2 3 4 5

Automation Solution

Configuration

SIMATIC CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200

Code Elements

History

Copyright Siemens AG 2010 All rights reserved

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

Warranty and Liability

Warranty and Liability


Note The Application Examples are not binding and do not claim to be complete regarding the circuits shown, equipping and any eventuality. The application examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for ensuring that the described products are used correctly. These application examples do not relieve you of the responsibility of safely and professionally using, installing, operating and servicing equipment. When using these application examples, you recognize that we cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these application examples at any time without prior notice. If there are any deviations between the recommendations provided in this application example and other Siemens publications e.g. Catalogs the contents of the other documents have priority. We do not accept any liability for the information contained in this document. Any claims against us based on whatever legal reason resulting from the use of the examples, information, programs, engineering and performance data etc., described in this Application Example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (Produkthaftungsgesetz), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract (wesentliche Vertragspflichten). The damages for a breach of a substantial contractual obligation are, however, limited to the foreseeable damage, typical for the type of contract, except in the event of intent or gross negligence or injury to life, body or health. The above provisions do not imply a change of the burden of proof to your detriment. It is not permissible to transfer or copy these application examples or excerpts of them without having prior authorization from Siemens Industry Sector in writing.

Copyright Siemens AG 2010 All rights reserved

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

Table of Contents

Table of Contents
Warranty and Liability ................................................................................................. 4 1 Automation Task................................................................................................ 6 1.1 1.2 2 2.1 2.2 2.3 2.4 3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 4 5 Application automation task ................................................................. 6 List of components ............................................................................... 7 Wiring diagram ..................................................................................... 9 Scanning and processing of Data Matrix code .................................. 10 Communication with the code scanner .............................................. 13 HawkEye4x function block............................................................... 18 Installing and wiring hardware............................................................ 19 Connect S7-1200 with PG/PC............................................................ 20 Load project in the S7-1200 CPU1214C............................................ 21 Load project into the SIMATIC Panel KTP600................................... 22 Using PC runtime instead of the panel............................................... 23 Initializing and configuring the HawkEye scanner with Data Matrix codes .................................................................................................. 24 Configuring the PC Access OPC server ............................................ 26 Configuring Microsoft Access............................................................. 28 Generating own Data Matrix code...................................................... 29 Operation of the application via HMI .................................................. 30

Automation Solution ......................................................................................... 9

Configuration ................................................................................................... 19

Copyright Siemens AG 2010 All rights reserved

Code Elements................................................................................................. 32 History............................................................................................................... 33

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

1 Automation Task

1
1.1

Automation Task
Application automation task
At a companys goods receipt delivered goods are to be recorded by the HawkEye HE40 Data Matrix code scanner. The scanner is to transfer the read data via a serial connection using a RS232 communication module CM1241 to a S7-1200 controller (CPU1214C). To be able to scan bulky goods it will furthermore be possible to buffer the read data, whilst there is no connection to the controller. In this case, the reading of the buffered data will take place automatically after restoring the connection to the controller. To identify the recorded products, the program of the S7-1200 is to pass on the read ID code to a PC via the Ethernet interface. The OPC server PC ACCESS installed there presents the connecting link to a downstream database (e.g. MS ACCESS), in which the product description of the read code is searched in the selected language. The product description is then re-transferred via the OPC server back to the S7-1200 controller and is then displayed on a Basic Panel KTP600.

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

Parallel to the reading process of each product a time stamp it to be recorded in the database. STEP7 Basic v10.5 is to be used as configuration tool for the control program and the HMI.
Figure 1-1

Goods receipt; checking of goods

PC database

Combined this leads to the following scenarios: scanning and displaying of Data Matrix Code registration and evaluation of Data Matrix Code by means of database scanning and buffering of data in Data Matrix code scanner

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

1 Automation Task
Figure 1-2

5 1 2 3 4

Ethernet

8
Microsoft ACCESS

6
RS232

PC database PC Access

1
Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

Power Supply

2 6

CM1241 RS232

3 7

S7-1200 CPU 1214C

4 Switch CSM 1277

5 KTP 600 PN

HawkEye HE40

PC Access

Microsoft ACCESS database

1.2
Products
Table 1-1

List of components

Components 1. 2. 3. 4. 5. 6. PM1207 Power supply RS232 communication module CM1241 S7-1200 CPU1214C Compact Switch Module CSM1277 Basic KTP600 panel (color, PN) SIMATIC HE 40 handheld code reader optional: HE 40T HE 45 HE 45T

Qty 1 1 1 1 1 1 6GF

MLFB / Order number 6EP1332-1SH71 6ES7241-1AH30-0XB0 6ES7214-1AE30-0XB0 6GK7277-1AA00-0AA0 6AV6647-0AD11-3AX0 3020-0HE40-0XX4 Optional: 6GF 3020-0HT40-0XX4 6GF 3020-0HE45-0XX4 6GF 3020-0HT45-0XX4 optional

Note

DC/DC/DC

The order numbers listed relate to the EU plug-in power pack with RS232 interface

Note

A basic panel KTP600 is not absolutely necessary. To simulate the user interface, PC runtime from STEP7 Basic can be used.

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

1 Automation Task

Accessories
Table 1-2 Component 1. 2. 3. 1950 mAH Li-ion battery module for SIMATIC HE40(T) / HE45(T) Battery charger (2-bay) with EU power supply for SIMATIC HE40/HE45 Ethernet connection cables between KTP600, S7-1200 CPU and PC Qty 1 6GF 1 6GF 2 6XV18 MLFB / Order number 3020-0AC40-0AB2 3020-0AC40-0AA3 70-3QH20 Note For wireless scanning

Note

More information on the HawkEye handheld code reader can be found here: SIMATIC HawkEye 40/45

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

Programming package
Table 1-3 Component 1. 2. 3. STEP 7 Basic V10.5 OPC Server PC Access Microsoft Access 1 1 1 Qty MLFB / Order number 6ES7822-0AA00-0YA0 6ES7840-2CC01-0YX0 From v1.0 SP4 OPC Client Note

Note

PC Access SP4 can also be downloaded here: http://support.automation.siemens.com/WW/view/en/39055669

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

2 Automation Solution

2
2.1

Automation Solution
Wiring diagram
Figure 2-1
L N PE L+ M

S7-1200 PM1270 + CM1241 + CPU1214C + CSM1277

CPU 224XP 1
Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

A7
AC 230V

Data flow from controller to PC database


Figure 2-2
PC database

MS Access database (OPC client)

PC database

PC Access (OPC server)

CSM1277

CPU 1214C

Ethernet network

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

2 Automation Solution

2.2

Scanning and processing of Data Matrix code


To provide a rough overview, a simplified functionality of this process is shown below. Figure 2-3

PC database

5 6

PC Access

KTP600

2
Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

3
HawkEye HE40

CM1241 + CPU 1214C

Table 2-1 No 1. 2. The Data Matrix code is scanned. The code reader captures the image, decodes the information and outputs this information at the serial interface of the reader. If the code reader is not connected with the S7-1200 it will store the data in the internal buffer. When it is connected with the S7-1200 all data from the internal buffer is read and consecutively output via the serial interface. The RS232 communication module collects the information and buffers it. The S7-1200 reads the information from the RS232 communication module and provides this information to the PC database via Industrial Ethernet and PC Access. The PC searches the database for scanned information and returns the product designation to the controller as plain text. In addition, the flow of goods is archived. The basic panel KTP600 displays the scanned product ID and the product designation which was returned from the database. Function

3. 4.

5.

6.

Scanning the Data Matrix code The optical detection of the Data Matrix code corresponds to the basic functionality of a camera. To enable scanning also under difficult lighting conditions, the Data Matrix code is illuminated by means of LEDs.

10

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

2 Automation Solution Scanning the Data Matrix code requires the laser beam of the scanner to be aligned to the center of the Data Matrix code. The laser beam appears when pressing the button on the HawkEye. Decoding and output of the Data Matrix code The code reader analyzes the matrix by means of the specification for Data Matrix code and converts the information to an ASCII string.
Figure 2-4

12345678

The start of the ASCII string with the data is delimited with a comma as a prefix and the end of the string is delimited with a <CR><LF> (carriage return and line feed = enter and line feed) as suffix.
Figure 2-5

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

12345678

,12345678<CR><LF>

The data is sent via the serial interface. Receiving and processing information The sample program has configured the S7-1200 in such a way that all data starting with a comma and ending with a <CR> is received. First of all the data is buffered in the RS232 communication module. Only when the data is read from the RS232 communication module by the S7-1200 controller, due to the control program, will the actual string be extracted, stored in DB1 and therefore provided to the PC database.
Figure 2-6

,12345678<CR><LF>

DB1.DBB5 12345678

The S7-1200 will now wait that the database assigns a string to the read code, consisting of the product designation and provide it to the S7-1200 again as plain text. Data exchange between PC and S7-1200 The OPC server PC Access provides data exchange between PC and S7-1200. Taking the restrictions below into account, PC Access can be used for the data exchange with a S7-1200. Only the DB1 data block can be accessed The data block must be declared non-symbolic To address the variables in the data block the syntax of the S7-200 is obligatory (V, VB, VW, VD)

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

11

2 Automation Solution

OPC server and database The OPC server uses the Ethernet connection and can access the data of the S71200. In turn the data is provided to an OPC client (database MS Access) for read and write access. The database also evaluates the communication status consisting of two bytes, in addition to the string. If the New String and Search database command is detected, the string is read from the OPC server.
Figure 2-7
Database PC MS Access Database
Visual Basic Script (OPC client) Read when change of variables im OPC server Evaluation: which variables have changed? Execute relevant command

PC database

PC Access OPC server


Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

VB5 DB1.DBB5 12345678

S7-1200

Searching the database After detecting the Read command of the communication interface, the database reads the string and searches for it in the database. The data in the database is archived. If the string is found, the product designation is written to the OPC server. In the buffered scanning mode the product designation is not transferred.
Figure 2-8
Database PC MS Access Database
Visual Basic Script (OPC client) The Search command executes the Select command at the database When the string is found the product description is passed on to the OPC server

PC database

PC-Access OPC Server


VB87 DB1.DBB87 Cup

S7-1200

12

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

2 Automation Solution

Information on the touch panel The basic panel KTP600 is used to display selected data of the S7-1200. The last string sent to the database and the corresponding plain text is displayed In the buffered scanning mode the product designation is not displayed.

2.3

Communication with the code scanner


Communicating with the S7-1200 controller via the communication module with the code scanner is performed by integrating the Point to Point (PtP) communication blocks.

Configuration of port For data of the code scanner to be received via the PtP communication module the port has to be configured according to the specifications of the code scanner. This can be done via the static initial configuration in the properties of the device configuration or, like in this example, via the control program using the PORT_CFG block.
Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

Figure 2-9

The Port block parameter specifies the communication module via which the code scanner is connected. Other important parameters are Baud Parity Data Stop bits Bits rate

These parameters are stored in the instance data block of PORT_CFG (Figure 2-10). A rising edge on the REQ input enables the configuration change. In this example, this happens in the first cycle, when the controller is switched from STOP to RUN.

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

13

2 Automation Solution
Figure 2-10

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

Configuration of receive parameters To clearly detect the data from the code scanner, the conditions which identify the beginning and the end of a receiving message have to be configured. This can be done via the static initial configuration in the properties of the device configuration or, like in this example, via the control program using the RCV_CFG block.
Figure 2-11

The Port block parameter specifies the communication module via which the code scanner is connected. The CONDITIONS data structure indicates the initial and end conditions for receiving messages. These parameters are stored in the instance data block of RCV_CFG (Figure 2-12). A rising edge on the REQ input enables the configuration change. In this example, this happens in the first cycle, when the controller is switched from STOP to RUN.

14

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

2 Automation Solution
Figure 2-12

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

In this example the start condition is as follows: detecting a start signal STARTCOND = 1 the start character is a comma STARTCHAR = HEX#2C

The end condition is configured as follows: detecting a character string of a maximum of 5 characters ENDCOND = 32 taking into account the fifth character from the 5-digit character string SEQ.CTL = HEX#10 (binary: 0001_0000) the fifth character to be considered is <CR> SEQ.STR[5] = $R

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

15

2 Automation Solution

More detailed explanations on the end conditions by character string Each character of the end character strings, which can be up to 5-digits, can be taken into account or ignored. Selection is via activation bits. Character 1 is bit 0, character 2 is bit 1, etc. When one bit is enabled, the character of the message has to match the character of the configured end character string in this place. The last relevant character is always on the very right. This means that the fifth character of the character string corresponds to the last character which is to be detected. Subsequent characters are rejected. Table 2-2 shows the evaluation of a message, as it is performed in this configuration example. Green fields display the configured start and end conditions. Red fields are ignored in the end conditions. Table 2-2
Character position Incoming message Start and end conditions Activation bits of 5digit character string for end condition Stored message in S71200 ,A B 1. , , 01 00 C D 2 0 E 3 0 F 2. A 3. B 4. C 5. D 6. E 7. F 8. <CR> <CR> 4 1 <CR> 9. <LF>

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

Table 2-3 shows an example of a different possible end condition where the second and fifth character of the end character string have to match. The first, third and fourth character is ignored, so it can be arbitrary. Table 2-3
Character position Incoming message Start and end conditions Activation bits of 5digit character string for end condition Stored message in S71200 ,A B 1. , , 01 01 C D 2. A 3. B 4. C 5. D D 2 0 E 3 0 F 6. E 7. F 8. <CR> <CR> 4 1 <CR> 9. <LF>

16

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

2 Automation Solution

Transferring messages from the buffer of then communication module to the data block of the S7-1200 The RS232 communication module can buffer up to a maximum of 1KB of data. The RCV_PTP data block is needed to be able to transfer the data from the buffer of the RS232 communication module to the data block of the S7-1200.
Figure 2-13

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

The Port block parameter specifies the communication module via which the code scanner is connected. If new data is available in the buffer of the communication module, then the NDR output is set to 1. The data can now be received by a positive edge on the EN_R input and can be written into the receive buffer of the S7-1200. The length of the data in the receive buffer is output on the LENGTH output. The value on the STATUS output indicates the reason for the ending the data receipt. A list of possible reasons can be found in the S7-1200 manual. Since the received data in this configuration example is strings, a string with a total length of 80 bytes is indicated on the BUFFER block parameter. The first byte of a string always contains the total length of the string, in this case the value 80. The second byte in a string always contains the length information of the data currently in the string. To avoid that both length information is not overwritten, the start address on the BUFFER block parameter has to be moved by two bytes. This means that data can only be written from the third byte on. The length information of the current data has to be copied from the LENGTH output to the second byte of the receive buffer string. Indicating the start address is non-symbolic. The data block of the receive buffer has to be declared non-symbolic when creating it. Example: th If the string starts with a total length of 80 bytes on the 10 byte in the data block, then byte 10 contains the value of the total length and byte 11 the value of the actual length. The data is located from byte 12 to byte 94. The specification of the BUFFER block parameter is as follows: P#DB2.DBX12.0 BYTE 80

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

17

2 Automation Solution

2.4

HawkEye4x function block


The HawkEye4x function block included in delivery, facilitates the configuration of the communication parameters described in chapter 2.3.
Figure 2-14

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

The Port block parameter specifies the communication module via which the code scanner is connected. The start character is indicated as a hexadecimal code on the StartChar block parameter. The end character has to be indicated in ASCII code on the EndChar block parameter. The NDR output signals the presence of new data. If there is a fault on the RS232 module, this output will display Error. Via Status the reason for ending the message receipt is output. A list of possible reasons can be found in the S7-1200 manual. On the rcv_Buffer output a receipt buffer has to be indicated, which is located in data block 1. The buffer is a string data type with a total length of 80 (String[80]). The problem of the length information has already been taken care of (see page 17).

18

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

3 Configuration

3
3.1
Table 3-1 No 1.

Configuration
Installing and wiring hardware
Instruction Mount the PM1207, the CM1241, the CPU1214C and the CMS1277 onto a top hat rail Connect the controller, the switch and the touch panel with the DC 24V supply voltage of the PM1207 Connect the controller, the touch panel and the PC using the Ethernet cable and the switch Connect the code scanner with the RS232 communication module and the plug-in power pack Plug the reader into the pistol grip handle and connect the cable. See Figure 2-1. Comment/picture

2.

3. 4.

See Figure 2-2.

5.
Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

1 2

6.

Connect all earth connections with earth.

Note

At this point it is assumed that the necessary software has been installed on your computer and that you are familiar with handling the software.

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

19

3 Configuration

3.2
Table 3-2 No 1.

Connect S7-1200 with PG/PC


Instruction Connect your development system (PG/PC) to the S7-1200 CPU, using an Ethernet cable. Comment/picture

2.

Open the network connection in the control panel of the PG/PC.

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

3.

Open the properties of the network connection.

4.

Open the Internet Protocol (TCP/IP) Properties

5.

In the General tab mark Use the following IP address and enter the address: IP address: 192.168.0.100 Subn et: 255.255.255.0

6.

Confirm with OK to close all windows

20

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

3 Configuration

3.3
Table 3-3 No 1. 2. 3.

Load project in the S7-1200 CPU1214C


Instruction Unzip the file from Table 4-1 no. 1 Open the unzipped project with STEP7 Basic v10.5 Select the PLC_1 device in project navigation and open the device configuration *.ap10 Comment/picture CE_x27_S7-1200_v1d0.zip

4.
Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

Check the device configuration and if necessary adjust your hardware. Enter the following IP address: IP address: 192.168.0.1 Subn et: 255.255.255.0 Check whether the system memory byte 100 is active
1

5.

For this purpose click CPU (1) and then properties (2). Then select System and clock memory (3). Enable the system memory byte and set as location MB100 (4)
3

6.

Load the project into the CPU Select CPU, press right mouse button and select Download to device All After loading set CPU to RUN

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

21

3 Configuration

3.4
Table 3-4 No 1.

Load project into the SIMATIC Panel KTP600


Instruction Connect KTP600 basic panel with a DC 24V power supply Connect your development system (PG/PC) with the KTP600 basic panel using an Ethernet cable Comment/picture

2.

After the bootloader sequence, select the Transfer button. Beforehand, make sure that the IP address entered in the panel corresponds with the assigned IP address in the project. IP address: 192.168.0.2 Subn et: 255.255.255.0 The panel is now ready for loading the project. Click HMI_1 [KTP600] with the right mouse in the project navigation

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

3.

4. 5.

Select Download to device All Tick the Action column and click Download

6. 7.

The HMI project is loading. The panel starts automatically after completion. Once the S7-1200 project was successfully loaded, connect the KTP600 basic panel with the S7-1200 CPU1214C, using an Ethernet cable.

22

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

3 Configuration

3.5

Using PC runtime instead of the panel


Apart from programming a controller, STEP7 Basic V10.5 also offers the visualization of the project. The software supports all currently available basic panels with Ethernet interface. If no panel is available, the panel can also be simulated by the integrated PC runtime. For convenient operation of the project, a HMI project was integrated which can also be simulated via PC runtime. To make the simulation executable please proceed as follows:

Table 3-5 No 1. Instruction Go to the control panel of your programming device and set the PG/PC interface as follows: Access point: S7-Online Interface: TCP/IP -> Your network adapter Comment/picture

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

2. 3.

Go back to the STEP7 Basic project Mark HMI_1 [KTP600] in project navigation Subsequently click the Start runtime icon

*.ap10

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

23

3 Configuration

3.6

Initializing and configuring the HawkEye scanner with Data Matrix codes
The scanner has to be set up before using it for the first time. The scanner is set up by scanning special codes and is done in two steps. Scan the following codes successively. After each Data Matrix code, wait for the scanner feedback.

Initializing
Table 3-6 Initializing the code scanner No 1. Reset to factory settings 8 data bits 1 stop bit Baud rate: 57600 No parity DMC Instruction

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

2. Delete start and end characters

3. Save

Note

The setup can be checked with an interface analyzer (e.g., HyperTerminal). Settings: 8N1, 57600 or 4800.

24

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

3 Configuration

Configuring
Table 3-7 Configuring the code scanner No 1. DMC Explanation

Add comma before each string Attention: scan only once!

2. Save

3.
Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

Add CR and LF after string Attention: scan only once!

4. Save

5. 4800 bits per second

6. Save

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

25

3 Configuration

3.7

Configuring the PC Access OPC server


Table 3-8 No 1. 2. 3. 4. Step Unzip the file from Table 4-1 no. 2 Open the unzipped project with PC Access Save the PC Access project again Open the settings for the PC/PG interface (1+2) and check the settings (3+4). Ensure that the used Ethernet interface (TCP/IP) of your PC is used as an access point. *.pca Figure/short note CEx27_PC_Access_v1d0.zip

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

4
5. Subsequently, open the CPU settings (1+2) and check them (3-5) too. The settings used here relate to the S7-1200 and should look like this: IP address: 192.168.0.1 TSAP Local: 10.00 TSAP Remote: 03.01

4 5

26

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

3 Configuration

No 6.

Step Check the OPC communication to the controller. Use drag & drop to move the configured variables to Test Client (bottom part of the PC Access window).

Figure/short note

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

7.

Now start Test Client. In the Value column the values should now be displayed, Quality of the variables should change to the Good status.

8.

Save and close PC Access.

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

27

3 Configuration

3.8

Configuring Microsoft Access


Table 3-9 No 1. 2. Step Unzip the file from Table 4-1 no. 3 Open the unzipped project with Microsoft Access Confirm the security dialog boxes with Yes or Open The previously configured OPC server starts automatically. *.mdb Figure/short note CEx27_Database_v1d0.zip

3.

4.

Subsequently, the following window appears. Go to the Product Manager view.

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

5.

In the Product Manager screen form you can assign designations for the codes as plain text.

denotation english Scanner ID denotation german

6.

The database is now ready to run.

28

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

3 Configuration

3.9

Generating own Data Matrix code


On the Internet page below own Data Matrix codes can be created which can then be added to the database. http://www.automation.siemens.com/mcms/industrial-sensors/en/codereading-systems/Pages/default.aspx

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

29

3 Configuration

3.10

Operation of the application via HMI


The application can be easily and intuitively operated via the HMI user interface, included in delivery. Once the database was loaded and the OPC server is active, the codes can be scanned.

Structure of the user interface Soft keys Soft key F1 goes to the start screen Soft key F5 registers the database again when the connection between CPU and running database was interrupted F6 soft key changes between German and English

Left bar
Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

Change of language Change between the Single scan and Buffered scan mode

Upper section Status of database Please scan Search in database Busy Finished Wait New data available Error on RS232 module with respective status code

Status of S7-1200

Number of scans

Lower section Display of scanned data The Single scan mode also displays found product in plain text

30

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

3 Configuration
Figure 3-1

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

31

4 Code Elements

Code Elements
The software examples are available on the HTML page from which you have downloaded this document.
Table 4-1 No 1. 2. 3. File name CE_x27_S7-1200_v1d0.zip CE_x27_PC-Access_v1d0.zip CE_x27_Database.zip Contents STEP 7 Basic V10.5 project PC Access Project MS Access Data Base

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

32

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

5 History

History
Version V1.0 27.01.2 Date 010 First edition Modification

Copyright Siemens AG 2010 All rights reserved ConfigurationExample_x27_S7-1200_HawkEye_v1d0_en.doc

CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943

33

S-ar putea să vă placă și