Data Matrix Codes with S7-1200 - Home - Español - Argentina · · 2010-03-08Data Matrix Codes...
Transcript of Data Matrix Codes with S7-1200 - Home - Español - Argentina · · 2010-03-08Data Matrix Codes...
Applications & Tools
Answers for industry.
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
2 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
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: [email protected]
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 3
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
s
SIMATIC CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
Automation Task
1
Automation Solution
2
Configuration
3
Code Elements
4
History
5
Warranty and Liability
4 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
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.
Table of Contents
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 5
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Table of Contents Warranty and Liability ................................................................................................. 4 1 Automation Task................................................................................................ 6
1.1 Application automation task ................................................................. 6 1.2 List of components ............................................................................... 7
2 Automation Solution ......................................................................................... 9 2.1 Wiring diagram ..................................................................................... 9 2.2 Scanning and processing of Data Matrix code .................................. 10 2.3 Communication with the code scanner .............................................. 13 2.4 “HawkEye4x” function block............................................................... 18
3 Configuration ................................................................................................... 19 3.1 Installing and wiring hardware............................................................ 19 3.2 Connect S7-1200 with PG/PC............................................................ 20 3.3 Load project in the S7-1200 CPU1214C............................................ 21 3.4 Load project into the SIMATIC Panel KTP600................................... 22 3.5 Using PC runtime instead of the panel............................................... 23 3.6 Initializing and configuring the HawkEye scanner with Data Matrix
codes.................................................................................................. 24 3.7 Configuring the PC Access OPC server ............................................ 26 3.8 Configuring Microsoft Access............................................................. 28 3.9 Generating own Data Matrix code...................................................... 29 3.10 Operation of the application via HMI .................................................. 30
4 Code Elements................................................................................................. 32 5 History............................................................................................................... 33
1 Automation Task
6 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
1 Automation Task
1.1 Application automation task
At a company’s 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. 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
PC databaseGoods receipt;
checking ofgoods
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
1 Automation Task
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 7
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
Figure 1-2
Ethernet
5
7
3 421
6 HawkEye HE40
CM1241 RS232 Switch CSM 1277
PC Access
Power Supply S7-1200 CPU 1214C
8 Microsoft ACCESS database5 KTP 600 PN
1 2 3
6
4
7
PC Access
PC databaseMicrosoft ACCESS
8
RS232
1.2 List of components
Products
Table 1-1
Components Qty MLFB / Order number Note
1. PM1207 Power supply 1 6EP1332-1SH71
2. RS232 communication module CM1241 1 6ES7241-1AH30-0XB0
3. S7-1200 CPU1214C 1 6ES7214-1AE30-0XB0 DC/DC/DC 4. Compact Switch Module CSM1277 1 6GK7277-1AA00-0AA0
5. Basic KTP600 panel (color, PN) 1 6AV6647-0AD11-3AX0 optional 6. SIMATIC HE 40 handheld code reader
optional: HE 40T HE 45 HE 45T
1 6GF 3020-0HE40-0XX4 Optional: 6GF 3020-0HT40-0XX4 6GF 3020-0HE45-0XX4 6GF 3020-0HT45-0XX4
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.
1 Automation Task
8 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
Accessories
Table 1-2
Component Qty MLFB / Order number Note
1. 1950 mAH Li-ion battery module for SIMATIC HE40(T) / HE45(T)
1 6GF 3020-0AC40-0AB2
2. Battery charger (2-bay) with EU power supply for SIMATIC HE40/HE45
1 6GF 3020-0AC40-0AA3
For wireless scanning
3. Ethernet connection cables between KTP600, S7-1200 CPU and PC
2 6XV18 70-3QH20
Note More information on the HawkEye handheld code reader can be found here:
SIMATIC HawkEye 40/45
Programming package
Table 1-3
Component Qty MLFB / Order number Note
1. STEP 7 Basic V10.5 1 6ES7822-0AA00-0YA0
2. OPC Server PC Access 1 6ES7840-2CC01-0YX0 From v1.0 SP4 3. Microsoft Access 1 OPC Client
Note PC Access SP4 can also be downloaded here:
http://support.automation.siemens.com/WW/view/en/39055669
2 Automation Solution
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 9
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
2 Automation Solution
2.1 Wiring diagram
S7-1200 PM1270 + CM1241 + CPU1214C + CSM1277
Figure 2-1
LNPE
CPU 224XP
A7
L+M
1 2 34
AC 230V
6
Data flow from controller to PC database
Figure 2-2
CPU 1214CCSM1277
Ethernet network
PC database
PC Access (OPC server)
MS Access database(OPC client)
PC database
2 Automation Solution
10 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
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
CM1241 + CPU 1214C
KTP600
HawkEye HE40
PC database
1
2
3 4
5
6
PC Access
Table 2-1
No Function
1. The Data Matrix code is scanned. 2. 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.
3. The RS232 communication module collects the information and buffers it. 4. 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.
5. 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.
6. The basic panel KTP600 displays the scanned product ID and the product designation which was returned from the database.
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.
2 Automation Solution
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 11
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
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
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)
2 Automation Solution
12 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
OPC server and database
The OPC server uses the Ethernet connection and can access the data of the S7-1200. 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
PC database
PC Access OPC server
VB5 ≙ DB1.DBB5 „12345678“
MS Access Database
Visual Basic Script (OPC client)• Read when change of variables im OPC server
• Evaluation: which variables have changed?• Execute relevant command
Database PC
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
PC database
PC-Access OPC Server
VB87 ≙ DB1.DBB87 ”Cup“
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
Database PC
S7-1200
2 Automation Solution
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 13
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
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. Figure 2-9
The “Port” block parameter specifies the communication module via which the code scanner is connected. Other important parameters are Baud rate Parity Data bits Stop Bits 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.
2 Automation Solution
14 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
Figure 2-10
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.
2 Automation Solution
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 15
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
Figure 2-12
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’
2 Automation Solution
16 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
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 1. 2. 3. 4. 5. 6. 7. 8. 9.
Incoming message , A B C D E F <CR> <LF>
Start and end conditions
, <CR>
0 1 2 3 4 Activation bits of 5-digit character string for end condition
0 0 0 0 1
Stored message in S7-1200
, A B C D E F <CR>
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 1. 2. 3. 4. 5. 6. 7. 8. 9.
Incoming message , A B C D E F <CR> <LF>
Start and end conditions
, D <CR>
0 1 2 3 4 Activation bits of 5-digit character string for end condition
0 1 0 0 1
Stored message in S7-1200
, A B C D E F <CR>
2 Automation Solution
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 17
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
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
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: If the string starts with a total length of 80 bytes on the 10th 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
2 Automation Solution
18 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
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
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).
3 Configuration
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 19
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
3 Configuration
3.1 Installing and wiring hardware
Table 3-1
No Instruction Comment/picture
1. Mount the PM1207, the CM1241, the CPU1214C and the CMS1277 onto a top hat rail
2. Connect the controller, the switch and the touch panel with the DC 24V supply voltage of the PM1207
See Figure 2-1.
3. Connect the controller, the touch panel and the PC using the Ethernet cable and the switch
See Figure 2-2.
4. Connect the code scanner with the RS232 communication module and the plug-in power pack
5. Plug the reader into the pistol grip handle and connect the cable.
1
2
3 4
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.
3 Configuration
20 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
3.2 Connect S7-1200 with PG/PC
Table 3-2
No Instruction Comment/picture
1. Connect your development system (PG/PC) to the S7-1200 CPU, using an Ethernet cable.
2. Open the network connection in the control panel of
the PG/PC.
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
3 Configuration
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 21
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
3.3 Load project in the S7-1200 CPU1214C
Table 3-3
No Instruction Comment/picture
1. Unzip the file from Table 4-1 no. 1 CE_x27_S7-1200_v1d0.zip 2. Open the unzipped project with STEP7 Basic v10.5 *.ap10 3. Select the “PLC_1” device in project navigation
and open the device configuration
4. 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
5. Check whether the system memory byte 100 is active 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)
1
2
3
4
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”
3 Configuration
22 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
3.4 Load project into the SIMATIC Panel KTP600
Table 3-4
No Instruction Comment/picture
1. 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
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.
3. Click HMI_1 [KTP600] with the right mouse in the
project navigation
4. Select “Download to device” “All”
5. Tick the “Action” column and click “Download”
6. The HMI project is loading. The panel starts automatically after completion.
7. Once the S7-1200 project was successfully loaded, connect the KTP600 basic panel with the S7-1200 CPU1214C, using an Ethernet cable.
3 Configuration
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 23
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
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 Instruction Comment/picture
1. 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”
2. Go back to the STEP7 Basic project *.ap10 3. Mark “HMI_1 [KTP600]” in project navigation
Subsequently click the “Start runtime“ icon
3 Configuration
24 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
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 DMC Instruction
1.
Reset to factory settings 8 data bits 1 stop bit Baud rate: 57600 No parity
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.
3 Configuration
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 25
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
Configuring
Table 3-7 Configuring the code scanner
No DMC Explanation
1.
Add comma before each string Attention: scan only once!
2.
Save
3.
Add CR and LF after string Attention: scan only once!
4.
Save
5.
4800 bits per second
6.
Save
3 Configuration
26 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
3.7 Configuring the PC Access OPC server
Table 3-8
No Step Figure/short note
1. Unzip the file from Table 4-1 no. 2 CEx27_PC_Access_v1d0.zip 2. Open the unzipped project with PC
Access *.pca
3. Save the PC Access project again
4. 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.
1
2
3
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
1
2
3
4
5
3 Configuration
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 27
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
No Step Figure/short note
6. 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).
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.
3 Configuration
28 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
3.8 Configuring Microsoft Access
Table 3-9
No Step Figure/short note
1. Unzip the file from Table 4-1 no. 3 CEx27_Database_v1d0.zip 2. Open the unzipped project with
Microsoft Access Confirm the security dialog boxes with “Yes” or “Open”
*.mdb
3. The previously configured OPC server starts automatically.
4. Subsequently, the following window
appears. Go to the “Product Manager” view.
5. In the “Product Manager” screen form
you can assign designations for the codes as plain text.
Scanner ID
denotationenglish
denotationgerman
6. The database is now ready to run.
3 Configuration
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 29
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
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/code-reading-systems/Pages/default.aspx
3 Configuration
30 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
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
Change of language Change between the “Single scan” and “Buffered scan” mode Upper section
Status of database – Please scan – Search in database – Busy… – Finished
Status of S7-1200 – Wait… – New data available – Error on RS232 module with respective status code
Number of scans Lower section
Display of scanned data The “Single scan” mode also displays found product in plain text
3 Configuration
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 31
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
Figure 3-1
4 Code Elements
32 CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200
V1.0, Entry ID: 40603943
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
4 Code Elements The software examples are available on the HTML page from which you have downloaded this document. Table 4-1
No File name Contents
1. CE_x27_S7-1200_v1d0.zip STEP 7 Basic V10.5 project 2. CE_x27_PC-Access_v1d0.zip PC Access Project 3. CE_x27_Database.zip MS Access Data Base
5 History
CE-X27 - Flexible Decoding and Processing of Data Matrix Codes with S7-1200 V1.0, Entry ID: 40603943 33
Cop
yrig
ht
Sie
men
s AG
201
0 A
ll rig
hts r
eser
ved
Con
figur
atio
nExa
mpl
e_x2
7_S7
-120
0_H
awkE
ye_v
1d0_
en.d
oc
5 History Version Date Modification
V1.0 27.01.2 010 First edition