sce-basic programming s7-1200 (2016)

263

Upload: jorge-andril

Post on 08-Jul-2016

40 views

Category:

Documents


3 download

DESCRIPTION

TIA-Portal curso SCE (S7-1200)TIA-Portal V13

TRANSCRIPT

Page 1: SCE-Basic Programming S7-1200 (2016)
Page 2: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 2

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Matching SCE Trainer Packages for these training curriculums

• SIMATIC S7-1200 AC/DC/RELAY (set of 6) "TIA Portal"

Order no.: 6ES7214-1BE30-4AB3

• SIMATIC S7-1200 DC/DC/DC (set of 6) "TIA Portal"

Order no.: 6ES7214-1AE30-4AB3

• Upgrade SIMATIC STEP 7 BASIC V13 SP1 (for S7-1200) (set of 6) "TIA Portal"

Order no.: 6ES7822-0AA03-4YE5

Note that these trainer packages are replaced with successor packages when necessary.

An overview of the currently available SCE packages is available at: siemens.com/sce/tp

Continued training For regional Siemens SCE continued training, get in touch with your regional SCE contact

siemens.com/sce/contact

Additional information regarding SCE siemens.com/sce

Information regarding use The SCE training curriculum for the integrated automation solution Totally Integrated Automation (TIA)

was prepared for the program "Siemens Automation Cooperates with Education (SCE)" specifically for

training purposes for public educational facilities and R&D institutions. Siemens AG does not guarantee

the contents.

This document is to be used only for initial training on Siemens products/systems, which means it can be

copied in whole or part and given to those being trained for use within the scope of their training.

Circulation or copying this training curriculum and sharing its content is permitted within public training

and advanced training facilities for training purposes.

Exceptions require written consent from the Siemens AG contact person: Roland Scheuerer

[email protected].

Offenders will be held liable. All rights including translation are reserved, particularly if a patent is granted

or a utility model or design is registered.

Use for industrial customer courses is explicitly not permitted. We do not consent to commercial use of

the training curriculums.

We wish to thank the TU Dresden, particularly Prof. Dr.-Ing. Leon Urbas and Dipl.-Ing. Annett Pfeffer, the Michael Dziallas Engineering Corporation and all other involved persons for their support during the preparation of this training curriculum.

Page 3: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 3

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Table of contents

1 Goal ...................................................................................................................................................... 4

2 Prerequisite ........................................................................................................................................... 4

3 Theory ................................................................................................................................................... 4

3.1 Operating system and application program .................................................................................. 4

3.2 Organization blocks ...................................................................................................................... 5

3.3 Process image and cyclic program processing ............................................................................ 6

3.4 Functions ...................................................................................................................................... 8

3.5 Function blocks and instance data blocks .................................................................................... 9

3.6 Global data blocks ...................................................................................................................... 10

3.7 Library-compatible logic blocks................................................................................................... 11

3.8 Programming languages ............................................................................................................. 12

4 Task .................................................................................................................................................... 13

5 Planning .............................................................................................................................................. 13

5.1 EMERGENCY STOP .................................................................................................................. 13

5.2 Manual mode – Conveyor motor in manual mode...................................................................... 13

5.3 Technology diagram ................................................................................................................... 14

5.4 Reference list .............................................................................................................................. 15

6 Structured step-by-step instructions ................................................................................................... 16

6.1 Retrieve an existing project ........................................................................................................ 16

6.2 Create a new tag table ................................................................................................................ 17

6.3 Create new tags within a tag table ............................................................................................. 19

6.4 Import "Tag_table_sorting_station"............................................................................................. 20

6.5 Create function FC1 "MOTOR_MANUAL" for the conveyor motor in manual mode ................. 24

6.6 Define the Interface of function FC1 "MOTOR_MANUAL" ......................................................... 26

6.7 Program FC1: MOTOR_MANUAL .............................................................................................. 29

6.8 Program the organization block OB1 – Control conveyor tracking forwards in manual mode ... 36

6.9 Save and compile the program ................................................................................................... 41

6.10 Download the program ............................................................................................................... 42

6.11 Monitor program blocks .............................................................................................................. 43

6.12 Archive the project ...................................................................................................................... 45

6.13 Checklist ..................................................................................................................................... 46

7 Exercise .............................................................................................................................................. 47

7.1 Task – Exercise .......................................................................................................................... 47

7.2 Technology diagram ................................................................................................................... 47

7.3 Reference list .............................................................................................................................. 48

7.4 Planning ...................................................................................................................................... 48

7.5 Checklist – Exercise ................................................................................................................... 49

8 Additional information ......................................................................................................................... 50

Page 4: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 4

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

BASICS OF FC PROGRAMMING

1 Goal

In this chapter, you will get to know the basic elements of a control program – the organization blocks (OBs), functions (FCs), function blocks (FBs) and data blocks (DBs). In addition, you will be introduced to library-compatible function und function block programming. You will get to know the Function Block Diagram (FBD) programming language and use it to program a function (FC1) and an organization block (OB1).

2 Prerequisite

This chapter builds on the hardware configuration of SIMATIC S7 CPU1214C. However, other hardware configurations that have digital input and output cards can be used. For this chapter, you can use the following project, for example:

SCE_EN_011_101_Hardware_Configuration_CPU1214C.zap13

3 Theory

3.1 Operating system and application program

Every controller (CPU) contains an operating system, which organizes all functions and sequences of the CPU that are not associated with a specific control task. The tasks of the operating system include the following:

Performing a warm restart

Updating the process image of the inputs and output

Cyclically calling the user program

Detecting interrupts and calling interrupt OBs

Detecting and handling errors

Managing memory areas

The operating system is an integral component of the CPU and comes pre-installed.

The user program contains all functions that are necessary for executing your specific automation task. The tasks of the user program include the following:

Checking the basic requirements for a warm restart using startup OBs

Processing of process data, i.e. activation of output signals as a function of the input signal states

Reaction to interrupts and interrupt inputs

Error handling during normal program execution

Page 5: SCE-Basic Programming S7-1200 (2016)
Page 6: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 6

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

When a start event occurs, the following reactions are possible:

If an OB has been assigned to the event, this event triggers the execution of the assigned OB. If the priority of the assigned OB is greater than the priority of the OB that is currently being executed, it is executed immediately (interrupt). If not, the assigned OB waits until the higher-priority OB has been completely executed

If you have not assigned an OB to the event, the default system reaction is performed.

Table 1 shows examples for various start events for a SIMATIC S7-1200. Also shown are the possible OB number(s) and the default system reactions that occur when the respective organization block (OB) is not present in the controller.

Start event Possible OB numbers

Default system reaction

Startup 100, 123 Ignore

Cyclic program 1, 123 Ignore

Time-of-day interrupt 10 to 11 -

Update interrupt 56 Ignore

Scan cycle monitoring time exceeded once

80 Ignore

Scan cycle monitoring time exceeded twice

80 STOP

Diagnostic interrupt 82 Ignore

Table 1: OB numbers for various start events

3.3 Process image and cyclic program processing

When the cyclic user program addresses the inputs (I) and outputs (O), it does not query the signal states directly from the input/output modules. Instead, it accesses a memory area of the CPU. This memory area contains an image of the signal states and is called the process image.

Page 7: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 7

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

The cyclic program processing sequence is as follows:

1. At the start of the cyclic program, a query is sent to determine whether or not the

individual inputs are energized. This status of the inputs is stored in the process image of the

inputs (PII). In doing so, the information 1 or "High" is stored for energized inputs and the

information 0 or "Low" for de-energized inputs.

2. The CPU then executes the program stored in the cyclic organization block. For the

required input information, the CPU accesses the previously read process image of the

inputs (PII) and the results of logic operation (RLOs) are written to a so-called process

image of the outputs (PIQ).

3. At the end of the cycle, the process image of the outputs (PIQ) is transferred as the

signal state to the output modules and these are energized or de-energized. The sequence

then continues again with Item 1.

Figure 2: Cyclic program processing

Note: The time the CPU needs for this sequence is called cycle time. This depends, in turn, on the number and type of instructions and the processor performance of the controller.

PLC program in the program memory 1st instruction 2nd instruction 3rd instruction 4th instruction ... Last instruction

1. Save status of inputs in PII.

2. Processing the program instruction-by-instruction with access to PII and PIQ

3. Transfer status from the PIQ to the outputs.

PII

Local data

Bit memory

Data blocks

PIQ

Page 8: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 8

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

3.4 Functions

Functions (FCs) are logic blocks without memory. They have no data memory in which values of block parameters can be stored. Therefore, all interface parameters must be connected when a function is called. To store data permanently, global data blocks must be created beforehand.

A function contains a program that is executed whenever the function is called from another logic block.

Functions can be used, for example, for the following purposes:

Math functions – that return a result dependent on input values.

Technological functions – such as individual controls with binary logic operations.

A function can also be called several times at different points within a program.

Figure 3: Function with call from organization block Main [OB1]

Organization block Main [OB1] Calls the MOTOR_MANUAL [FC1] function

Function MOTOR_MANUAL [FC1] Contains a program for controlling a conveyor in manual mode, for example. The function has no memory.

Page 9: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 9

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

3.5 Function blocks and instance data blocks

Function blocks are logic blocks that store their input, output and in-out tags as well as static tags permanently in instance data blocks, so that they are available after the block has been executed. For this reason, they are also referred to as blocks with "memory".

Function blocks can also operate with temporary tags. Temporary tags are not stored in the instance DB, however. Instead, they are only available for one cycle.

Function blocks are used for tasks that cannot be implemented with functions:

Whenever timers and counters are required in the blocks, or

When information must be stored in the program, such as preselection of the operating mode with a button.

Function blocks are always executed when called from another logic block. A function block can also be called several times at different points within a program. This facilitates the programming of frequently recurring complex functions.

A call of a function block is referred to as an instance. Each instance of a function block is assigned a memory area that contains the data that the function block uses. This memory is made available by data blocks created automatically by the software.

It is also possible to provide memory for multiple instances in one data block in the form of a multi-instance. The maximum size of instance data blocks varies depending on the CPU. The tags declared in the function block determine the structure of the instance data block.

Figure 4: Function block and instance with call from organization block Main [OB1]

Instance data block MOTOR_AUTO_DB1 [DB1] as memory for the call of function block MOTOR_AUTO [FB1]

Organization block Main [OB1] Calls function block MOTOR_AUTO [FB1] together with its instance data block MOTOR_AUTO_DB1 [DB1]

Function block MOTOR_AUTO [FB1] Contains a program for controlling a conveyor in automatic mode, for example. The function block uses instance data block MOTOR_AUTO_DB1 [DB1] as memory in this call.

Page 10: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 10

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

3.6 Global data blocks

In contrast to logic blocks, data blocks contain no instructions. Rather, they serve as memory for user data.

Data blocks thus contain variable data that is used by the user program. You can define the structure of global data blocks as required.

Global data blocks store data that can be used by all other blocks (see Figure 5). Only the associated function block should access instance data blocks. The maximum size of data blocks varies depending on the CPU.

Figure 5: Difference between global DB and instance DB.

Application examples for global data blocks are:

Saving of information about a storage system. "Which product is located where?"

Saving of recipes for particular products.

Function_10

Function_11

Function block_12

Global DB (DB_Global)

Instance DB (DB_Instance)

Access for all blocks

Access only for function data block_12

Page 11: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 11

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

3.7 Library-compatible logic blocks

A user program can be created with linear or structured programming. Linear programming writes the entire user program in the cycle OB, but is only suitable for very simple programs for which other less expensive control systems, such as LOGO!, can now be used.

For more complex programs, structured programming is always recommended. Here, the overall automation task can be broken down into small sub-tasks in order to implement a solution for them in functions and function blocks.

In this case, library-compatible logic blocks should be created preferentially. This means that the input and output parameters of a function or function block are defined generally and only supplied with the current global tags (inputs/outputs) when the block is used.

Figure 6: Library-compatible function with call in OB1

Page 12: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 12

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

3.8 Programming languages

For SIMATIC S7-1200, the available programming languages for programming functions and function blocks are Function Block Diagram (FBD), Ladder Logic (LAD) and Structured Control Language (SCL).

The Function Block Diagram (FBD) programming language will be presented in the following.

FBD is a graphical programming language. The representation is based on electronic switching systems. The program is mapped in networks. A network contains one or more logic operation paths. Binary and analog signals are linked together by boxes. The graphical logic symbols known from Boolean algebra are used to represent the binary logic.

You can use binary functions to query binary operands and to logically combine their signal states. The following instructions are examples of binary functions: "AND operation", "OR operation" and "EXCLUSIVE OR operation". These are shown in Figure 7.

Figure 7: Binary functions in FBD and associated logic table

You can thus use simple instructions, for example, to control binary outputs, evaluate edges and execute jump functions in the program.

Program elements such as IEC timers and IEC counters provide complex instructions.

The empty box serves as a placeholder in which you can select the required instruction.

Enable input EN (enable) / Enable output ENO (enable output) mechanism:

An instruction without EN/ENO mechanism is executed independent of the signal state at

the box inputs.

Instructions with EN/ENO mechanism are only executed if enable input "EN input has

signal state "1". When the box is processed correctly, enable output "ENO" has signal

state "1". If an error occurs during processing, the enable output "ENO" is reset. If enable

input EN is not connected, the box is always executed.

Page 13: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 13

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

4 Task

The following functions of the sorting station process description will be planned, programmed and tested in this chapter:

Manual mode – Control of conveyor tracking forwards in manual/jog mode

5 Planning

The programming of all functions in OB1 is not recommended for reasons of clarity and reusability. The majority of the program code will therefore be moved into functions (FCs) and function blocks (FBs). The decision on which functions is to be moved to FCs and which is to run in OB 1 is planned below.

5.1 EMERGENCY STOP

The EMERGENCY STOP does not require a separate function. Just like the operating mode, the current state of the EMERGENCY STOP relay can be used directly at the blocks.

5.2 Manual mode – Conveyor motor in manual mode

Manual mode of the conveyor motor is to be encapsulated in a function (FC) "MOTOR_MANUAL". On the one hand, this preserves the clarity of OB1. On the other hand, it enables reuse if another conveyor belt is added to the station. Table 2 lists the planned parameters.

Input Data type Comment

Manual_mode_active BOOL Manual mode activated

Pushbutton_manual_mode BOOL Pushbutton to switch on conveyor in manual

mode

Enable_OK BOOL All enable conditions OK

Safety_shutoff_active BOOL Safety shutoff active e.g. emergency stop

operated

Output

Conveyor_motor_manual_mode BOOL Control of the conveyor motor in manual

mode

Table 2: Parameters for FC "MOTOR_MANUAL"

Output Conveyor_motor_manual_mode is ON as long as Pushbutton_manual_mode is pressed, manual mode is activated, the enable conditions are met and the safety shutoff is not active.

Page 14: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 14

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

5.3 Technology diagram

Here, you see the technology diagram for the task.

Figure 8: Technology diagram

Figure 9: Control panel

Page 15: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 15

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

5.4 Reference list

The following signals are needed as operands for this task.

DI Type Identifier Function NC/NO

I 0.0 BOOL -A1 Return signal emergency stop ok NC

I 0.1 BOOL -K0 Main switch "ON" NO

I 0.2 BOOL -S0 Mode selector manual (0)/ automatic (1) Manual = 0

Auto = 1

I 0.5 BOOL -B1 Sensor cylinder M4 retracted NO

I 1.4 BOOL -S3 Pushbutton manual mode conveyor M1 forward

NO

I 1.5 BOOL -S4 Pushbutton manual mode conveyor M1 reverse

NO

DO Type Identifier Function

Q 0.0 BOOL -Q1 Conveyor motor M1 forwards fixed speed

Legend for reference list

DO Digital Output

AO Analog Output

Q Output

DI Digital Input

AI Analog Input

I Input

NC Normally Closed

NO Normally Open

Page 16: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 16

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

6 Structured step-by-step instructions

You can find instructions on how to carry out planning below. If you already have a good

understanding of everything, it is sufficient to focus on the numbered steps. Otherwise, simply

follow the detailed steps in the instructions.

6.1 Retrieve an existing project

Before we can start programming the function (FC) "MOTOR_MANUAL", we need a

project with a hardware configuration (e.g.

SCE_EN_011_101_Hardware_Configuration_CPU1214C.zap13). To retrieve an existing

project that has been archived, you must select the relevant archive with Project

Retrieve in the project view. Confirm your selection with Open ( Project Retrieve

Select a .zap archive Open).

The next step is to select the target directory where the retrieved project will be stored.

Confirm your selection with "OK". ( Target directory OK)

Page 17: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 17

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

6.2 Create a new tag table

In the project view, navigate to the PLC tags of your controller and create a new tag

table by double-clicking Add new tag table.

Page 18: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 18

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Rename the tag table you just created as "Tag_table_sorting_station" ( right-click

"Tag_table_1" "Rename" Tag_table_sorting_station).

Open this tag table with a double-click. ( Tag_table_sorting_station)

Page 19: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 19

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

6.3 Create new tags within a tag table

Add the name Q1 and confirm the entry with the Enter key. If you have not yet created

additional tags, TIA Portal now automatically assigns data type "Bool" and address %I0.0

(I 0.0) ( <Add> Q1 Enter).

Change the address to %Q0.0 (Q 0.0) by entering this directly or by clicking the drop-

down arrow to open the Addressing menu. Change the operand identifier to Q and

confirm with Enter or by clicking the check mark ( %I0.0 Operand identifier Q

)

Enter the "Conveyor motor M1 forwards fixed speed" comment for the tag.

Page 20: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 20

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Add a new Q2 tag in line 2. TIA Portal has automatically assigned the same data type as

the one in line 1 and has incremented the address by 1 to %Q0.1 (Q0.1). Enter the

comment "Conveyor motor M1 backwards fixed speed".

( <Add> Q2 Enter Comment Conveyor motor M1 backwards fixed speed)

6.4 Import "Tag_table_sorting_station"

To insert an existing symbol table, right-click on an empty field of the created

"Tag_table_sorting_station". Select "Import file" in the shortcut menu.

( Right-click in an empty field of the tag table Import file)

Page 21: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 21

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Select the desired symbol table (e.g. in .xlsx format) and confirm the selection with

"Open".

( SCE_EN_020-100_Tag_table_sorting_station… Open)

When the import is finished, you will see a confirmation window and have an opportunity

to view the log file for the import. Click OK.

Page 22: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 22

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

You can see that some addresses have been highlighted in orange. These are duplicate

addresses and the names of the associated tags have been numbered automatically to

avoid confusion.

Delete the duplicate tags by selecting the lines and pressing the Del key on your

keyboard or selecting "Delete" in the shortcut menu.

( Right-click on selected tags Delete)

Page 23: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 23

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

You now have a complete symbol table of the digital inputs and outputs in front of you.

Save your project under the name 031-100_FC Programming.

( Project Save as ... 031-100_FC Programming Save)

Page 24: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 24

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

6.5 Create function FC1 "MOTOR_MANUAL" for the conveyor motor in manual mode

In the PLC programming section of the portal view, click "Add new block" to create a new

function.

( PLC programming Add new block )

Page 25: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 25

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Rename your new block to: "MOTOR_MANUAL", set the language to FBD and keep

automatic assignment of the number. Select the "Add new and open" check box. You will

thus be taken automatically to your created function block in the project view.Click "Add".

( Name: MOTOR_MANUAL Language: FBD Number: Automatic Add new

and open Add)

Page 26: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 26

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

6.6 Define the Interface of function FC1 "MOTOR_MANUAL"

If you selected "Add new and open", the project view opens with a window for creating

the block you just added.

You can find the interface description of your function in the upper section of your

programming view.

Page 27: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 27

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

A binary output signal is needed for controlling the conveyor motor. For this reason, we

first create local output tag #Conveyor_motor_manual_mode of the "Bool" type. Enter

comment "Control of the conveyor motor in manual mode" for the parameter.

( Output: Conveyor_motor_manual_mode Bool Control of the conveyor motor in

manual mode)

Add parameter #Manual_mode_active as the input interface under Input and confirm the

entry with the Enter key or by exiting the entry field. Data type "Bool" is assigned

automatically. This will be retained. Next, enter the associated comment "Manual mode

activated".

( Manual_mode_active Enter Bool Manual mode activated)

Continue by adding parameters #Pushbutton_manual_mode, #Enable_OK and

#Safety_shutoff_active as additional binary input parameters and check their data types.

Add descriptive comments.

Page 28: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 28

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

For purposes of program documentation, assign the block title, a block comment and a

helpful network title for Network 1.

( Block title: Motor control in manual mode Network 1: Control of the conveyor motor

in manual mode)

Page 29: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 29

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

6.7 Program FC1: MOTOR_MANUAL

Below the interface description, you see a toolbar in the programming window with

various logic functions and below that an area with networks. We have already specified

the block title and the title for the first network there. Programming is performed within the

networks using individual logic blocks. Distribution among multiple networks helps to

preserve the clarity of the program. In the following, you will get to know the various ways

you can insert logic blocks.

On the right side of your programming window is a list of instructions you can use in the

program. Under Basic instructions Bit logic operations, find function –[=]

(Assignment) and use a drag-and-drop operation to move it to Network 1 (green line

appears, mouse pointer with + symbol).

( Instructions Basic instructions Bit logic operations –[=])

Page 30: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 30

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Now use drag-and-drop to move your output parameter #Conveyor_motor_manual_mode

onto <??.?> above the block you just inserted. The best way to select a parameter in the

interface description is by "grabbing" it at the blue symbol .

( Conveyor_motor_manual_mode)

Page 31: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 31

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

This determines that the #Conveyor_motor_manual_mode parameter is written by this

block. Still missing, however, are the input conditions so that this actually happens. For

this, use drag-and-drop to move input parameter #Manual_mode_active to the left side of

the assignment block.

( Manual_mode_active)

The input of the assignment block will also be logically combined with other parameters

by an AND logic operation. To do this, first click the input of the block to which

#Manual_mode_active is already connected, so that the input line has a blue background.

Page 32: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 32

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Click the icon in your logic toolbar to insert an AND logic operation between the

#Manual_mode_active tag and your assignment block.

Double-click the second input of the & logic operation <??.?> and enter the letter "P" in

the field that appears in orer to see a list of available tags starting with "P". Click the

#Pushbutton_manual_mode tag and apply with Enter.

( & block <??.?> P #Pushbutton_manual_mode Enter)

Note: When assigning tags in this way, there is a risk of a mix-up with the global tags from the tag table. The previously presented procedure using drag and drop from the interface description should therefore be used preferentially.

Page 33: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 33

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

To ensure that the output can only be controlled when the enable conditions are met and

the safety shutoff is not active, the #Enable_OK and #Safety_shutoff_active input tags

are logically combined with the AND logic operation. To do this, click twice on the yellow

star of your AND block to add two additional inputs.

Add input tags #Enable_OK and #Safety_shutoff_active to your newly created inputs of

the AND block.

Negate the input connected to parameter #Safety_shutoff_active by selecting it and

clicking .

Page 34: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 34

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Do not forget to click regularly. The finished function "MOTOR_MANUAL"

[FC1] in FBD is shown below.

Page 35: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 35

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Under "General" in the properties of the block, you can change the "Language" to LAD

(Ladder Logic) (Properties General Language: LAD)

The program has the following appearance in LAD.

Page 36: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 36

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

6.8 Program the organization block OB1 – Control conveyor tracking forwards in manual mode

Before programming organization block "Main [OB1]", we switch the programming

language to FBD (Function Block Diagram). To do so, first click on "Main [OB1]" in the

"Program blocks" folder.

( CPU_1214C [CPU 1214C DC/DC/DC Program blocks Main [OB1] Switch

programming language FBD)

Open the "Main [OB1]" organization block with a double-click.

Page 37: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 37

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Assign Network 1 the name "Control conveyor tracking forwards in manual/jog mode"

( Network 1:... Control conveyor tracking forwards in manual/jog mode)

Use drag-and-drop to move your "MOTOR_MANUAL [FC1]" function onto the green line

in Network 1.

Page 38: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 38

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

A block with the interface you defined and connections EN and ENO are inserted in

Network 1.

To insert an AND before input parameter "Enable_OK", select this input and insert the

AND by clicking the icon in your logic toolbar ( ).

Page 39: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 39

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Click the yellow star of the AND block to add another input ( ).

To connect the block to the global tags from "Tag_table_sorting_station", we have two

options:

Either select the "Tag_table_sorting_station" in the project tree and use drag-and-drop to

move the desired global tag from the Details view to the interface of FC1

( Tag_table_sorting_station Details view. -S0 Manual_mode_active)

Or, enter the starting letters (e.g. "-S") of the desired global tag for <??.?> and select the

global input tag "-S0" (%I0.2) from the displayed list ( Manual_mode_active -S

-S0).

Page 40: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 40

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

Insert the other input tags "-S3", "-K0", "-B1", "-S4" and "-A1" and then insert output tag

"-Q1" (%Q0.0) at output "Conveyor_motor_manual_mode".

Negate the querying of input tags "-S0", "-S4" and "-A1" by selecting them and clicking

. ( -S0 -S4 -A1 )

Page 41: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 41

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

6.9 Save and compile the program

To save your project, select the button in the menu. To compile all blocks,

click the "Program blocks" folder and select the icon for compiling in the menu

( Program blocks ).

The "Info", "Compile" area shows which blocks were successfully compiled.

Page 42: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 42

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

6.10 Download the program

After successful compilation, the complete controller with the created program, as

previously described in the modules for hardware configuration, can be downloaded

( ).

Page 43: SCE-Basic Programming S7-1200 (2016)
Page 44: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 44

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

The "MOTOR_MANUAL" [FC1] function called in the "Main [OB1]" organization block can

be selected directly for "Open and monitor" after right-clicking ( "MOTOR_MANUAL"

[FC1] Open and monitor).

Note: The monitoring here is function-related and controller-independent. The actuation of sensors and the station status are shown here with TRUE or FALSE.

Page 45: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 45

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

If a particular point of use of the "MOTOR_MANUAL" [FC1] function is to be monitored,

the call environment can be selected using the icon ( Call environment

OK)

6.12 Archive the project

As the final step, we want to archive the complete project. Select the "Archive ..."

command in the "Project" menu. Select a folder where you want to archive your project

and save it with the file type "TIA Portal project archive". ( Project Archive

TIA Portal project archive 031-100_FC Programming…. Save)

Page 46: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 46

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

6.13 Checklist

No. Description Completed

1 Compiling successful and without error message

2 Download successful and without error message

3

Switch on station (-K0 = 1) Cylinder retracted / Feedback activated (-B1 = 1) EMERGENCY OFF (-A1 = 1) not activated MANUAL mode (-S0 = 0) Activate manual mode conveyor forwards (-S3 = 1) Conveyor motor forwards fixed speed (-Q1 = 1)

4 Same as 3 but activate EMERGENCY OFF (-A1 = 0) -Q1 = 0

5 Same as 3 but AUTO mode (-S0 = 1) -Q1 = 0

6 Same as 3 but switch off station (-K0 = 0) -Q1 = 0

7 Same as 3 but cylinder not retracted (-B1 = 0) -Q1 = 0

8 Same as 8 but also activate manual mode conveyor backwards

(-S4 = 1) -Q1 = 0

9 Project successfully archived

Page 47: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 47

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

7 Exercise

7.1 Task – Exercise

The following functions of the sorting station process description will be planned, programmed and tested in this chapter:

Manual mode – Control of conveyor tracking backwards in manual/jog mode

7.2 Technology diagram

Here, you see the technology diagram for the task.

Figure 10: Technology diagram

Figure 11: Control panel

Page 48: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 48

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

7.3 Reference list

The following signals are needed as operands for this task.

DI Type Identifier Function NC/NO

I 0.0 BOOL -A1 Return signal emergency stop ok NC

I 0.1 BOOL -K0 Main switch "ON" NO

I 0.2 BOOL -S0 Mode selector manual (0)/ automatic (1) Manual = 0

Auto = 1

I 0.5 BOOL -B1 Sensor cylinder M4 retracted NO

I 1.4 BOOL -S3 Pushbutton manual mode conveyor M1 forward

NO

I 1.5 BOOL -S4 Pushbutton manual mode conveyor M1 reverse

NO

DO Type Identifier Function

Q 0.1 BOOL -Q2 Conveyor motor M1 backwards fixed speed

Legend for reference list

7.4 Planning

Plan the implementation of the task on your own.

DO Digital Output

AO Analog Output

Q Output

DI Digital Input

AI Analog Input

I Input

NC Normally Closed

NO Normally Open

Page 49: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 49

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

7.5 Checklist – Exercise

No. Description Completed

1 Compiling successful and without error message

2 Download successful and without error message

3

Switch on station (-K0 = 1) Cylinder retracted / Feedback activated (-B1 = 1) EMERGENCY OFF (-A1 = 1) not activated MANUAL mode (-S0 = 0) Activate manual mode conveyor backwards (-S4 = 1) Conveyor motor backwards fixed speed (-Q2 = 1)

4 Same as 8 but activate EMERGENCY OFF (-A1 = 0) -Q2 = 0

5 Same as 8 but AUTO mode (-S0 = 1) -Q2 = 0

6 Same as 8 but switch off station (-K0 = 0) -Q2 = 0

7 Same as 8 but cylinder not retracted (-B1 = 0) -Q2 = 0

8 Same as 8 but also activate manual mode conveyor forwards

(-S3 = 1) -Q1 = 0 and -Q2 = 0

9 Project successfully archived

Page 50: SCE-Basic Programming S7-1200 (2016)

SCE Training Curriculum | TIA Portal Module 031-100, Edition 02/2016 | Digital Factory, DF FA

For unrestricted use in educational and R&D institutions. © Siemens AG 2016. All rights reserved. 50

SCE_EN_031-100 FC-Programming S7-1200_R1504.docx

8 Additional information

You can find additional information as an orientation aid for initial and advanced training, for

example: Getting Started, videos, tutorials, apps, manuals, programming guidelines and trial

software/firmware, at the following link:

www.siemens.com/sce/s7-1200

Page 51: SCE-Basic Programming S7-1200 (2016)

����������������������������� ��������������������������������������� ����������������� ��������� �������������� !��"���� �#��� ���$�%����&�����'��&�"����������(����!#� !)��*%�����+,-./0123234.,500265758.�����������������)��9�������(���:�������;<��=�����

Page 52: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9" "5@ABACB:D;E9::"#FEG%$=%.66+'="5HE;9::B0;I:J3-$,K" " "����L������������������M��N�O����L�N���������������� N�P"���������Q������������R�S�T�UN����O��V�W����������W"X%-(%"'$3Y"<A5H9;JE;FAD:EJ7FD"P"���������Q���������������UN����O��V�W����������W"X%-(%"'$3Y"<A5H9;JE;7AD:EJ7FD"P"Z[������������������Q�\�����]�������UO����Q�����V�UN����O��V�W����������W"X%-(%"'$3Y"<A5H99E:77:DEJ_AI���C$*("*>.*"*>()("*%.+'(%".,a.=()".%("%(/.,(-"b+*>")&,,())$%".,a.=()"b>('"'(,()).%c3"7'"$?(%?+(b"$d"*>(",&%%('*/c".?.+/.e/("5@A".,a.=()"+)".?.+/.e/(".*Y")+(6(')3,$6f),(f*"�������������������#$%"%(=+$'./"5+(6(')"5@A",$'*+'&(-"*%.+'+'=g"=(*"+'"*$&,>"b+*>"c$&%"%(=+$'./"5@A",$'*.,*")+(6(')3,$6f),(f,$'*.,*"���������������O�� �������������������)+(6(')3,$6f),("""��O�� ��������������N��h>("5@A"*%.+'+'=",&%%+,&/&6"d$%"*>("+'*(=%.*(-".&*$6.*+$'")$/&*+$'"h$*.//c"i'*(=%.*(-"7&*$6.*+$'"jhi7k"b.)"%(.%(-"d$%"*>("%$=%.6"l5+(6(')"7&*$6.*+$'"@$$(%.*()"b+*>"A-&,.*+$'"j5@Akl")(,+d+,.//c"d$%"*%.+'+'="&%$)()"d$%"&e/+,"(-&,.*+$'./"d.,+/+*+()".'-"012"+')*+*&*+$')3"5+(6(')"78"-$()"'$*"=&.%.'*(("*>(",$'*('*)3""h>+)"-$,&6('*"+)"*$"e("&)(-"$'/c"d$%"+'+*+./"*%.+'+'="$'"5+(6(')"%$-&,*)f)c)*(6)g"h>+)"6(.')"+*",.'"e(",$+(-"+'"b>$/("$%".%*".'-"=+?('"*$"*>$)("e(+'="*%.+'(-"d$%"&)("b+*>+'"*>("),$("$d"*>(+%"*%.+'+'=3"@+%,&/.*+$'"$%",$c+'="*>+)"*%.+'+'=",&%%+,&/&6".'-")>.%+'="+*)",$'*('*"+)"(%6+**(-"b+*>+'"&e/+,"*%.+'+'=".'-".-?.',(-"*%.+'+'="d.,+/+*+()"d$%"*%.+'+'="&%$)()3""AK,(*+$')"%(m&+%("b%+**('",$')('*"d%$6"*>("5+(6(')"78",$'*.,*"(%)$'Y"0$/.'-"5,>(&(%(%"%$/.'-3),>(&(%(%n)+(6(')3,$63""Xdd('-(%)"b+//"e(">(/-"/+.e/(3"7//"%+=>*)"+',/&-+'="*%.')/.*+$'".%("%()(%?(-g".%*+,&/.%/c"+d".".*('*"+)"=%.'*(-"$%"."&*+/+*c"6$-(/"$%"-()+='"+)"%(=+)*(%(-3""o)("d$%"+'-&)*%+./",&)*$6(%",$&%)()"+)"(K/+,+*/c"'$*"(%6+**(-3"p("-$"'$*",$')('*"*$",$66(%,+./"&)("$d"*>("*%.+'+'=",&%%+,&/&6)3""p("b+)>"*$"*>.'a"*>("ho"2%()-('g".%*+,&/.%/c"G%$d3"2%3Ei'=3"q($'"o%e.)".'-"2+/3Ei'=3"7''(**"Gd(dd(%g"*>("r+,>.(/"2s+.//.)"A'=+'((%+'="@$%$%.*+$'".'-".//"$*>(%"+'?$/?(-"(%)$')"d$%"*>(+%")& $%*"-&%+'="*>("%(.%.*+$'"$d"*>+)"*%.+'+'=",&%%+,&/&63"����

Page 53: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:@;E9::"#FEG%$=%.66+'="5HE;9::C0;I:J3-$,K" " "L.M/("$N",$'*('*)";O 8$./"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JO9O G%(%(P&+)+*("3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JO@O L>($%Q"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JO@3;O RS(%.*+'=")Q)*(6".'-".SS/+,.*+$'"S%$=%.6"3333333333333333333333333333333333333333333333333333333333333333333333333333333333"JO@39O R%=.'+T.*+$'"M/$,U)"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"IO@3@O G%$,())"+6.=(".'-",Q,/+,"S%$=%.6"S%$,())+'="3333333333333333333333333333333333333333333333333333333333333333333333333333"<O@3JO #&',*+$')"33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"VO@3IO #&',*+$'"M/$,U)".'-"+')*.',("-.*."M/$,U)"333333333333333333333333333333333333333333333333333333333333333333333333333333333333"WO@3<O 8/$M./"-.*."M/$,U)"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";:O@3HO X+M%.%QE,$6S.*+M/("/$=+,"M/$,U)333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";;O@3VO G%$=%.66+'="/.'=&.=()"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";9OJO L.)U"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";@OIO G/.''+'="3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";@OI3;O BYB08BDAZ"5LRG"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";@OI39O 7&*$6.*+,"6$-("E"A$'?(Q$%"6$*$%"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";@OI3@O L(,>'$/$=Q"-+.=%.6"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";JOI3JO 0(N(%(',("/+)*"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";IO<O 5*%&,*&%(-")*(SEMQE)*(S"+')*%&,*+$')"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";<O<3;O 0(*%+(?(".'"(K+)*+'="S%$[(,*"33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";<O<39O A%(.*("."'(\"*.="*.M/("3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";HO<3@O A%(.*("'(\"*.=)"\+*>+'"."*.="*.M/("333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";WO<3JO ]6S$%*"L.=C*.M/(C)$%*+'=C)*.*+$'333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9:O<3IO A%(.*("N&',*+$'"M/$,U"#F;"YRLR0C7_LR"N$%"*>(",$'?(Q$%"6$*$%"+'".&*$6.*+,"6$-("333333333"9JO<3<O 2(N+'("*>("+'*(%N.,("$N"#F;"YRLR0C7_LR"3333333333333333333333333333333333333333333333333333333333333333333333333333"9<O<3HO G%$=%.6"#F;"YRLR0C7_LR"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9WO<3VO G%$=%.6"*>("$%=.'+T.*+$'"M/$,U"RF;"a"A$'*%$/",$'?(Q$%"*%.,U+'="N$%\.%-)"+'".&*$6.*+,"6$-("@HO<3WO 0()&/*"+'"*>("X72"bX.--(%"X$=+,c"S%$=%.66+'="/.'=&.=("333333333333333333333333333333333333333333333333333333333"J9O<3;:O5.?(".'-",$6S+/("*>("S%$=%.6"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"J@O<3;;O2$\'/$.-"*>("S%$=%.6"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JJO<3;9OY$'+*$%"S%$=%.6"M/$,U)"33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JIO<3;@O7%,>+?("*>("S%$[(,*"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JVO<3;JOA>(,U/+)*"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JWOHO BK(%,+)("3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"I:OH3;O L.)U"a"BK(%,+)("33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"I:OH39O L(,>'$/$=Q"-+.=%.6"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"I:OH3@O 0(N(%(',("/+)*"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"I;OH3JO G/.''+'="33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"I;OH3IO A>(,U/+)*"a"BK(%,+)("3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"I9OVO 7--+*+$'./"+'N$%6.*+$'"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"I@"

Page 54: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:@3-$,K" " "L������M � L��NMON����PO���O����Q'"*>+)",>.R*(%S"T$&"U+//"=(*"*$"V'$U"*>("W.)+,"(/(6('*)"$X".",$'*%$/"R%$=%.6"Y"*>("Z[\]_]a_ZbcdZefgbhijgkl"mnea_ZgbhopgkS"q�������r���st�u Ltv".'-"�����r���st�u�Ltvw"Q'".--+*+$'S"T$&"U+//"W("+'*%$-&,(-"*$"d_c[][xyeZz{]a_cd|"X&',*+$'"&'-"X&',*+$'"W/$,V"R%$=%.66+'=3"}$&"U+//"=(*"*$"V'$U"*>("onea_ZbjdZefb~_]\[]zbhoj~k"R%$=%.66+'="/.'=&.=(".'-"&)("+*"*$"R%$=%.6"."X&',*+$'"W/$,V"�#G;�".'-".'"$%=.'+�.*+$'"W/$,V"��G;�3"���������t�����>+)",>.R*(%"W&+/-)"$'"*>(">.%-U.%(",$'X+=&%.*+$'"$X"5Q�7�QA"5I"AH�;9;@A3"�$U(?(%S"$*>(%">.%-U.%(",$'X+=&%.*+$')"*>.*">.?("-+=+*./"+'R&*".'-"$&*R&*"W$.%-"W("&)(-3"#$%"*>+)",>.R*(%S"T$&",.'"&)("*>("X$//$U+'="R%$�(,*S"X$%"(K.6R/(�"5ABCBDC:;;C;:;C�.%-U.%(CA$'X+=&%.*+$'CAH�;9;@A3�.R;E"�������!�E3;"M��������t!t�� ���������������������� "�B?(%T",$'*%$//(%"�AH��",$'*.+')".'"Z{|[]a_\bgxga|zS"U>+,>"$%=.'+�()".//"X&',*+$')".'-")(�&(',()"$X"*>("AH�"*>.*".%("'$*".))$,+.*(-"U+*>".")R(,+X+,",$'*%$/"*.)V3""�>("*.)V)"$X"*>("$R(%.*+'=")T)*(6"+',/&-("*>("X$//$U+'=�"�"H(%X$%6+'="."U.%6"%()*.%*"�"�R-.*+'="*>("R%$,())"+6.=("$X"*>("+'R&*)".'-"$&*R&*"�"AT,/+,.//T",.//+'="*>("&)(%"R%$=%.6"�"2(*(,*+'="+'*(%%&R*)".'-",.//+'="+'*(%%&R*"�G)"�"2(*(,*+'=".'-">.'-/+'="(%%$%)"�"�.'.=+'="6(6$%T".%(.)"�>("$R(%.*+'=")T)*(6"+)".'"+'*(=%./",$6R$'('*"$X"*>("AH�".'-",$6()"R%(F+')*.//(-3"�>("ng|[b{[Z\[]z",$'*.+')".//"X&',*+$')"*>.*".%("'(,()).%T"X$%"(K(,&*+'="T$&%")R(,+X+,".&*$6.*+$'"*.)V3"�>("*.)V)"$X"*>("&)(%"R%$=%.6"+',/&-("*>("X$//$U+'=�"�"A>(,V+'="*>("W.)+,"%(�&+%(6('*)"X$%"."U.%6"%()*.%*"&)+'=")*.%*&R"�G)"�"H%$,())+'="$X"R%$,())"-.*.S"+3(3".,*+?.*+$'"$X"$&*R&*")+='./)".)"."X&',*+$'"$X"*>("+'R&*")+='./")*.*()"�"0(.,*+$'"*$"+'*(%%&R*)".'-"+'*(%%&R*"+'R&*)"�"B%%$%">.'-/+'="-&%+'="'$%6./"R%$=%.6"(K(,&*+$'"

Page 55: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;@:J3-$,K" " "E39"L����M������N���OP�Q%=.'+R.*+$'"S/$,T)"UQG)V"W$%6"*>("+'*(%W.,("S(*X(('"*>("$Y(%.*+'=")Z)*(6"$W"*>(",$'*%$//(%"UAH[V".'-"*>(".YY/+,.*+$'"Y%$=%.63"\>(Z".%(",.//(-"W%$6"*>("$Y(%.*+'=")Z)*(6".'-",$'*%$/"*>("W$//$X+'="$Y(%.*+$')]""AZ,/+,"Y%$=%.6"Y%$,())+'="U(3=3"QG;V""5*.%*&Y",>.%.,*(%+)*+,)"$W"*>(",$'*%$//(%""_'*(%%&Y*F-%+?('"Y%$=%.6"Y%$,())+'=""B%%$%">.'-/+'="7"Y%$(,*"6&)*">.?(a".*"."6+'+6&6a"bcdefgbchibjhecdklemndoefdmpmlhmdqfegfbrdqfemstthcg3"7'"QG"+)",.//(-"SZ"."tjbfjdsuscj".)")>$X'"+'"#+=&%(";3"_'".--+*+$'a"*>("+'-+?+-&./"QG)">.?("-(W+'(-"Y%+$%+*+()")$"*>.*a"W$%"(K.6Y/(a".'"QGv9"W$%"(%%$%">.'-/+'=",.'"+'*(%%&Y*"*>(",Z,/+,"QG;3"" "#+=&%(";]"5*.%*"(?('*)"+'"*>("$Y(%.*+'=")Z)*(6".'-"QG",.//)"" Lw�xy�z��!����{|}~����}������� {|}~����}��|�{|}~����}��|� �ffefd�bc�lhcgddQG"v:"QG"v9"�"�cjsff�qj��fhuscdqfegfbrdqfemstthcgd�������"��������������"QG";::"�.%6"%()*.%*"�"�!�����"����� ������PP���QG";"L��������P!P�� �

Page 56: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" <" "5@ABACB:D;E9::"#FEG%$=%.66+'="5HE;9::B0;I:J3-$,K" " "L>('".")*.%*"(?('*"$,,&%)M"*>("N$//$O+'="%(.,*+$')".%("P$))+Q/(R"S"TN".'"UF">.)"Q(('".))+='(-"*$"*>("(?('*M"*>+)"(?('*"*%+==(%)"*>("(K(,&*+$'"$N"*>(".))+='(-"UF3"TN"*>("P%+$%+*V"$N"*>(".))+='(-"UF"+)"=%(.*(%"*>.'"*>("P%+$%+*V"$N"*>("UF"*>.*"+)",&%%('*/V"Q(+'="(K(,&*(-M"+*"+)"(K(,&*(-"+66(-+.*(/V"W+'*(%%&P*X3"TN"'$*M"*>(".))+='(-"UF"O.+*)"&'*+/"*>(">+=>(%EP%+$%+*V"UF">.)"Q(('",$6P/(*(/V"(K(,&*(-"S"TN"V$&">.?("'$*".))+='(-".'"UF"*$"*>("(?('*M"*>("-(N.&/*")V)*(6"%(.,*+$'"+)"P(%N$%6(-3""Y.Q/(";")>$O)"(K.6P/()"N$%"?.%+$&)")*.%*"(?('*)"N$%"."5TZ7YT@"5HE;9::3""7/)$")>$O'".%("*>("P$))+Q/("UF"'&6Q(%W)X".'-"*>("-(N.&/*")V)*(6"%(.,*+$')"*>.*"$,,&%"O>('"*>("%()P(,*+?("$%=.'+[.*+$'"Q/$,\"WUFX"+)"'$*"P%()('*"+'"*>(",$'*%$//(%3"�������]���� �� �_���a�� _��� ��b����!�� ����������5*.%*&P" ;::M"c";9D" T='$%("defghfijklmknoi ;M"c";9D" T='$%("Y+6(E$NE-.V"+'*(%%&P*" ;:"*$";;" E"pP-.*("+'*(%%&P*" I<" T='$%("5,.'",V,/("6$'+*$%+'="*+6("(K,((-(-"$',(" q:" T='$%("5,.'",V,/("6$'+*$%+'="*+6("(K,((-(-"*O+,(" q:" 5YUG"2+.='$)*+,"+'*(%%&P*" q9" T='$%("Y.Q/(";R"UF"'&6Q(%)"N$%"?.%+$&)")*.%*"(?('*)""D3D"����� �� ��������!�����r���� �r���� ���L>('"*>(",V,/+,"&)(%"P%$=%.6".--%())()"*>("+'P&*)"WTX".'-"$&*P&*)"WUXM"+*"-$()"'$*"s&(%V"*>(")+='./")*.*()"-+%(,*/V"N%$6"*>("+'P&*t$&*P&*"6$-&/()3"T')*(.-M"+*".,,())()"."6(6$%V".%(."$N"*>("@Gp3"Y>+)"6(6$%V".%(.",$'*.+')".'"+6.=("$N"*>(")+='./")*.*()".'-"+)",.//(-"*>("r���� �� ��3"""

Page 57: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5@F;9::C0;I:J3-$,K" " "L>(",M,/+,"N%$=%.6"N%$,())+'=")(O&(',("+)".)"P$//$Q)R";3" 7*"*>(")*.%*"$P"*>(",M,/+,"N%$=%.6S"."O&(%M"+)")('*"*$"-(*(%6+'("Q>(*>(%"$%"'$*"*>("+'-+?+-&./"+'N&*)".%("('(%=+T(-3"L>+)")*.*&)"$P"*>("+'N&*)"+)")*$%(-"+'"*>("U����VV�� ����W��X����U�V�Y���Z3"['"-$+'=")$S"*>("+'P$%6.*+$'";"$%"\]+=>\"+)")*$%(-"P$%"('(%=+T(-"+'N&*)".'-"*>("+'P$%6.*+$'":"$%"\$Q\"P$%"-(F('(%=+T(-"+'N&*)3""93" L>("AH_"*>('"(K(,&*()"*>("N%$=%.6")*$%(-"+'"*>(",M,/+,"$%=.'+T.*+$'"/$,a3"#$%"*>("%(O&+%(-"+'N&*"+'P$%6.*+$'S"*>("AH_".,,())()"*>("N%(?+$&)/M"%(.-"U����VV�� ����W��X����U�V�Y���Z".'-"*>("%()&/*)"$P"/$=+,"$N(%.*+$'"b0 c)d".%("Q%+**('"*$".")$F,.//(-"U����VV�� ����W��X����U�V�Y��eZ3""E3" 7*"*>("('-"$P"*>(",M,/(S"*>("U����VV�� ����W��X����U�V�b��ed"+)"*%.')P(%%(-".)"*>(")+='./")*.*("*$"*>("$&*N&*"6$-&/()".'-"*>()(".%("('(%=+T(-"$%"-(F('(%=+T(-3"L>(")(O&(',("*>('",$'*+'&()".=.+'"Q+*>"[*(6";3"""""""""""""""���� #+=&%("9R"AM,/+,"N%$=%.6"N%$,())+'="� fghijklmnopqrnopmnostuovnnwxoyz{opmqxoxn|}nv~noqxo~���nwo~�~�nopqrn�olmqxown�nvwx�oqvop}{v�ozvopmnov}r�n{o�vwop��nozyoqvxp{}~pqzvxo�vwopmno�{z~nxxz{o�n{yz{r�v~nozyopmno~zvp{z��n{�oHA"N%$=%.6"+'"*>("N%$=%.6"6(6$%M""";)*"+')*%&,*+$'"9'-"+')*%&,*+$'"E%-"+')*%&,*+$'"J*>"+')*%&,*+$'"333"""".)*"+')*%&,*+$'""" "�3"5.?(")*.*&)"$P"+'N&*)"+'"H[[3"��"H%$,())+'="*>("N%$=%.6"+')*%&,*+$'FMF+')*%&,*+$'"Q+*>".,,())"*$"H[[".'-"H[�""���L%.')P(%")*.*&)"P%$6"*>("H[�"*$"*>("$&*N&*)3" ���������������"���� � ��!�����������V���e�

Page 58: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:K3-$,L" " "E3K" ������M�#&',*+$')"N#A)O".%("/$=+,"P/$,Q)"R+*>$&*"6(6$%S3"T>(S"UVWXYZ[Y\V]VYX [_"+'"R>+,>"?./&()"$a"P/$,Q"b.%.6(*(%)",.'"P(")*$%(-3"T>(%(a$%(c".//"+'*(%a.,("b.%.6(*(%)"6&)*"P(",$''(,*(-"R>('"."a&',*+$'"+)",.//(-3"T$")*$%("-.*."b(%6.'('*/Sc"=/$P./"-.*."P/$,Q)"6&)*"P(",%(.*(-"P(a$%(>.'-3"7"a&',*+$'",$'*.+')"."b%$=%.6"*>.*"+)"(L(,&*(-"R>('(?(%"*>("a&',*+$'"+)",.//(-"a%$6".'$*>(%"/$=+,"P/$,Q3""#&',*+$')",.'"P("&)(-c"a$%"(L.6b/(c"a$%"*>("a$//$R+'="b&%b$)()d"e"f.*>"a&',*+$')"g"*>.*"%(*&%'"."%()&/*"-(b('-('*"$'"+'b&*"?./&()3"e"T(,>'$/$=+,./"a&',*+$')"g")&,>".)"+'-+?+-&./",$'*%$/)"R+*>"P+'.%S"/$=+,"$b(%.*+$')3"7"a&',*+$'",.'"./)$"P(",.//(-")(?(%./"*+6()".*"-+aa(%('*"b$+'*)"R+*>+'"."b%$=%.63""""""""""""""""""""#+=&%("Ed"#&',*+$'"R+*>",.//"a%$6"$%=.'+h.*+$'"P/$,Q"f.+'"ijG;k""� j%=.'+h.*+$'"P/$,Q""f.+'"ijG;k""A.//)"*>("fjTj0Cf7Dl7m"i#A;k"a&',*+$'"" #&',*+$'"fjTj0Cf7Dl7m"i#A;k""A$'*.+')"."b%$=%.6"a$%",$'*%$//+'=".",$'?(S$%"+'"6.'&./"6$-(c"a$%"(L.6b/(3"""T>("a&',*+$'">.)"'$"6(6$%S3"""

Page 59: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:K3-$,L" " "E3J" �������M���NO�������O�����������M���NO�#&',*+$'"P/$,Q)".%("/$=+,"P/$,Q)"*>.*")*$%("*>(+%"+'R&*S"$&*R&*".'-"+'F$&*"*.=)".)"T(//".)")*.*+,"*.=)"R(%6.'('*/U"+'"+')*.',("-.*."P/$,Q)S")$"*>.*"*>(U"VWXYVZV[\V]\XYV_XWY_XY]\abcYVdY]XXeYXfXbg_Xh3"#$%"*>+)"%(.)$'S"*>(U".%("./)$"%(i(%%(-"*$".)"P/$,Q)"T+*>"j6(6$%Uj3"#&',*+$'"P/$,Q)",.'"./)$"$R(%.*("T+*>"*(6R$%.%U"*.=)3"k(6R$%.%U"*.=)".%("'$*")*$%(-"+'"*>("+')*.',("2GS">$T(?(%3"l')*(.-S"*>(U".%("$'/U".?.+/.P/("i$%"$'(",U,/(3"#&',*+$'"P/$,Q)".%("&)(-"i$%"*.)Q)"*>.*",.''$*"P("+6R/(6('*(-"T+*>"i&',*+$')m"n"o>('(?(%"*+6(%)".'-",$&'*(%)".%("%(p&+%(-"+'"*>("P/$,Q)S"$%"n"o>('"+'i$%6.*+$'"6&)*"P(")*$%(-"+'"*>("R%$=%.6S")&,>".)"R%()(/(,*+$'"$i"*>("$R(%.*+'="6$-("T+*>"."P&**$'3"#&',*+$'"P/$,Q)".%("./T.U)"(L(,&*(-"T>('",.//(-"i%$6".'$*>(%"/$=+,"P/$,Q3"7"i&',*+$'"P/$,Q",.'"./)$"P(",.//(-")(?(%./"*+6()".*"-+ii(%('*"R$+'*)"T+*>+'"."R%$=%.63"k>+)"i.,+/+*.*()"*>("R%$=%.66+'="$i"i%(p&('*/U"%(,&%%+'=",$6R/(L"i&',*+$')3"7",.//"$i"."i&',*+$'"P/$,Q"+)"%(i(%%(-"*$".)".'"+')*.',(3"B.,>"+')*.',("$i"."i&',*+$'"P/$,Q"+)".))+='(-"."6(6$%U".%(."*>.*",$'*.+')"*>("-.*."*>.*"*>("i&',*+$'"P/$,Q"&)()3"k>+)"6(6$%U"+)"6.-(".?.+/.P/("PU"-.*."P/$,Q)",%(.*(-".&*$6.*+,.//U"PU"*>(")$i*T.%(3""l*"+)"./)$"R$))+P/("*$"R%$?+-("6(6$%U"i$%"6&/*+R/("+')*.',()"+'"$'("-.*."P/$,Q"+'"*>("i$%6"$i"." ������O�����3"k>("6.L+6&6")+q("$i"+')*.',("-.*."P/$,Q)"?.%+()"-(R('-+'="$'"*>("AHr3"k>("*.=)"-(,/.%(-"+'"*>("i&',*+$'"P/$,Q"-(*(%6+'("*>(")*%&,*&%("$i"*>("+')*.',("-.*."P/$,Q3"""""""""""""""""""#+=&%("Km"#&',*+$'"P/$,Q".'-"+')*.',("T+*>",.//"i%$6"$%=.'+q.*+$'"P/$,Q"s.+'"tuG;v�l')*.',("-.*."P/$,Q"suku0C7rkuC2G;"t2G;v".)"6(6$%U""" i$%"*>(",.//""" $i"i&',*+$'"" P/$,Q""" suku0C7rku" t#G;v"u%=.'+q.*+$'"P/$,Q""s.+'"tuG;v""A.//)"i&',*+$'"P/$,Q"suku0C7rku"t#G;v"*$=(*>(%"T+*>"+*)"+')*.',("-.*."P/$,Q"suku0C7rkuC2G;"t2G;v" #&',*+$'"P/$,Q"suku0C7rku"t#G;v""A$'*.+')"."R%$=%.6"i$%",$'*%$//+'=".",$'?(U$%"+'".&*$6.*+,"6$-(S"i$%"(L.6R/(3"k>("i&',*+$'"P/$,Q"&)()"+')*.',("-.*."P/$,Q"suku0C7rkuC2G;"t2G;v".)"6(6$%U"+'"*>+)",.//3"""

Page 60: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;:" "5@ABACB:D;E9::"#FEG%$=%.66+'="5HE;9::B0;I:J3-$,K" " "D3<"L��M��������M���NO�P'",$'*%.)*"*$"/$=+,"Q/$,R)S"-.*."Q/$,R)",$'*.+'"'$"+')*%&,*+$')3"0.*>(%S"*>(T")(%?(".)"6(6$%T"U$%"&)(%"-.*.3"2.*."Q/$,R)"*>&)",$'*.+'"?.%+.Q/("-.*."*>.*"+)"&)(-"QT"*>("&)(%"V%$=%.63"W$&",.'"-(U+'("*>(")*%&,*&%("$U"=/$Q./"-.*."Q/$,R)".)"%(X&+%(-3""8/$Q./"-.*."Q/$,R)")*$%("-.*."*>.*",.'"Q("&)(-"YZ[\]][_ab[Y]cde"f)(("#+=&%("Ig3"h'/T"*>(".))$,+.*(-"U&',*+$'"Q/$,R")>$&/-".,,())"+')*.',("-.*."Q/$,R)3"i>("6.K+6&6")+j("$U"-.*."Q/$,R)"?.%+()"-(V('-+'="$'"*>("@Gk3"" "#+=&%("Il"2+UU(%(',("Q(*m(('"=/$Q./"2F".'-"+')*.',("2F3""7VV/+,.*+$'"(K.6V/()"U$%"��M��������M���NO".%(l"n"5.?+'="$U"+'U$%6.*+$'".Q$&*".")*$%.=(")T)*(63"op>+,>"V%$-&,*"+)"/$,.*(-"m>(%(qo"n"5.?+'="$U"%(,+V()"U$%"V.%*+,&/.%"V%$-&,*)3"� #&',*+$'B;:"#&',*+$'B;;"#&',*+$'""Q/$,RB;9" 8/$Q./"2F"f2FB8/$Q./g"P')*.',("2F"f2FBP')*.',(g" 7,,())"U$%".//"Q/$,R)"7,,())"$'/T"U$%"U&',*+$'""-.*."Q/$,RB;9"

Page 61: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;;" "5@ABACB:D;E9::"#FEG%$=%.66+'="5HE;9::B0;I:J3-$,K" " "D3H"L�M���!��� N���M��������M���OP�7"&)(%"Q%$=%.6",.'"R(",%(.*(-"S+*>"/+'(.%"$%")*%&,*&%(-"Q%$=%.66+'=3"TUVWXYZ[Y\]YX ^UV]"S%+*()"*>("('*+%("&)(%"Q%$=%.6"+'"*>(",_,/("Fa"R&*"+)"$'/_")&+*.R/("b$%"?(%_")+6Q/("Q%$=%.6)"b$%"S>+,>"$*>(%"/())"(KQ(')+?(",$'*%$/")_)*(6)a")&,>".)"c 8 da",.'"'$S"R("&)(-3"#$%"6$%(",$6Q/(K"Q%$=%.6)a"efYghfgYWiZ[Y\]YX ^UV]"+)"./S._)"%(,$66('-(-3"j(%(a"*>("$?(%.//".&*$6.*+$'"*.)k",.'"R("R%$k('"-$S'"+'*$")6.//")&RE*.)k)"+'"$%-(%"*$"+6Q/(6('*".")$/&*+$'"b$%"*>(6"+'"b&',*+$')".'-"b&',*+$'"R/$,k)3"l'"*>+)",.)(a"/+R%.%_E,$6Q.*+R/("/$=+,"R/$,k)")>$&/-"R(",%(.*(-"Q%(b(%('*+.//_3"m>+)"6(.')"*>.*"*>("+'Q&*".'-"$&*Q&*"Q.%.6(*(%)"$b"."b&',*+$'"$%"b&',*+$'"R/$,k".%("-(b+'(-"=('(%.//_".'-"$'/_")&QQ/+(-"S+*>"*>(",&%%('*"=/$R./"*.=)"n+'Q&*)o$&*Q&*)p"S>('"*>("R/$,k"+)"&)(-3""""#+=&%("<q"c+R%.%_E,$6Q.*+R/("b&',*+$'"R$,k"S+*>",.//"+'"F;"

Page 62: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;9" "5@ABACB:D;E9::"#FEG%$=%.66+'="5HE;9::B0;I:J3-$,K" " "D3L"����� ��������M�#$%"5NO7PN@"5HE;9::",$'*%$//(%Q"*>(".?.+/.R/("S%$=%.66+'="/.'=&.=()"T$%"S%$=%.66+'="T&',*+$')".'-"T&',*+$'"R/$,U)".%("#&',*+$'"F/$,U"2+.=%.6"V#F2WQ"X.--(%"X$=+,"VX72W".'-"5*%&,*&%(-"@$'*%$/"X.'=&.=("V5@XW3"P>("YZ[\]_[ab_\cdefgehiYadj"S%$=%.66+'="/.'=&.=("k+//"R("S%()('*(-"+'"*>("T$//$k+'=3#F2"+)"."=%.S>+,./"S%$=%.66+'="/.'=&.=(3"P>("%(S%()('*.*+$'"+)"R.)(-"$'"(/(,*%$'+,")k+*,>+'=")l)*(6)3"P>("S%$=%.6"+)"6.SS(-"+'"'(*k$%U)3"7"'(*k$%U",$'*.+')"$'("$%"6$%("/$=+,"$S(%.*+$'"S.*>)3"F+'.%l".'-".'./$=")+='./)".%("/+'U(-"*$=(*>(%"Rl"R$K()3"P>("=%.S>+,./"/$=+,")l6R$/)"U'$k'"T%$6"F$$/(.'"./=(R%.".%("&)(-"*$"%(S%()('*"*>("R+'.%l"/$=+,3"m$&",.'"&)("R+'.%l"T&',*+$')"*$"n&(%l"R+'.%l"$S(%.'-)".'-"*$"/$=+,.//l",$6R+'("*>(+%")+='./")*.*()3"P>("T$//$k+'="+')*%&,*+$')".%("(K.6S/()"$T"R+'.%l"T&',*+$')o"p7C2"$S(%.*+$'pQ"pq0"$S(%.*+$'p".'-"pAr@Xs5NtA"q0"$S(%.*+$'p3"P>()(".%(")>$k'"+'"#+=&%("H3"" "#+=&%("Ho"F+'.%l"T&',*+$')"+'"#F2".'-".))$,+.*(-"/$=+,"*.R/("m$&",.'"*>&)"&)(")+6S/("+')*%&,*+$')Q"T$%"(K.6S/(Q"*$",$'*%$/"R+'.%l"$&*S&*)Q"(?./&.*("(-=()".'-"(K(,&*("u&6S"T&',*+$')"+'"*>("S%$=%.63"G%$=%.6"(/(6('*)")&,>".)"NA@"*+6(%)".'-"NA@",$&'*(%)"S%$?+-(",$6S/(K"+')*%&,*+$')3"P>("(6S*l"R$K")(%?()".)"."S/.,(>$/-(%"+'"k>+,>"l$&",.'")(/(,*"*>("%(n&+%(-"+')*%&,*+$'3"A'.R/("+'S&*"AC"V('.R/(Wv"A'.R/("$&*S&*"ACq"V('.R/("$&*S&*W"6(,>.'+)6o"w"7'"+')*%&,*+$'"k+*>$&*"ACvACq"6(,>.'+)6"+)"(K(,&*(-"+'-(S('-('*"$T"*>(")+='./")*.*(".*"*>("R$K"+'S&*)3"w"N')*%&,*+$')"k+*>"ACvACq"6(,>.'+)6".%("$'/l"(K(,&*(-"+T"('.R/("+'S&*"pAC"+'S&*">.)")+='./")*.*("p;p3"x>('"*>("R$K"+)"S%$,())(-",$%%(,*/lQ"('.R/("$&*S&*"pACqp">.)")+='./")*.*("p;p3"NT".'"(%%$%"$,,&%)"-&%+'="S%$,())+'=Q"*>("('.R/("$&*S&*"pACqp"+)"%()(*3"NT"('.R/("+'S&*"AC"+)"'$*",$''(,*(-Q"*>("R$K"+)"./k.l)"(K(,&*(-3"

Page 63: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:@;E9::"#FEG%$=%.66+'="5HE;9::C0;I:J3-$,K" " "L���MN�O>("P$//$Q+'="P&',*+$')"$P"*>(")$%*+'=")*.*+$'"R%$,())"-(),%+R*+$'"Q+//"S("R/.''(-T"R%$=%.66(-".'-"*()*(-"+'"*>+)",>.R*(%U"V"7&*$6.*+,"6$-("E"A$'?(W$%"6$*$%"X���������O>("R%$=%.66+'="$P".//"P&',*+$')"+'"YF;"+)"'$*"%(,$66('-(-"P$%"%(.)$')"$P",/.%+*W".'-"%(&).S+/+*W3"O>("6.Z$%+*W"$P"*>("R%$=%.6",$-("Q+//"*>(%(P$%("S("6$?(-"+'*$"P&',*+$')"[#A)\".'-"P&',*+$'"S/$,])"[#F)\3"O>("-(,+)+$'"$'"Q>+,>"P&',*+$')"+)"*$"S("6$?(-"*$"*>("#F".'-"Q>+,>"+)"*$"%&'"+'"YF";"+)"R/.''(-"S(/$Q3"I3;"��� _� �a���b��O>("BcB08BDAd"5OYG"-$()"'$*"%(e&+%(".")(R.%.*("P&',*+$'3"f&)*"/+]("*>("$R(%.*+'="6$-(T"*>(",&%%('*")*.*("$P"*>("BcB08BDAd"5OYG"%(/.W",.'"S("&)(-"-+%(,*/W".*"*>("S/$,])3"I39"��� ����� ���������g�!��� �����7&*$6.*+,"6$-("$P"*>(",$'?(W$%"6$*$%"+)"*$"S("(',.R)&/.*(-"+'"."P&',*+$'"S/$,]"[#F\"hcYOY0C7iOYh3"Y'"*>("$'(">.'-T"*>+)"R%()(%?()"*>(",/.%+*W"$P"YF;3"Y'"*>("$*>(%">.'-T"+*"('.S/()"%(&)("+P".'$*>(%",$'?(W$%"S(/*"+)".--(-"*$"*>(")*.*+$'3"O.S/("9"/+)*)"*>("R/.''(-"R.%.6(*(%)3"��j�� 2.*."*WR(" A$66('*"7&*$6.*+,C6$-(C.,*+?(" FYYk" 7&*$6.*+,"6$-(".,*+?.*(-"5*.%*" FYYk" G&)>S&**$'".&*$6.*+,")*.%*"5*$R" FYYk" G&)>S&**$'".&*$6.*+,")*$R"B'.S/(CYl" FYYk" 7//"('.S/(",$'-+*+$')"Yl"5.P(*WC)>&*$PPC.,*+?(" FYYk" 5.P(*W")>&*$PP".,*+?("(3=3"(6(%=(',W")*$R"$R(%.*(-"b�j�� " "A$'?(W$%C6$*$%C.&*$6.*+,C6$-("FYYk" A$'*%$/"$P"*>(",$'?(W$%"6$*$%"+'".&*$6.*+,"6$-("������� � �c(6$%WC.&*$6.*+,C)*.%*C)*$R" FYYk" c(6$%W"&)(-"P$%")*.%*m)*$R".&*$6.*+,"6$-("O.S/("9U"G.%.6(*(%)"P$%"#F"hcYOY0C7iOYh"O>("c(6$%WC.&*$6.*+,C)*.%*C)*$R"+)"/.*,>(-"Q+*>"5*.%*"S&*"$'/W"+P"*>("%()(*",$'-+*+$')".%("'$*"R%()('*3""O>("c(6$%WC.&*$6.*+,C)*.%*C)*$R"+)"%()(*"+P"5*$R"+)"R%()('*"$%").P(*W")>&*$PP"+)".,*+?("$%".&*$6.*+,"6$-("+)"'$*".,*+?.*(-"[6.'&./"6$-(\3"O>("A$'?(W$%C6$*$%C.&*$6.*+,C6$-("$&*R&*"+)",$'*%$//(-"Q>('"c(6$%WC.&*$6.*+,C)*.%*C)*$R"+)")(*".'-"*>("('.S/(",$'-+*+$')".%("6(*3"

Page 64: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:@3-$,K" " "J3E"���LMNONPQ����PR���S(%(T"U$&")(("*>("*(,>'$/$=U"-+.=%.6"V$%"*>("*.)W3"" "#+=&%("XY"Z(,>'$/$=U"-+.=%.6" "#+=&%("[Y"A$'*%$/"\.'(/""

Page 65: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;@:J3-$,K" " "@3J"L� �L�M���N����O>("P$//$Q+'=")+='./)".%("'((-(-".)"$R(%.'-)"P$%"*>+)"*.)S3"��� �!T�� ������U���� ������� M��MV�W":3:" GXXY" F7;" 0(*&%'")+='./"(6(%=(',Z")*$R"$S" DA"W":3;" GXXY" F[:" \.+'")Q+*,>"]XD]" DX"W":39" GXXY" F5:" \$-(")(/(,*$%"6.'&./":_".&*$6.*+,";_" \.'&./"a":"7&*$"a";"W":3E" GXXY" F5;" H&)>b&**$'".&*$6.*+,")*.%*" DX"W":3J" GXXY" F59" H&)>b&**$'".&*$6.*+,")*$R" DA"W":3@" GXXY" FG;" 5(')$%",Z/+'-(%"\J"%(*%.,*(-" DX""�V� �!T�� ������U���� ������� �c":3:" GXXY" Fc;" A$'?(Z$%"6$*$%"\;"P$%Q.%-)"P+K(-")R((-" "defgfhidjkldlfjflfhmfdnopqd"""""""""" 2X" 2+=+*./"X&*R&*"7X" 7'./$="X&*R&*"c" X&*R&*"2W" 2+=+*./"W'R&*"7W" 7'./$="W'R&*"W" W'R&*"DA" D$%6.//Z"A/$)(-""DX" D$%6.//Z"XR('""

Page 66: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;<" "5@ABACB:D;E9::"#FEG%$=%.66+'="5HE;9::B0;I:J3-$,K" " "�����������L��M�N!�L��M���L�������L�O$&",.'"P+'-"+')*%&,*+$')"$'">$Q"*$",.%%R"$&*"S/.''+'="T(/$Q3"UP"R$&"./%(.-R">.?("."=$$-"&'-(%)*.'-+'="$P"(?(%R*>+'=V"+*"Q+//"T(")&PP+,+('*"*$"P$,&)"$'"*>("'&6T(%(-")*(S)3"W*>(%Q+)(V")+6S/R"P$//$Q"*>("-(*.+/(-")*(S)"+'"*>("+')*%&,*+$')3"<3;"X�����Y������Z�L����M��[����\"F(P$%("Q(",.'")*.%*"S%$=%.66+'="*>("P&',*+$'"T/$,]"#F_"aWbW0B7cbWV"Q("'((-"."S%$d(,*"Q+*>".">.%-Q.%(",$'P+=&%.*+$'"(3=3"5@ABACB:;;B;:;Be.%-Q.%(B@$'P+=&%.*+$'B5HE@Gc;9;[email protected]_3"b$"%(*%+(?(".'"(K+)*+'="S%$d(,*"*>.*">.)"T(('".%,>+?(-V"R$&"6&)*")(/(,*"*>("%(/(?.'*".%,>+?("Q+*>"\"G%$d(,*"\"0(*%+(?("+'"*>("S%$d(,*"?+(Q3"@$'P+%6"R$&%")(/(,*+$'"Q+*>"WS('"\"G%$d(,*"\"0(*%+(?("\"5(/(,*"."3f.S".%,>+?("\"WS('_3""\"b>("'(K*")*(S"+)"*$")(/(,*"*>("*.%=(*"-+%(,*$%R"Q>(%("*>("%(*%+(?(-"S%$d(,*"Q+//"T(")*$%(-3"@$'P+%6"R$&%")(/(,*+$'"Q+*>"Wg3"\"b.%=(*"-+%(,*$%R"\"Wg_""

Page 67: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5@F;9::C0;I:J3-$,K" " ""<39"�����������L������M���N"O'"*>("P%$Q(,*"?+(RS"'.?+=.*("*$"*>("N"HTA"*.=)"$U"V$&%",$'*%$//(%".'-",%(.*("."'(R"*.="*.W/("WV"-$&W/(F,/+,X+'="N"7--"'(R"*.="*.W/(3"" ""

Page 68: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:K3-$,L" " "M"0('.6("*>("*.="*.N/("O$&"P&)*",%(.*(-".)"QR.=C*.N/(C)$%*+'=C)*.*+$'Q"SM"%+=>*F,/+,T"QR.=C*.N/(C;Q"M"Q0('.6(Q"M"R.=C*.N/(C)$%*+'=C)*.*+$'U3" "M"VW('"*>+)"*.="*.N/("X+*>"."-$&N/(F,/+,T3""SM"R.=C*.N/(C)$%*+'=C)*.*+$'U" �

Page 69: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:K3-$,L" " "<3E"���������M���N�M��O����������P���Q"7--"*>("'.6("R;".'-",$'S+%6"*>("('*%T"U+*>"*>("B'*(%"V(T3"WS"T$&">.?("'$*"T(*",%(.*(-".--+*+$'./"*.=)X"YW7"H$%*./"'$U".&*$6.*+,.//T".))+=')"-.*."*TZ("[G$$/[".'-".--%())"\W:3:"]W":3:"]Q"_7--"Q"R;"Q"B'*(%3" "Q"A>.'=("*>(".--%())"*$"\R:3:"]R":3:"aT"('*(%+'="*>+)"-+%(,*/T"$%"aT",/+,V+'="*>("-%$ZF-$U'".%%$U"*$"$Z('"*>("7--%())+'="6('&3"A>.'=("*>("$Z(%.'-"+-('*+S+(%"*$"R".'-",$'S+%6"U+*>"B'*(%"$%"aT",/+,V+'="*>(",>(,V"6.%V"]Q"\W:3:"Q"bZ(%.'-"+-('*+S+(%Q"R"Q""" "Q"B'*(%"*>("[A$'?(T$%"6$*$%"c;"S$%U.%-)"S+L(-")Z((-[",$66('*"S$%"*>("*.=3" ""

Page 70: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9:" "5@ABACB:D;E9::"#FEG%$=%.66+'="5HE;9::B0;I:J3-$,K" " "L"7--"."'(M"N9"*.="+'"/+'("93"OP7"G$%*./">.)".&*$6.*+,.//Q".))+='(-"*>(").6("-.*."*QR(".)"*>("$'("+'"/+'(";".'-">.)"+',%(6('*(-"*>(".--%())"SQ";"*$"TN:3;"UN:3;V3"A'*(%"*>(",$66('*"W@$'?(Q$%"6$*$%"X;"S.,YM.%-)"Z+K(-")R((-W3""UL"[7--\"L"N9"L"A'*(%"L"@$66('*"L"@$'?(Q$%"6$*$%"X;"S.,YM.%-)"Z+K(-")R((-V""<3J"� ]������_����_a�����_a�������L"O$"+')(%*".'"(K+)*+'=")Q6S$/"*.S/(b"%+=>*E,/+,Y"$'".'"(6R*Q"Z+(/-"$Z"*>(",%(.*(-"WO.=B*.S/(B)$%*+'=B)*.*+$'W3"5(/(,*"WP6R$%*"Z+/(W"+'"*>(")>$%*,&*"6('&3"UL"0+=>*E,/+,Y"+'".'"(6R*Q"Z+(/-"$Z"*>("*.="*.S/("L"P6R$%*"Z+/(V" ""

Page 71: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9;" "5@ABACB:D;E9::"#FEG%$=%.66+'="5HE;9::B0;I:J3-$,K" " "L"5(/(,*"*>("-()+%(-")M6N$/"*.N/("O(3=3"+'"3K/)K"P$%6.*Q".'-",$'P+%6"*>(")(/(,*+$'"R+*>"STU('S3"OL"5@ABACB:9:EVWWXYZ[X\Z]_Xab\cd[X\Z\cadefL"TU('Q"L"g>('"*>("+6U$%*"+)"P+'+)>(-h"M$&"R+//")((".",$'P+%6.*+$'"R+'-$R".'-">.?(".'"$UU$%*&'+*M"*$"?+(R"*>("/$="P+/("P$%"*>("+6U$%*3"@/+,i"L"Tj3" ""

Page 72: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 99" "5@ABACB:D;E9::"#FEG%$=%.66+'="5HE;9::B0;I:J3-$,K" " "L"M$&",.'")(("*>.*")$6(".--%())()">.?("N(('">+=>/+=>*(-"+'"$%.'=(3"O>()(".%("-&P/+,.*(".--%())()".'-"*>("'.6()"$Q"*>(".))$,+.*(-"*.=)">.?("N(('"'&6N(%(-".&*$6.*+,.//R"*$".?$+-",$'Q&)+$'3"L"2(/(*("*>("-&P/+,.*("*.=)"NR")(/(,*+'="*>("/+'()".'-"P%())+'="*>("2(/"S(R"$'"R$&%"S(RN$.%-"$%")(/(,*+'="T2(/(*(T"+'"*>(")>$%*,&*"6('&3"UL"0+=>*E,/+,S"$'")(/(,*(-"*.=)"L"2(/(*(V" ""

Page 73: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:@;E9::"#FEG%$=%.66+'="5HE;9::C0;I:J3-$,K" " "L"M$&"'$N">.?(".",$6O/(*(")P6Q$/"*.Q/("$R"*>("-+=+*./"+'O&*)".'-"$&*O&*)"+'"R%$'*"$R"P$&3"5.?("P$&%"O%$S(,*"&'-(%"*>("'.6(":@;E9::C#FCG%$=%.66+'=3"TL"G%$S(,*"L"5.?(".)"333"L:@;E9::C#FCG%$=%.66+'="L"5.?(U" ""�

Page 74: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:@3-$,K" " "<3J"�������L�������M���N� O��P�Q�QRS�T�QP�L����U�����V�!��� ����������� ����� ����W"X'"*>("HYA"Z%$=%.66+'=")(,*+$'"$["*>("Z$%*./"?+(\]",/+,"_7--"'(\"/$,_"*$",%(.*("."'(\"[&',*+$'"/$,3"aW"HYA"Z%$=%.66+'="W"7--"'(\"/$,"W" b"" ""

Page 75: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;@:J3-$,K" " "L"0('.6("M$&%"'(N"O/$,P"*$Q"RSTUT0C7VUTRW")(*"*>("/.'=&.=("*$"#G2".'-"P((X".&*$6.*+,".))+='6('*"$Y"*>("'&6O(%3"5(/(,*"*>("R7--"'(N".'-"$X('R",>(,P"O$K3"Z$&"N+//"*>&)"O("*.P('".&*$6.*+,.//M"*$"M$&%",%(.*(-"Y&',*+$'"O/$,P"+'"*>("X%$[(,*"?+(N3A/+,P"R7--R3"\L"D.6(Q"STUT0C7VUTL].'=&.=(Q"#G2"L"D&6O(%Q"7&*$6.*+,"L""7--"'(N".'-"$X('"L"7--" "�

Page 76: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9<" "5@ABACB:D;E9::"#FEG%$=%.66+'="5HE;9::B0;I:J3-$,K" " "<3<"��L�����M�������L�����L� N��O�P�PQR�S�PO�T"UV"W$&")(/(,*(-"X7--"'(Y".'-"$Z('X["*>("Z%$\(,*"?+(Y"$Z(')"Y+*>"."Y+'-$Y"V$%",%(.*+'="*>("]/$,"W$&"\&)*".--(-3"T"_$&",.'"V+'-"*>("+'*(%V.,("-(),%+Z*+$'"$V"W$&%"V&',*+$'"]/$,"+'"*>("&ZZ(%")(,*+$'"$V"W$&%"Z%$=%.66+'="?+(Y3" ""

Page 77: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5@F;9::C0;I:J3-$,K" " "L"7"M+'.%N"$&*O&*")+='./"+)"'((-(-"P$%",$'*%$//+'="*>(",$'?(N$%"6$*$%3"#$%"*>+)"%(.)$'Q"R("P+%)*",%(.*("/$,./"$&*O&*"*.="SA$'?(N$%C6$*$%C.&*$6.*+,C6$-("$P"*>("TG$$/T"*NO(3"B'*(%"*>(",$66('*"TA$'*%$/"$P"*>(",$'?(N$%"6$*$%"+'".&*$6.*+,"6$-(T"P$%"*>("O.%.6(*(%3"UL"V&*O&*L"A$'?(N$%C6$*$%C.&*$6.*+,C6$-("L"G$$/"L"A$'*%$/"$P"*>(",$'?(N$%"6$*$%"+'".&*$6.*+,"6$-(W" "L"7--"O.%.6(*(%"S7&*$6.*+,C6$-(C.,*+?(".)"*>("+'O&*"+'*(%P.,("&'-(%"X'O&*".'-",$'P+%6"*>("('*%N"R+*>"*>("B'*(%"Y(N"$%"MN"(K+*+'="*>("('*%N"P+(/-3"2.*."*NO("TG$$/T"+)".))+='(-".&*$6.*+,.//N3"Z>+)"R+//"M("%(*.+'(-3"D(K*Q"('*(%"*>(".))$,+.*(-",$66('*"T7&*$6.*+,"6$-(".,*+?.*(-T3""UL"X'O&*"L"7&*$6.*+,C6$-(C.,*+?("L"G$$/"L"7&*$6.*+,"6$-(".,*+?.*(-W""L"A$'*+'&("MN".--+'="O.%.6(*(%)"S5*.%*Q"S5*$OQ"SB'.M/(CV[".'-"S5.P(*NC)>&*$PPC.,*+?(".)".--+*+$'./"M+'.%N"+'O&*"O.%.6(*(%)".'-",>(,Y"*>(+%"-.*."*NO()3"7--"-(),%+O*+?(",$66('*)3"" "

Page 78: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:K3-$,L" " "M"N>(",$'?(O$%"+)")*.%*(-".'-")*$PP(-"Q+*>"P&)>R&**$')3"S("*>(%(T$%("'((-"."U5*.*+,U"*.=".)"."6(6$%O3"V'-(%"5*.*+,W".--"*.="XY(6$%OC.&*$6.*+,C)*.%*C)*$P".'-",$'T+%6"*>("('*%O"Q+*>"*>("B'*(%"Z(O"$%"RO"(L+*+'="*>("('*%O"T+(/-3"2.*."*OP("UG$$/U"+)".))+='(-".&*$6.*+,.//O3"N>+)"Q+//"R("%(*.+'(-3"B'*(%"*>(".))$,+.*(-",$66('*"UY(6$%O"&)(-"T$%")*.%*C)*$P".&*$6.*+,"6$-(U3"[M"5*.*+,"M"Y(6$%OC.&*$6.*+,C)*.%*C)*$P"M"G$$/"M"Y(6$%O"&)(-T$%")*.%*\)*$P".&*$6.*+,"6$-(]"" "M"#$%"P&%P$)()"$T"P%$=%.6"-$,&6('*.*+$'W".))+='"*>("R/$,Z"*+*/(W"."R/$,Z",$66('*".'-".">(/PT&/"'(*Q$%Z"*+*/("T$%"D(*Q$%Z";3"[M"G/$,Z"*+*/("Y$*$%",$'*%$/"+'".&*$6.*+,"6$-("M"D(*Q$%Z";"Y(6$%OC.&*$6.*+,C)*.%*C)*$P".'-",$'*%$/"$T"*>(",$'?(O$%"6$*$%"+'".&*$6.*+,"6$-(]" �

Page 79: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:K3-$,L" " "<3I"����� � M�N"�O�OPQ�R�O�S"G(/$T"*>("+'*(%U.,("-(),%+V*+$'W"X$&")(("."*$$/Y.%"+'"*>("V%$=%.66+'="T+'-$T"T+*>"?.%+$&)"/$=+,"U&',*+$')".'-"Y(/$T"*>.*".'".%(."T+*>"'(*T$%Z)3"[(">.?("./%(.-X")V(,+U+(-"*>("Y/$,Z"*+*/(".'-"*>("*+*/("U$%"*>("U+%)*"'(*T$%Z"*>(%(3"H%$=%.66+'="+)"V(%U$%6(-"T+*>+'"*>("'(*T$%Z)"&)+'="+'-+?+-&./"/$=+,"Y/$,Z)3"2+)*%+Y&*+$'".6$'="6&/*+V/("'(*T$%Z)">(/V)"*$"V%()(%?("*>(",/.%+*X"$U"*>("V%$=%.63"\'"*>("U$//$T+'=W"X$&"T+//"=(*"*$"Z'$T"*>("?.%+$&)"T.X)"X$&",.'"+')(%*"/$=+,"Y/$,Z)3" "S"]'"*>("%+=>*")+-("$U"X$&%"V%$=%.66+'="T+'-$T"+)"."/+)*"$U"+')*%&,*+$')"X$&",.'"&)("+'"*>("V%$=%.63"'-(%"S"G.)+,"+')*%&,*+$')"S"G+*"/$=+,"$V(%.*+$')W"U+'-"U&',*+$'" "_7))+='6('*".'-"&)("."-%.=F.'-F-%$V"$V(%.*+$'"*$"6$?("+*"*$"D(*T$%Z";"_=%(('"/+'(".VV(.%)W"6$&)("V$+'*(%"T+*>"a")X6Y$/3"_S"\')*%&,*+$')"S"G.)+,"+')*%&,*+$')"S"G+*"/$=+,"$V(%.*+$')"S" " ""

Page 80: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @:" "5ABCBDC:@;E9::"#FEG%$=%.66+'="5HE;9::C0;I:J3-$,K" " "L"D$M"&)("-%.=E.'-E-%$N"*$"6$?("O$&%"$&*N&*"N.%.6(*(%"PA$'?(O$%C6$*$%C.&*$6.*+,C6$-("$'*$"QRR3RS".T$?("*>("T/$,U"O$&"V&)*"+')(%*(-3"W>("T()*"M.O"*$")(/(,*"."N.%.6(*(%"+'"*>("+'*(%X.,("-(),%+N*+$'"+)"TO"Y=%.TT+'=Y"+*".*"*>("T/&(")O6T$/" 3"ZL" "A$'?(O$%C6$*$%C.&*$6.*+,C6$-([" ""L"W>+)"-(*(%6+'()"*>.*"*>("PA$'?(O$%C6$*$%C.&*$6.*+,C6$-("N.%.6(*(%"+)"M%+**('"TO"*>+)"T/$,U3"5*+//"6+))+'=\">$M(?(%\".%("*>("+'N&*",$'-+*+$')")$"*>.*"*>+)".,*&.//O">.NN(')3"7'"50"X/+NEX/$N".'-"PB'.T/(C] "N.%.6(*(%".%("/$=+,.//O",$6T+'(-"M+*>".'"7D2"/$=+,"$N(%.*+$'".*"*>("+'N&*"$X"*>(".))+='6('*"T/$,U3"W$"-$"*>+)\"X+%)*",/+,U"*>("+'N&*"$X"*>("T/$,U")$"*>.*"*>("+'N&*"/+'(">.)"."T/&("T.,U=%$&'-3"""

Page 81: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @;" "5ABCBDC:@;E9::"#FEG%$=%.66+'="5HE;9::C0;I:J3-$,K" " "L"A/+,M"*>(" "+,$'"+'"N$&%"/$=+,"*$$/O.%"*$"+')(%*".'"7D2"/$=+,"$P(%.*+$'"O(Q$%("N$&%".))+='6('*"O/$,M3" ""L"R)("-%.=E.'-E-%$P"*$"6$?("+'P&*"P.%.6(*(%"SB'.O/(CTU"$'*$"*>(")(,$'-"+'P&*"$Q"*>("1"/$=+,"$P(%.*+$'"VWW3WX3"YL" "B'.O/(CTUZ" ""

Page 82: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @9" "5ABCBDC:@;E9::"#FEG%$=%.66+'="5HE;9::C0;I:J3-$,K" " "L"M)("-%.=E.'-E-%$N"*$"6$?("*>("5(*O%()(*"P/+NEP/$N"P&',*+$'" "P%$6"*>("/+)*"$P"+')*%&,*+$')"&'-(%"L"F.)+,"+')*%&,*+$')"L"F+*"/$=+,"$N(%.*+$')"$'*$"*>("P+%)*"+'N&*"$P"*>("1"$N(%.*+$'" 3"QL"R')*%&,*+$')"L"F.)+,"+')*%&,*+$')"L"F+*"/$=+,"$N(%.*+$')"L" "L" "S" "L"T>("50"P/+NEP/$N"%(U&+%()"."6(6$%V"*.=3"#$%"*>+)W"&)("-%.=E.'-E-%$N"*$"6$?(")*.*+,"N.%.6(*(%"XY(6$%VC.&*$6.*+,C)*.%*C)*$N"$'*$"*>("Z[[3[\".]$?("*>("50"P/+NEP/$N3""QL" "Y(6$%VC.&*$6.*+,C)*.%*C)*$NS" "

Page 83: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @@" "5ABCBDC:@;E9::"#FEG%$=%.66+'="5HE;9::C0;I:J3-$,K" " "L"M>("NO(6$%PC.&*$6.*+,C)*.%*C)*$Q"R+//"S(")(*"R+*>"+'Q&*"*.="N5*.%*3"A/+,T"*R+,("$'"*>("5"+'Q&*"$U"*>("50"U/+QEU/$Q"VWW3WX".'-"('*(%"Y5*.%*Y"+'"*>("U+(/-"*>.*".QQ(.%)"+'"$%-(%"*$")(("."/+)*"$U".?.+/.S/("*.=)")*.%*+'="R+*>"Y5*.%*Y3A/+,T"*>("N5*.%*"*.=".'-".QQ/P"R+*>"L"B'*(%3"ZL"50"U/+QEU/$Q"L"VWW3WX"L"5*.%*"L"N5*.%*"L"B'*(%[" "\]_abcdefghhijeiejfkgjhfiefkcihflgmnfkcdodfihfgfoihpfqrfgfsituvwflikcfkcdfjxqygxfkgjhfroqsfkcdfkgjfkgyxdzf{cdfwod|iqvhxmfwodhdekd}fwoq~d}vodfvhiejf}ogjfge}f}oqwfroqsfkcdfiekdorg~df}dh~oiwkiqefhcqvx}fkcdodrqodfydfvhd}fwodrdodekigxxmza"L"O&/*+Q/(",$'-+*+$')".%("*$"S(".S/("*$")*$Q"*>(",$'?(P$%3"7'"�0"S/$,T"+)"*>(%(U$%("'((-(-".*"*>("0;"+'Q&*"$U"*>("50"U/+QEU/$Q3"#+%)*�",/+,T"*>("0;"+'Q&*"$U"*>("50"U/+QEU/$Q")$"*>.*"*>("+'Q&*"/+'(">.)"."S/&("S.,T=%$&'-3" "

Page 84: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:@;F9::"#GFH%$=%.66+'="5IF;9::D0;J:A3-$,K" " "L"B/+,M"*>(" "+,$'"+'"N$&%"/$=+,"*$$/O.%"*$"+')(%*".'"P0"/$=+,"$Q(%.*+$'3" "L"R>("P0"O/$,M">.)"9"+'Q&*)"+'+*+.//N3"S'"$%-(%"*$"/$=+,.//N",$6O+'(".'".--+*+$'./"+'Q&*"*.=T",/+,M"*>("N(//$U")*.%" "$V"N$&%"P0"O/$,M3""L"7--"+'Q&*"*.=)"W5*$QT"W5.V(*ND)>&*$VVD.,*+?(".'-"W7&*$6.*+,D6$-(D.,*+?("*$"*>("@"+'Q&*)"$V"*>("P0"O/$,M3" "

Page 85: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:@;F9::"#GFH%$=%.66+'="5IF;9::D0;A:J3-$,K" " "L"E(=.*("*>("+'M&*",$''(,*(-"*$"M.%.6(*(%"N7&*$6.*+,D6$-(D.,*+?("OP")(/(,*+'="+*".'-",/+,Q+'=" 3"" "" L"2$"'$*"R$%=(*"*$",/+,Q" "%(=&/.%/P3"S>("R+'+)>(-"R&',*+$'"O/$,Q"TUVSV0D7WSVT"X#G;Y"+'"#G2"+)")>$Z'"O(/$Z3" ""

Page 86: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @<" "5ABCBDC:@;E9::"#FEG%$=%.66+'="5HE;9::C0;I:J3-$,K" " "L"M'-(%"N8('(%./N"+'"*>("O%$O(%*+()"$P"*>("Q/$,RS"T$&",.'",>.'=("*>("NU.'=&.=(N"*$"U72"VU.--(%"U$=+,W"VLG%$O(%*+()"L"8('(%./"L"U.'=&.=(X"U72W" "L"Y>("O%$=%.6">.)"*>("P$//$Z+'=".OO(.%.',("+'"U723" ""�

Page 87: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:@;F9::"#GFH%$=%.66+'="5AF;9::D0;I:J3-$,K" " "<3L"����� ��M�������N������O���P�QR��S������������T�!�������P���U��V���W������� ����� �����X"G(Y$%("Z%$=%.66+'="$%=.'+[.*+$'"\/$,]"_.+'"aG;bc"d(")d+*,>"*>("Z%$=%.66+'="/.'=&.=("*$"#G2"e#&',*+$'"G/$,]"2+.=%.6f3"g$"-$")$c"Y+%)*",/+,]"$'"_.+'"aG;b"+'"*>("H%$=%.6"\/$,])"Y$/-(%3""eX"BHhD;9;JB"BHh";9;JB"2Bi2Bi2Bb"X"H%$=%.6"\/$,])"X"_.+'"aG;b"X"5d+*,>"Z%$=%.66+'="/.'=&.=("X"#G2f" "X"aZ('"*>("_.+'"aG;b"$%=.'+[.*+$'"\/$,]"d+*>"."-$&\/(F,/+,]3" "

Page 88: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:@;F9::"#GFH%$=%.66+'="5IF;9::D0;J:K3-$,L" " "M"7))+='"E(*N$%O";"*>("'.6("PB$'*%$/",$'?(Q$%"*%.,O+'="R$%N.%-)"+'".&*$6.*+,"6$-(P"SM"E(*N$%O";T333"MB$'*%$/",$'?(Q$%"*%.,O+'="R$%N.%-)"+'".&*$6.*+,"6$-(U" "M"V)("-%.=F.'-F-%$W"*$"6$?("Q$&%"PXYZY0D7VZY"[#G;\P"R&',*+$'"]/$,O"$'*$"*>("=%(('"/+'("+'"E(*N$%O";3" ""

Page 89: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:@;F9::"#GFH%$=%.66+'="5IF;9::D0;J:K3-$,L" " "M"N>("+')*.',("-.*."O/$,P"Q$%"*>+)",.//"$Q"#G;"+)",%(.*(-".&*$6.*+,.//R3"7))+='"."'.6(".'-".SS/R"+*"T+*>"UV3"WM"XUNU0D7YNUD2G;"M"UVZ" "M"7"O/$,P"T+*>"*>("+'*(%Q.,("R$&"-(Q+'(-["*>("+')*.',("-.*."O/$,P".'-",$''(,*+$')"CE".'-"CEU".%("+')(%*(-"+'"E(*T$%P";3" "M"N$"+')(%*".'"7E2"O(Q$%("+'S&*"S.%.6(*(%"\C'.O/(DUV\[")(/(,*"*>+)"+'S&*".'-"+')(%*"*>("7E2"OR",/+,P+'="*>(" "+,$'"+'"R$&%"/$=+,"*$$/O.%"WM Z3""

Page 90: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @:" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:@3-$,K" " "L"M$",$''(,*"*>("N/$,O"*$"*>("=/$N./"*.=)"P%$6"QM.=C*.N/(C)$%*+'=C)*.*+$'QR"S(">.?("*S$"$T*+$')U"L"B+*>(%")(/(,*"*>("QM.=C*.N/(C)$%*+'=C)*.*+$'Q"+'"*>("T%$V(,*"*%((".'-"&)("-%.=F.'-F-%$T"*$"6$?("*>("-()+%(-"=/$N./"*.="P%$6"*>("2(*.+/)"?+(S"*$"*>("+'*(%P.,("$P"#A;""W"L"M.=C*.N/(C)$%*+'=C)*.*+$'"L"2(*.+/)"?+(S"L"F5:"L"7&*$6.*+,C6$-(C.,*+?(X" "L"Y%R"('*(%"*>(")*.%*+'="/(**(%)"W(3=3"QF5QX"$P"*>("-()+%(-"=/$N./"*.="P$%"Z[[3[\".'-")(/(,*"*>("=/$N./"+'T&*"*.="QF5:Q"W]:39X"P%$6"*>("-+)T/._(-"/+)*"WL"7&*$6.*+,C6$-(C.,*+?("L"F5"L"F5:X3" "

Page 91: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @;" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:@3-$,K" " "L"M')(%*"*>("$*>(%"+'N&*"*.=)"OF5;OP"OF59OP"OFQ:OP"OFG;O".'-"OF7;O".'-"*>('"+')(%*"$&*N&*"*.=""OFR;O"STR:3:U".*"$&*N&*"OA$'?(V$%C6$*$%C.&*$6.*+,C6$-(O3" "L"D(=.*("*>("W&(%V+'="$X"+'N&*"*.=)"OF59O".'-"OF7;O"YV")(/(,*+'="*>(6".'-",/+,Z+'=" "SL"F59"L" "L"F7;"L" U3" �

Page 92: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @9" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:@3-$,K" " "<3L"M�N�������O��P���QP������P���R�S���� ��������"�" T>("%()&/*"+'"*>("U72"VU.--(%"U$=+,W"X%$=%.66+'="/.'=&.=(">.)"*>("Y$//$Z+'=".XX(.%.',(3"" "�

Page 93: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:A;F9::"#GFH%$=%.66+'="5IF;9::D0;J:@3-$,K" " "<3;:"���L�������� M�����N��M���� �O"P$").?("Q$&%"R%$S(,*T")(/(,*"*>(" "U&**$'"+'"*>("6('&3"P$",$6R+/(".//"U/$,V)T",/+,V"*>("WH%$=%.6"U/$,V)W"X$/-(%".'-")(/(,*"*>(" "+,$'"X$%",$6R+/+'="+'"*>("6('&""YO" "O"H%$=%.6"U/$,V)"O" Z3" "O"P>("W['X$WT"WB$6R+/(W".%(.")>$\)"\>+,>"U/$,V)"\(%(")&,,())X&//Q",$6R+/(-3" "�

Page 94: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @@" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:@3-$,K" " "<3;;"���L�������M��N���� �O"7P*(%")&,,())P&/",$6Q+/.*+$'R"*>(",$6Q/(*(",$'*%$//(%"S+*>"*>(",%(.*(-"Q%$=%.6R".)"Q%(?+$&)/T"-(),%+U(-"+'"*>("6$-&/()"P$%">.%-S.%(",$'P+=&%.*+$'R",.'"U("-$S'/$.-(-""VO" W3" "�

Page 95: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:F;G9::"#HGI%$=%.66+'="5JG;9::D0;A:@3-$,K" " "<3;9"���������L���� �M���NO�P"Q>("-()+%(-"R/$,S"6&)*"R("$T('"U$%"6$'+*$%+'="*>("-$V'/$.-(-"T%$=%.63"Q>("6$'+*$%+'=",.'"'$V"R(".,*+?.*(-W-(.,*+?.*(-"RX",/+,S+'="*>("" "+,$'"YP"Z.+'"[\H;]"P" 3"""_ abcdefghijklmjnlkohfgnghlphplokqrsngrqmgthqkthujkmnjrrgnstgvgktgkmwhefghplokqrhpmqmgphqmhmfghmgnilkqrphqnghlktluqmgthxlmfheyz{hjnh|}~�{wd"

Page 96: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @<" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;J:@3-$,K" " "L"M>("NOPMP0C7QMPN"R#G;S"T&',*+$'"U/$,V",.//(-"+'"*>("NO.+'"RPG;SN"$%=.'+W.*+$'"U/$,V",.'"U(")(/(,*(-"-+%(,*/X"T$%"NPY('".'-"6$'+*$%N".T*(%"%+=>*F,/+,V+'="ZL"NOPMP0C7QMPN"R#G;S"L"PY('".'-"6$'+*$%[3" ""\]_abcdefghijgkihlecdkdeimenohpjighqkdrsjdteshtepghjkgrrdkqihtdudhtdhjvebcdespjosjighegnemdhmgkmeshtejcdemjsjighemjsjomeskdemcgwhecdkdewijcebxyzegke{|}~zva"

Page 97: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:F;G9::"#HGI%$=%.66+'="5AG;9::D0;J:@3-$,K" " "L"MN"."O.%*+,&/.%"O$+'*"$N"&)("$N"."PQRSR0D7TSRP"U#H;V"N&',*+$'"W/$,X"*>.*"+)",.//(-"6&/*+O/("*+6()"+)"*$"W("6$'+*$%(-Y"*>+)",.'"W("O(%N$%6(-"&)+'="*>(" "+,$'3"S>(%(".%("*Z$"./*(%'.*+?()".?.+/.W/("N$%")O(,+N[+'="*>(",.//"('?+%$'6('*\"&)+'="*>(",.//"('?+%$'6('*"$%"*>("+')*.',("-.*."W/$,X"]L" "L"M')*.',("-.*."W/$,X"L"QRSR0D7TSRD2H;"U2H;V"L"B.//"('?+%$'6('*"L"7--%())\"RH;"L"2(*.+/)\"Q.+'"E ;"L"R_3" """�

Page 98: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:F;G9::"#HGI%$=%.66+'="5JG;9::D0;K:@3-$,L" " "<3;F"���M�N���M��O��P����Q"7)"*>("R+'./")*(ST"U("U.'*"*$".%,>+?("*>(",$6S/(*("S%$V(,*3"5(/(,*"*>("Q"W7%,>+?("333W",$66.'-"+'"*>("Q"WI%$V(,*W"6('&3"5(/(,*"."R$/-(%"U>(%("X$&"U.'*"*$".%,>+?("X$&%"S%$V(,*".'-").?("+*"U+*>"*>("R+/("*XS("WYZ7"I$%*./"S%$V(,*".%,>+?(W3"[Q"I%$V(,*"Q"7%,>+?("Q"YZ7"I$%*./"S%$V(,*".%,>+?("Q":F;G\]]_ abcdecfgghiejkaQ"5.?(l" "m

Page 99: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:F;G9::"#HGI%$=%.66+'="5JG;9::D0;K:@3-$,L" " "<3;@"��M��N��O��P�Q� ��O���R����� �� R������;" B$6S+/+'=")&,,())T&/".'-"U+*>$&*"(%%$%"6()).=(" "9" 2$U'/$.-")&,,())T&/".'-"U+*>$&*"(%%$%"6()).=(" "F" 5U+*,>"$'")*.*+$'"VGW:"X";Y"BZ/+'-(%"%(*%.,*(-"["#((-\.,]".,*+?.*(-"VGH;"X";Y"C C08CEB_"##"VG7;"X";Y"'$*".,*+?.*(-"7ab 7bcB"6$-("VG5:"X";Y"I&)>\&**$'".&*$6.*+,")*$S"'$*".,*&.*(-"VG59"X";Y"H%+(T/Z"S%())"*>(".&*$6.*+,")*.%*"S&)>\&**$'"VG5;"X";Y"B$'?(Z$%"6$*$%"T$%U.%-)"T+L(-")S((-"*>('")U+*,>()"$'"VGd;"X";Y")U+*,>()"$'".'-")*.Z)"$'3" "@" H%+(T/Z"S%())"*>(".&*$6.*+,")*$S"S&)>\&**$'"VG59"X":Y"e"Gd;"X":" "K" 7,*+?.*("C C08CEB_"##"VG7;"X":Y"e"Gd;"X":" "<" .'&./"6$-("VG5:"X":Y"e"Gd;"X":" "J" 5U+*,>"$TT")*.*+$'"VGW:"X":Y"e"Gd;"X":" "f" BZ/+'-(%"'$*"%(*%.,*(-"VGH;"X":Y"e"Gd;"X":" "A" I%$g(,*")&,,())T&//Z".%,>+?(-" """

Page 100: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @:" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;@:J3-$,K" " "L��M����N��I3;"��NO�P��M����N�"�Q'"*>+)"(K(%,+)(R".'"('(%=S").?+'="T&',*+$'"+)"*$"U(".--(-"*$"*>("VWXW0C7YXW"Z#G;["T&',*+$'"U/$,\3"X>("(K].'-(-"T&',*+$'"U/$,\"+//"U("]/.''(-R"]%$=%.66(-".'-"*()*(-_"X$").?("('(%=SR"*>(",$'?(S$%")>$&/-"$'/S"%&'">('"."].%*"+)"]%()('*3"X>("A$'?(S$%C6$*$%C.&*$6.*+,C6$-("$&*]&*"+)"*>(%(T$%("$'/S".,*+?.*(-">('"V(6$%SC.&*$6.*+,C)*.%*C)*$]"+)")(*R"*>("('.U/(",$'-+*+$')".%("6(*".'-"V(6$%SC,$'?(S$%C)*.%*C)*$]"+)")(*3"X>("V(6$%SC,$'?(S$%C)*.%*C)*$]"+)")(*">('"5(')$%C,>&*(C$,,&]+(-")+='./)"."].%*".'-"+)"%()(*">('"5(')$%C('-C$TC,$'?(S$%"]%$-&,()"."'(=.*+?("(-=("$%").T(*S")>&*$TT"+)".,*+?("$%".&*$6.*+,"6$-("+)"'$*".,*+?.*(-"6.'&./"6$-(a3""I39"���b����!������ �c(%(R"S$&")(("*>("*(,>'$/$=S"-+.=%.6"T$%"*>("*.)\3"" "#+=&%(";:_"X(,>'$/$=S"-+.=%.6" "#+=&%(";;_"A$'*%$/"].'(/""

Page 101: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @;" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;@:J3-$,K" " "I3E"L�M���������N��O>("P$//$Q+'=")+='./)".%("'((-(-".)"=/$R./"$S(%.'-)"P$%"*>+)"*.)T3"��� �!U�� ������M���� ������� V��VW�X":3:" GYYZ" F7;" 0(*&%'")+='./"(6(%=(',[")*$S"$T" DA"X":3;" GYYZ" F\:" ].+'")Q+*,>"YD" DY"X":39" GYYZ" F5:" ]$-(")(/(,*$%"6.'&./"_:a".&*$6.*+,"_;" ].'&./"b":"7&*$"b";"X":3E" GYYZ" F5;" H&)>R&**$'".&*$6.*+,")*.%*" DY"X":3J" GYYZ" F59" H&)>R&**$'".&*$6.*+,")*$S" DA"X":3@" GYYZ" FG;" 5(')$%",[/+'-(%"]J"%(*%.,*(-" DY"X";3:" GYYZ" FGJ" 5(')$%".*",>&*("$,,&S+(-" DY"X";3E" GYYZ" FGI" 5(')$%"S.%*".*"('-"$P",$'?([$%" DY""�W� �!U�� ������M���� ������� �c":3:" GYYZ" Fc;" A$'?([$%"6$*$%"];"P$%Q.%-)"P+K(-")S((-" "defgfhidjkldlfjflfhmfdnopqd"""""""""I3J"��������H/.'"*>("+6S/(6('*.*+$'"$P"*>("*.)T"$'"[$&%"$Q'3"rkqfsdtuvwxyvz{|}y}~uy|�uy{�y}~uyxu�v}��uyu��uy�xy�������y�������y�xy}~uy{x��xuy~u���y2Y" 2+=+*./"Y&*S&*"7Y" 7'./$="Y&*S&*"c" Y&*S&*"2X" 2+=+*./"X'S&*"7X" 7'./$="X'S&*"X" X'S&*"DA" D$%6.//["A/$)(-""DY" D$%6.//["YS('""

Page 102: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @9" "5ABCBDC:E;F9::"#GFH%$=%.66+'="5IF;9::C0;@:J3-$,K" " "I3@"�L��M��N��O��P����N��" Q�R� ��N���S����� �� S������;" A$6T+/+'=")&,,())U&/".'-"V+*>$&*"(%%$%"6()).=(" "9" 2$V'/$.-")&,,())U&/".'-"V+*>$&*"(%%$%"6()).=(" "E" 5V+*,>"$'")*.*+$'"WFX:"Y";Z"A[/+'-(%"%(*%.,*(-"\"#((-].,".,*+?.*(-"WFG;"Y";Z"B_B08BDA "a##"WF7;"Y";Z"'$*".,*+?.*(-"7bca_7cdA"6$-("WF5:"Y";Z"H&)>]&**$'".&*$6.*+,")*$T"'$*".,*&.*(-"WF59"Y";Z"G%+(U/["T%())"*>(".&*$6.*+,")*.%*"T&)>]&**$'"WF5;"Y";Z"5(')$%".*",>&*(".,*+?.*(-"WFGJ"Y";Z"A$'?([$%"6$*$%"U$%V.%-)"U+K(-")T((-"*>('")V+*,>()"$'"WFe;"Y";Z")V+*,>()"$'".'-")*.[)"$'3" "J" 5(')$%".*"('-"$U",$'?([$%".,*+?.*(-"WFGI"Y";Z"f"Fe;"Y":" "@" G%+(U/["T%())"*>(".&*$6.*+,")*$T"T&)>]&**$'"WF59"Y":Z"f"Fe;"Y":" "<" 7,*+?.*("B_B08BDA "a##"WF7;"Y":Z"f"Fe;"Y":" "I" _.'&./"6$-("WF5:"Y":Z"f"Fe;"Y":" "g" 5V+*,>"$UU")*.*+$'"WFX:"Y":Z"f"Fe;"Y":" "h" A[/+'-(%"'$*"%(*%.,*(-"WFG;"Y":Z"f"Fe;"Y":" ";:" H%$i(,*")&,,())U&//[".%,>+?(-" ""

Page 103: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @A" "5BCDCED:A;F9::"#GFH%$=%.66+'="5IF;9::D0;@:J3-$,K" " "L��������������M�� ������N$&",.'"O+'-".--+*+$'./"+'O$%6.*+$'".)".'"$%+('*.*+$'".+-"O$%"+'+*+./".'-".-?.',(-"*%.+'+'=P"O$%"(K.6Q/(R"8(**+'="5*.%*(-P"?+-($)P"*&*$%+./)P".QQ)P"6.'&./)P"Q%$=%.66+'="=&+-(/+'()".'-"*%+./")$O*S.%(TO+%6S.%(P".*"*>("O$//$S+'="/+'UR"""SSS3)+(6(')3,$6T),(T)IF;9::""

Page 104: SCE-Basic Programming S7-1200 (2016)

����������������������������� ��������������������������������������� ����������������� ��������� �������������� !��"���� �#��� ���$�%$���!&'� ���������!&'�'��������#� �%��������(����!#� !'��)%�����*+,-./012123-+4//154647-�����������������'��8�������9���&�������:;��<�����

Page 105: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9" "5@ABACB:D;ED::"FA@EG+6()".'-"@$&'*(%)"5HE;9::B0;I:J3-$,K" " "����L������������������M��N�O����L�N���������������� N�P"���������Q������������R�S�T�UN����O��V�W����������W"X%-(%"'$3Y"<A5H9;JE;ZAD:EJ7ZD"P"���������Q���������������UN����O��V�W����������W"X%-(%"'$3Y"<A5H9;JE;7AD:EJ7ZD"P"[\������������������Q�]������������UO����Q�����V�UN����O��V�W����������W"X%-(%"'$3Y"<A5H_99E:77:DEJAI���C$*("*>.*"*>()("*%.+'(%"a.,b.=()".%("%(a/.,(-"c+*>")&,,())$%"a.,b.=()"c>('"'(,()).%d3"7'"$?(%?+(c"$e"*>(",&%%('*/d".?.+/.f/("5@A"a.,b.=()"+)".?.+/.f/(".*Y")+(6(')3,$6g),(g*a"""�����������������#$%"%(=+$'./"5+(6(')"5@A",$'*+'&(-"*%.+'+'=h"=(*"+'"*$&,>"c+*>"d$&%"%(=+$'./"5@A",$'*.,*")+(6(')3,$6g),(g,$'*.,*"���������������O�� �������������������)+(6(')3,$6g),(�����O�� ��������������N��G>("5@A"*%.+'+'=",&%%+,&/&6"e$%"*>("+'*(=%.*(-".&*$6.*+$'")$/&*+$'"G$*.//d"F'*(=%.*(-"7&*$6.*+$'"iGF7j"c.)"a%(a.%(-"e$%"*>("a%$=%.6"k5+(6(')"7&*$6.*+$'"@$$a(%.*()"c+*>"A-&,.*+$'"i5@Ajk")a(,+e+,.//d"e$%"*%.+'+'="a&%a$)()"e$%"a&f/+,"(-&,.*+$'./"e.,+/+*+()".'-"012"+')*+*&*+$')3"5+(6(')"78"-$()"'$*"=&.%.'*(("*>(",$'*('*)3""G>+)"-$,&6('*"+)"*$"f("&)(-"$'/d"e$%"+'+*+./"*%.+'+'="$'"5+(6(')"a%$-&,*)g)d)*(6)h"G>+)"6(.')"+*",.'"f(",$a+(-"+'"c>$/("$%"a.%*".'-"=+?('"*$"*>$)("f(+'="*%.+'(-"e$%"&)("c+*>+'"*>("),$a("$e"*>(+%"*%.+'+'=3"@+%,&/.*+$'"$%",$ad+'="*>+)"*%.+'+'=",&%%+,&/&6".'-")>.%+'="+*)",$'*('*"+)"a(%6+**(-"c+*>+'"a&f/+,"*%.+'+'=".'-".-?.',(-"*%.+'+'="e.,+/+*+()"e$%"*%.+'+'="a&%a$)()3"""AK,(a*+$')"%(l&+%("c%+**('",$')('*"e%$6"*>("5+(6(')"78",$'*.,*"a(%)$'Y"0$/.'-"5,>(&(%(%"%$/.'-3),>(&(%(%m)+(6(')3,$63""Xee('-(%)"c+//"f(">(/-"/+.f/(3"7//"%+=>*)"+',/&-+'="*%.')/.*+$'".%("%()(%?(-h"a.%*+,&/.%/d"+e"."a.*('*"+)"=%.'*(-"$%"."&*+/+*d"6$-(/"$%"-()+='"+)"%(=+)*(%(-3""n)("e$%"+'-&)*%+./",&)*$6(%",$&%)()"+)"(Ka/+,+*/d"'$*"a(%6+**(-3"o("-$"'$*",$')('*"*$",$66(%,+./"&)("$e"*>("*%.+'+'=",&%%+,&/&6)3""o("c+)>"*$"*>.'b"*>("Gn"2%()-('h"a.%*+,&/.%/d"p%$e3"2%3EF'=3"q($'"n%f.)".'-"2+a/3EF'=3"7''(**"pe(ee(%h"*>("r+,>.(/"2s+.//.)"A'=+'((%+'="@$%a$%.*+$'".'-".//"$*>(%"+'?$/?(-"a(%)$')"e$%"*>(+%")&aa$%*"-&%+'="*>(""a%(a.%.*+$'"$e"*>+)"*%.+'+'=",&%%+,&/&63"""�

Page 106: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:@;E@::"FBAEG+6()".'-"A$&'*(%)"5HE;9::C0;I:J3-$,K" " "G.L/("$M",$'*('*)";N 8$./"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JN9N O%(%(P&+)+*("3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JN@N G>($%Q"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JN@3;N F')*.',()".'-"6&/*+E+')*.',()"+'"5FR7GFA"5HE;9::"33333333333333333333333333333333333333333333333333333333333333333333"JN@3;3;N F')*.',("-.*."L/$,S)"T"5+'=/("+')*.',()"33333333333333333333333333333333333333333333333333333333333333333333333333333333"IN@3;39N R&/*+E+')*.',()"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"<NJN G.)S"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"UNIN O/.''+'="333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"UNI3;N 7&*$6.*+,"6$-("E"A$'?(Q$%"6$*$%"V+*>"*+6("M&',*+$'"333333333333333333333333333333333333333333333333333333333333333333"UNI39N G(,>'$/$=Q"-+.=%.6"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"WNI3@N 0(M(%(',("/+)*"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";:N<N 5*%&,*&%(-")*(XELQE)*(X"+')*%&,*+$')"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";;N<3;N 0(*%+(?(".'"(K+)*+'="X%$Y(,*"33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";;N<39N 7--+*+$'"$M".'"FBA"*+6(%"GO"*$"M&',*+$'"L/$,S"#Z;"[R\G\0C7]G\["3333333333333333333333333333333333333333";@N<3@N ]X-.*("*>("L/$,S",.//"+'"*>("$%=.'+.*+$'"L/$,S"33333333333333333333333333333333333333333333333333333333333333333333333333"9:N<3JN 5.?(".'-",$6X+/("*>("X%$=%.6"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9;N<3IN 2$V'/$.-"*>("X%$=%.6"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"99N<3<N R$'+*$%"X%$=%.6"L/$,S)"33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9@N<3HN 7%,>+?("*>("X%$Y(,*"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9IN<3UN A>(,S/+)*"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9<NHN BK(%,+)("3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9HNH3;N G.)S"_"BK(%,+)("33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9HNH39N G(,>'$/$=Q"-+.=%.6"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9HNH3@N 0(M(%(',("/+)*"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9UNH3JN O/.''+'="33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9UNH3IN A>(,S/+)*"_"BK(%,+)("3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9WNUN 7--+*+$'./"+'M$%6.*+$'"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"@:N" " "

Page 107: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;J:@3-$,K" " "��������L���M�������NOM��L���OP����M���M���� NL����������Q�������� R����G'"*>+)",>.S*(%T"U$&"V+//"W(,$6(".,X&.+'*(-"V+*>"*>("&)("$Y")+'=/("+')*.',()".'-"6&/*+F+')*.',()"Y$%"S%$=%.66+'="$Y"5GZ7HGA"5IF;9::"V+*>"*>("HG7"[$%*./"S%$=%.66+'="*$$/3""H>("6$-&/("(KS/.+')"*>("?.%+$&)"*US()"$Y"+')*.',("-.*."W/$,\)".'-")>$V)")*(SFWUF)*(S">$V"*$".--"GBA"*+6(%)".'-"GBA",$&'*(%)"*$"."S%$=%.6"W/$,\3"�� �����]�����H>+)",>.S*(%"W&+/-)"$'"*>("#_"S%$=%.66+'="Y$%"5GZ7HGA"5I"A[ ;9;@A3"#$%"*>+)",>.S*(%T"U$&",.'"&)("*>("Y$//$V+'="S%$a(,*T"Y$%"(K.6S/(b"":E;F9::C#_F[%$=%.66+'=C5IFcdeefghijck"�� �l���!��m�������������� ������������������������Q������H>(",.//"$Y"."Y&',*+$'"W/$,\"+)"%(Y(%%(-"*$".)".'"�������3"7'"�������"+)".))+='(-"*$"(?(%U",.//"$Y"."Y&',*+$'"W/$,\".'-")(%?()".)"."-.*."6(6$%U3"G*")*$%()"*>(".,*&./"S.%.6(*(%)".'-"*>(")*.*+,"-.*."$Y"*>("Y&',*+$'"W/$,\3""H>("*.=)"-(,/.%(-"+'"*>("Y&',*+$'"W/$,\"-(*(%6+'("*>(")*%&,*&%("$Y"*>("+')*.',("-.*."W/$,\3""�O ���n������������������ �������������o$&",.'".))+='"+')*.',()".)"Y$//$V)b""A.//".)"."������������b"F"7")(S.%.*("+')*.',("-.*."W/$,\"Y$%"(.,>"+')*.',("$Y"."Y&',*+$'"W/$,\""A.//".)"." �����������b"F"p'("+')*.',("-.*."W/$,\"Y$%")(?(%./"+')*.',()"$Y"$'("$%"6$%("Y&',*+$'"W/$,\)""

Page 108: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;@:J3-$,K" " "E3;3;"LMNOPMQRSTPOPSUVWQXNSYSZ[M\VRS[MNOPMQRNSH>(",.//"$]"."]&',*+$'"/$,_"*>.*"+)".))+='(-"+*)"$ '"+')*.',("-.*."/$,_"+)",.//(-"."a�������a�����3"G]"*>("]&',*+$'"/$,_".)",%(.*(-".,,$%-+'="*$"*>("%&/()"]$%"/+%.%bF,$6c.*+/(")*.'-.%-"/$,_)d"+*",.'"./)$"(",.//(-"6&/*+c/("*+6()3"e$ (?(%d"b$&"6&)*".))+='".'$*>(%"+')*.',("-.*."/$,_"]$%"(.,>",.//".)".")+'=/("+')*.',(3""�f� g����h�a�������a�����ai�H>("]$//$ +'="]+=&%(")>$ )"*>(",$'*%$/"$]"*$"6$*$%)"&)+'="$'("]&',*+$'"/$,_"#j;:".'-"*$"-+]](%('*"-.*."/$,_)k"H>("-+]](%('*"-.*."]$%"*>("+'-+?+-&./"6$*$%)d")&,>".)")c((-d".,,(/(%.*+$'"*+6(".'-"*$*./"$c(%.*+'="*+6(d".%(").?(-"+'"*>("+')*.',("-.*."/$,_)"2j;:".'-"2j;;3""""""""""""lWORmSnopqrsopptuvwxrwyszrtwr{|pq}wrtuvrsoyu{q}wxr~qzt�qr�|�qr�yus{|our~�os�w�r�zqur{zqwqrt}qrst��qvxr{zq�rt�wor}q�y|}qrturtww|�uqvrpqpo}�rt}qtxrq���xr|ur{zqr�o}pro�rtur|uw{tusqrvt{tr~�os��r"" �j;""A.//"$]"#A;"" 2j;;""G')*.',("2j"]$%")(,$'-",.//"+*>"-.*."]$%"�$*$%"9"2j;:""G')*.',("2j"]$%"]+%)*",.//"+*>"-.*."]$%"�$*$%";"#A;""A.//"$]"#j;:"+*>"+')*.',("2j;:"]$%",$'*%$/"$]"�$*$%";""""A.//"$]"#j;:"+*>"+')*.',("2j;;"]$%",$'*%$/"$]"�$*$%"9"" #j;:""5*.'-.%-"/$,_"+*>"6$*$%"c%$=%.6"#j;:""5*.'-.%-"/$,_"+*>"6$*$%"c%$=%.6"

Page 109: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" <" "5@ABACB:D;ED::"FA@EG+6()".'-"@$&'*(%)"5HE;9::B0;I:J3-$,K" " "D3;39"LMNOPQPRSOTRUVSWX$&"6.Y"Z.'*"*$"/+6+*"*>("'&6[(%"$\"-.*."[/$,])"&)(-"\$%"+')*.',()"$%"*>+)"6.Y"[("'(,()).%Y"-&("*$"/.,]"$\"6(6$%Y"+'"*>("&*+/+(-"@_ 3""F\"$*>(%"\&',*+$'"[/$,])a"*+6(%)a",$&'*(%)a"(*,3"*>.*"./%(.-Y"(K+)*".%("*$"[(",.//(-"+'"."\&',*+$'"[/$,]"+'"Y$&%"&)(%"b%$=%.6a"Y$&",.'",.//"*>()("$*>(%"\&',*+$'"[/$,])"Z+*>$&*")(b.%.*("c+3(3".--+*+$'./d"+')*.',("2e)3""fghijklmnjnoplq�������r�����sltuvlpwn",.//"$b*+$')x""" "WyzOVS{W|}~�����������������~������~~����}��������~��������������������������������������������~�������������~~�����}��������~�������������������������~~�����~�����}����~�����������}��������~�����������~~������}��������������������������������������������������������~����������}��������������}�����������}����������������~��~�������������~~������������~��������}����������������~~�����~���������������������~��~��������}������������������~������"" "

Page 110: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5@F;9::C0;I:J3-$,K" " "�L� M����N� ������O�����OP�H>("Q$//$R+'="Q+=&%(")>$R)"*R$",.//)"$Q".'"GBA"*+6(%"$Q"*ST("HU"VT&/)(W"R+*>+'"."Q&',*+$'"X/$,Y3""H>("-+QQ(%('*"-.*."Q$%"*>("*R$",$&'*(%)"+)")*$%(-".)"-+QQ(%('*" ������O�����O"+'"*>("+')*.',("-.*."X/$,Y"2Z;"$Q"*>(",.//+'="Q&',*+$'"X/$,Y"#Z;3""""""" """""" 2Z;"VG')*.',("2Z""Q$%"#Z;W""""5*.*+,"*.="V5*.*+,W"""[H+6(%;"GBACH+6(%"[H+6(%9"GBACH+6(%".)"6&/*+F+')*.',(""\Z;""A.//"$Q"#Z;"R+*>"+')*.',("2Z;" " #Z;""A.//"$Q"GBACH+6(%".)"6&/*+F+')*.',("[H+6(%;""""A.//"$Q"GBACH+6(%".)"6&/*+F+')*.',("[H+6(%9"" [H+6(%9"$Q"*ST("GBACH+6(%"[H+6(%;"$Q"*ST("GBACH+6(%"

Page 111: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;J:K3-$,L" " "K" ��MN�G'"*>+)",>.O*(%P".'"GBA"*+6(%"Q+//"R(".--(-"*$"*>("S&',*+$'"R/$,T"S%$6",>.O*(%"U5ABCBDC:E;F9::"#V"W%$=%.66+'="5IF;9::U3"X� ��������H>("GBA"*+6(%"+)"O%$=%.66(-".)".'".--+*+$'"*$"*>("YZHZ0C7[HZ"\#V;]"S&',*+$'"R/$,T"S%$6"*>("U:E;F9::C#VFW%$=%.66+'=C5IF;9::3.O;EU"O%$_(,*3"H>+)"O%$_(,*"6&)*"R("%(*%+(?(-"+'"$%-(%"*$"'$Q".--"*>("GBA"*+6(%"HW"/.*,>+'="O&/)(a3"7"6&/*+F+')*.',("Q+//"R(",%(.*(-".)"."6(6$%b"S$%"*>("*+6(%3""Xc����� ����� ���������d�!��� �����e��f��� ��g�������H>("Y(6$%bC.&*$6.*+,C)*.%*C)*$O"+)"/.*,>(-"Q+*>"5*.%*"R&*"$'/b"+S"*>("%()(*",$'-+*+$')".%("'$*"O%()('*3"""H>("Y(6$%bC.&*$6.*+,C)*.%*C)*$O"+)"%()(*"+S"5*$O"+)"O%()('*"$%").S(*b")>&*$SS"+)".,*+?("$%".&*$6.*+,"6$-("+)"'$*".,*+?.*(-"6.'&./"6$-(a3"H>("A$'?(b$%C6$*$%C.&*$6.*+,C6$-("$&*O&*"+)".,*+?.*(-"Q>('"Y(6$%bC.&*$6.*+,C)*.%*C)*$O"+)")(*P"*>("('.R/(",$'-+*+$')".%("6(*".'-"Y(6$%bC,$'?(b$%C)*.%*C)*$O"+)")(*3"H$").?("('(%=bP"*>(",$'?(b$%")>$&/-"$'/b"%&'"Q>('"."O.%*"+)"O%()('*3"#$%"*>+)"%(.)$'P"*>("Y(6$%bC,$'?(b$%C)*.%*C)*$O"+)")(*"Q>('"5(')$%C,>&*(C$,,&O+(-")+='./)"."O.%*".'-"%()(*"Q>('"5(')$%C('-C$SC,$'?(b$%"O%$-&,()"."'(=.*+?("(-=("$%").S(*b")>&*$SS"+)".,*+?("$%".&*$6.*+,"6$-("+)"'$*".,*+?.*(-"6.'&./"6$-(a3"����������g��� ��g������h�V(,.&)("*>("5(')$%C('-C$SC,$'?(b$%"+)"'$*".R/("*$"R("6$&'*(-"-+%(,*/b".*"*>("('-"$S"*>(",$'?(b$%P"*>("5(')$%C('-C$SC,$'?(b$%")+='./"6&)*"R(")*%(*,>(-3"H$".,>+(?("*>+)P"."/.*,>+'="O&/)("Q+//"R("+')(%*(-"R(*Q(('"5(')$%C('-C$SC,$'?(b$%".'-"*>("'(=.*+?("(-=("-(*(,*+$'3""

Page 112: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;J:K3-$,L" " "J39"���M����!������ �N(%(O"P$&")(("*>("*(,>'$/$=P"-+.=%.6"Q$%"*>("*.)R3"" "#+=&%(";S"H(,>'$/$=P"-+.=%.6" "#+=&%("9S"A$'*%$/"T.'(/""

Page 113: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;:" "5@ABACB:D;ED::"FA@EG+6()".'-"@$&'*(%)"5HE;9::B0;I:J3-$,K" " "I3D"L�M���������N��G>("O$//$P+'=")+='./)".%("'((-(-".)"=/$Q./"$R(%.'-)"O$%"*>+)"*.)S3"��� �!T�� ������M���� ������� U��UV�F":3:" WXXY" E7;" 0(*&%'")+='./"(6(%=(',Z")*$R"$S" C@"F":3;" WXXY" E[:" \.+'")P+*,>"]XC]" CX"F":39" WXXY" E5:" \$-(")(/(,*$%"6.'&./":_".&*$6.*+,";_" \.'&./"a":"7&*$"a";"F":3D" WXXY" E5;" b&)>Q&**$'".&*$6.*+,")*.%*" CX"F":3J" WXXY" E59" b&)>Q&**$'".&*$6.*+,")*$R" C@"F":3I" WXXY" EW;" 5(')$%",Z/+'-(%"\J"%(*%.,*(-" CX"F";3:" WXXY" EWJ" 5(')$%".*",>&*("$,,&R+(-" CX"F";3D" WXXY" EWH" 5(')$%"R.%*".*"('-"$O",$'?(Z$%" CX""�V� �!T�� ������M���� ������� �c":3:" WXXY" Ec;" @$'?(Z$%"6$*$%"\;"O$%P.%-)"O+K(-")R((-" "defgfhidjkldlfjflfhmfdnopqd""""""""" 2X" 2+=+*./"X&*R&*"7X" 7'./$="X&*R&*"c" X&*R&*"2F" 2+=+*./"F'R&*"7F" 7'./$="F'R&*"F" F'R&*"C@" C$%6.//Z"@/$)(-""CX" C$%6.//Z"XR('""

Page 114: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;;" "5@ABACB:D;ED::"FA@EG+6()".'-"@$&'*(%)"5HE;9::B0;I:J3-$,K" " "<" ���������L��M�N!�L��M���L�������L�O$&",.'"P+'-"+')*%&,*+$')"$'">$Q"*$",.%%R"$&*"S/.''+'="T(/$Q3"FP"R$&"./%(.-R">.?("."=$$-"&'-(%)*.'-+'="$P"(?(%R*>+'=U"+*"Q+//"T(")&PP+,+('*"*$"P$,&)"$'"*>("'&6T(%(-")*(S)3"V*>(%Q+)(U")+6S/R"P$//$Q"*>("-(*.+/(-")*(S)"+'"*>("+')*%&,*+$')3"�W��X�����Y������Z�L����M��[����\"](P$%("Q(",.'"(KS.'-"*>("_VGV0B7 GV"a#];b"P&',*+$'"T/$,cU"Q("6&)*"%(*%+(?("*>(":D;E9::B#]Ed%$=%.66+'=B5HE;9::3e.S;D"S%$f(,*"P%$6",>.S*(%"5@ABACB:D;E9::"#]"d%$=%.66+'="5HE;9::3"G$"%(*%+(?(".'"(K+)*+'="S%$f(,*"*>.*">.)"T(('".%,>+?(-U"R$&"6&)*")(/(,*"*>("%(/(?.'*".%,>+?("Q+*>"\"d%$f(,*"\"0(*%+(?("+'"*>("S%$f(,*"?+(Q3"@$'P+%6"R$&%")(/(,*+$'"Q+*>"VS('"g\"d%$f(,*"\"0(*%+(?("\"5(/(,*"."3e.S".%,>+?("\":D;E9::B#]Ed%$=%.66+'=B5HE;9::3e.S;D"\"VS('h3"""\"G>("'(K*")*(S"+)"*$")(/(,*"*>("*.%=(*"-+%(,*$%R"Q>(%("*>("%(*%+(?(-"S%$f(,*"Q+//"T(")*$%(-3"@$'P+%6"R$&%")(/(,*+$'"Q+*>"Vi3""""

Page 115: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;9" "5@ABACB:D;ED::"FA@EG+6()".'-"@$&'*(%)"5HE;9::B0;I:J3-$,K" " "L"5.?("*>("$M('(-"M%$N(,*"&'-(%"*>("'.6(":D;ED::BFA@BG+6(%)B@$&'*(%)""OL"P%$N(,*"L"5.?(".)"333"L":D;ED::BFA@BG+6(%)B@$&'*(%)"L"5.?(Q" "�

Page 116: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:@;E@::"FBAEG+6()".'-"A$&'*(%)"5HE;9::C0;I:J3-$,K" " "<39"����������L���������� ���������L�������M���N� O��P�Q�QRS�T�QP�U"#+%)*V"$W('"*>("XYZGZ0C7[GZ"\#];X"_&',*+$'"/$,a"b+*>"."-$&/(E,/+,a3"""U"F')(%*".'$*>(%"'(*b$%a".*"*>("(=+''+'="$_"*>("XYZGZ0C7[GZ"\#];X"_&',*+$'"/$,a"c")(/(,*+'="*>("U"X/$,a"*+*/(X".'-",/+,a+'="*>("U" "+,$'"_$%"XF')(%*"'(*b$%aX3" ""

Page 117: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;J:@3-$,K" " "L"7--">(/MN&/"+'N$%6.*+$'"*$"*>("O/$,P",$66('*".'-"*>("'(*Q$%P"*+*/("$N"RD(*Q$%P";SR3" "L"T'"*>("%+=>*")+-("$N"U$&%"M%$=%.66+'="Q+'-$QV"U$&"Q+//")(("*>("*+6(%"N&',*+$')"+'"*>("/+)*"$N"+')*%&,*+$')3"W'-(%"L"X.)+,"+')*%&,*+$')"L"H+6(%"$M(%.*+$')V"N+'-"N&',*+$'" "Y8('(%.*("M&/)(Z".'-"&)("."-%.=F.'-F-%$M"$M(%.*+$'"*$"6$?("+*"*$"D(*Q$%P";"Y=%(('"/+'(".MM(.%)V"6$&)("M$+'*(%"Q+*>"[")U6O$/Z3"YL"G')*%&,*+$')"L"X.)+,"+')*%&,*+$')"L"H+6(%"$M(%.*+$')"L" "Z" ""

Page 118: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;@:J3-$,K" " "L"H>("*+6(%"M&',*+$'"%(N&+%()"."6(6$%O3"H>+)"6(6$%O"+)"P%$?+-(-"+'"*>+)",.)("Q+*>+'"*>("+')*.',("-.*."R/$,S"$M"*>("M&',*+$'"R/$,S"Q+*>$&*",%(.*+'="."'(Q"+')*.',("-.*."R/$,S3"5(/(,*"*>("LTU&/*+F+')*.',(T"$P*+$'"M$%"*>+)3"B'*(%"."'.6("M$%"*>("6&/*+F+')*.',(".'-",$'M+%6"Q+*>"L"TVWT3"XL"U&/*+F+')*.',("L"GBACH+6(%C$?(%%&'"L"VWY"""L"7)"."%()&/*Z"."*.=")*%&,*&%("$M"T5*.*+,T"*OP(")&+*.R/("M$%"H["H+6(%"Q+//"R(",%(.*(-"+'"*>("+'*(%M.,("-(),%+P*+$'3"" "\]_abcdefghihjkgljmncmljcojfpcqnceknrcsotcutovtlddhjvcwhgxhjclcsejmghojcqfomycqnmleknckglghmcglvkcltncojfpclzlhflqfncgxntn{cc

Page 119: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;<" "5@ABACB:D;ED::"FA@EG+6()".'-"@$&'*(%)"5HE;9::B0;I:J3-$,K" " "L"M)("-%.=E.'-E-%$N"*$"6$?("+'N&*"N.%.6(*(%"O5(')$%B('-B$PB,$'?(Q$%"*$"RSS3ST"+'"P%$'*"$P"N.%.6(*(%"UFCU"$P"GV"G+6(%")$"*>.*"*>+)"W+//"X(")*.%*(-".*"."N$)+*+?("(-=(".*"+'N&*"O5(')$%B('-B$PB,$'?(Q$%3"G>("X()*"W.Q"*$")(/(,*"."N.%.6(*(%"+'"*>("+'*(%P.,("-(),%+N*+$'"+)"XQ"U=%.XX+'=U"+*".*"*>("X/&(")Q6X$/" "YL" "5(')$%B('-B$PB,$'?(Q$%Z3"""L"A'*(%"*>("%([&+%(-"N&/)("-&%.*+$'"$P"9")(,$'-)"+'"P%$'*"$P"N.%.6(*(%"UVGU"YL9)"Z3"""

Page 120: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5@F;9::C0;I:J3-$,K" " "L"H>("('*%M"$N"9)"+)",$'?(%*(-".&*$6.*+,.//M"*$"*>("GBAFH+6("N$%6.*")&+*.O/("N$%"*>("GBA"*+6(%".'-"+)")>$P'".)",$')*.'*"QHR9)Q3" ""L"D$P"6$?("$&*S&*"QTQ"N%$6"*.=")*%&,*&%("QGBACH+6(%C$?(%%&'Q"$'*$"+'S&*"QAUVQ"$N"'(=.*+?("(-=("QDCH0G8Q"+'"D(*P$%W"93"H>+)"P+//"%(S/.,("*>("R5(')$%C('-C$NC,$'?(M$%"+'S&*"*.="S%(?+$&)/M"('*(%(-"*>(%(".'-"*>(",$'?(M$%"P+//"O(")*$SS(-"OM"."'(=.*+?("(-=("$N"*>("GBACH+6(%C$?(%%&'"S&/)(3"XL"D(*P$%W"9"L"GBACH+6(%C$?(%%&'L"T"L"R5(')$%C('-C$NC,$'?(M$%Y" ""

Page 121: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;J:K3-$,L" " "M"2$"'$*"N$%=(*"*$",/+,O" "%(=&/.%/P3"H>("N+'+)>(-"N&',*+$'"Q/$,O"RSTHT0C7UHTR"V#W;X"Y+*>"*>("*+6(%"+)")>$Y'"+'"#W2"Q(/$Y3" """

Page 122: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" ;@" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;J:K3-$,L" " "M"N'-(%"O8('(%./O"+'"*>("P%$P(%*+()"$Q"*>("R/$,ST"U$&",.'",>.'=("*>("OV.'=&.=(O"*$"V72"WV.--(%"V$=+,X"WMY%$P(%*+()"M"8('(%./"M"V.'=&.=(Z"V72X" "M"H>+)"+)"[>.*"'(*[$%S)";".'-"9"/$$S"/+S("+'"V723" "�

Page 123: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9:" "5@ABACB:D;ED::"FA@EG+6()".'-"@$&'*(%)"5HE;9::B0;I:J3-$,K" " "<3D"LM������N��O���P����������N�������Q������O���P�R"ST('"*>("UV.+'"WSX;YU"$%=.'+Z.*+$'"[/$,\"]+*>"."-$&[/(E,/+,\3""R"F'"C(*]$%\";"$"*>("UV.+'"WSX;U"$%=.'+Z.*+$'"[/$,\_"+')*.',("-.*."[/$,\"UVSGS0B7 GSB2X;U"$%"*>("UVSGS0B7 GS"W#X;YU"&',*+$'"[/$,\".TT(.%)"+',$%%(,*_"[(,.&)("*>(".--+*+$'./"6(6$%a"$%"*>("Gb"G+6(%">.)"'$*"a(*"[(('".--(-"*>(%(3"@/+,\"*>("R"U U"+,$'"$%"UT-.*("+',$')+)*('*"[/$,\",.//)U3"G>+)"]+//".--"*>("UVSGS0B7 GSB2X;U"+')*.',("-.*."[/$,\",$%%(,*/a".=.+'"cR" "d3" "

Page 124: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9;" "5@ABACB:D;ED::"FA@EG+6()".'-"@$&'*(%)"5HE;9::B0;I:J3-$,K" " "<3J"��L�������� M�����N��M���� �O"G$").?("P$&%"Q%$R(,*S")(/(,*"*>(" "T&**$'"+'"*>("6('&3"G$",$6Q+/(".//"T/$,U)S",/+,U"*>("VW%$=%.6"T/$,U)V"X$/-(%".'-")(/(,*"*>(" "+,$'"X$%",$6Q+/+'="+'"*>("6('&""YO" "O"W%$=%.6"T/$,U)"O" Z3" "O"G>("VF'X$VS"V@$6Q+/(V".%(.")>$[)"[>+,>"T/$,U)"[(%(")&,,())X&//P",$6Q+/(-3" "�

Page 125: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 99" "5@ABACB:D;ED::"FA@EG+6()".'-"@$&'*(%)"5HE;9::B0;I:J3-$,K" " "<3I"��L�������M��N���� �O"7P*(%")&,,())P&/",$6Q+/.*+$'R"*>(",$6Q/(*(",$'*%$//(%"S+*>"*>(",%(.*(-"Q%$=%.6"+',/&-+'="*>(">.%-S.%(",$'P+=&%.*+$'R".)"Q%(?+$&)/T"-(),%+U(-"+'"*>("6$-&/()R",.'"U("-$S'/$.-(-"VO" W3" "�

Page 126: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:@;E@::"FBAEG+6()".'-"A$&'*(%)"5HE;9::C0;I:J3-$,K" " "<3<"��������L���� �M���NO�P"G>("-()+%(-"Q/$,R"6&)*"Q("$S('"T$%"6$'+*$%+'="*>("-$U'/$.-(-"S%$=%.63"V$'+*$%+'=",.'"'$U"Q(".,*+?.*(-W-(.,*+?.*(-"QX",/+,R+'="*>("" "+,$'"YP"V.+'"Z[\;]"P" 3"""_ abcdefghijklmjnlkohfgnghlphplokqrsngrqmgthqkthujkmnjrrgnstgvgktgkmwhefghplokqrhpmqmgphqmhmfghmgnilkqrphqnghlktluqmgthxlmfheyz{hjnh|}~�{w"

Page 127: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;J:@3-$,K" " "L"H>("MNOHO0C7PHOM"Q#R;S"T&',*+$'"U/$,V",.//(-"+'"*>("MN.+'"QOR;SM"$%=.'+W.*+$'"U/$,V",.'"U(")(/(,*(-"-+%(,*/X"T$%"MOY('".'-"6$'+*$%M".T*(%"%+=>*F,/+,V+'=Z"*>(%(UX".//$[+'="*>("Y%$=%.6",$-("+'"*>("T&',*+$'"U/$,V"[+*>"*>("H\"H+6(%"*$"U("6$'+*$%(-""]L"MNOHO0C7PHOM"Q#R;S"L"OY('".'-"6$'+*$%3" ""_ abcdefghijklmjnlkohfgnghlphqrksmljktnguvmgwhvkwhsjkmnjuugntlkwgxgkwgkmyhefghvsmrvmljkhjqhpgkpjnphvkwhmfghpmvmljkhpmvmrphvnghpfjzkhfgnghzlmfhe{|}hjnh~���}yd"

Page 128: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;@:J3-$,K" " "<3I"���L�M���L��N��O����P"7)"*>("Q+'./")*(RS"T("T.'*"*$".%,>+?("*>(",$6R/(*("R%$U(,*3"5(/(,*"*>("P"V7%,>+?("333V",$66.'-"+'"*>("P"VW%$U(,*V"6('&3"5(/(,*"."Q$/-(%"T>(%("X$&"T.'*"*$".%,>+?("X$&%"R%$U(,*".'-").?("+*"T+*>"*>("Q+/("*XR("VHG7"W$%*./"R%$U(,*".%,>+?(V3"YP"W%$U(,*"P"7%,>+?("P"HG7"W$%*./"R%$U(,*".%,>+?("P"5ABCBDC:E;FE::CGBACH+6(%)CA$&'*(%)C5IFZ[\\] _P"5.?(" "a

Page 129: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9<" "5@ABACB:D;ED::"FA@EG+6()".'-"@$&'*(%)"5HE;9::B0;I:J3-$,K" " "<3L"�M��N��O��C$3" 2(),%+P*+$'" @$6P/(*(-";" @$6P+/+'=")&,,())Q&/".'-"R+*>$&*"(%%$%"6()).=(" "9" 2$R'/$.-")&,,())Q&/".'-"R+*>$&*"(%%$%"6()).=(" "D" 5R+*,>"$'")*.*+$'"SET:"U";V"@W/+'-(%"%(*%.,*(-"X"#((-Y.,Z".,*+?.*(-"SE[;"U";V"A\A08AC@]"##"SE7;"U";V"'$*".,*+?.*(-"7_G \7GF@"6$-("SE5:"U";V"&)>Y&**$'".&*$6.*+,")*$P"'$*".,*&.*(-"SE59"U";V"[%+(Q/W"P%())"*>(".&*$6.*+,")*.%*"P&)>Y&**$'"SE5;"U";V"5(')$%".*",>&*(".,*+?.*(-"SE[J"U";V"@$'?(W$%"6$*$%"Q$%R.%-)"Q+K(-")P((-"*>('")R+*,>()"$'"SEa;"U";V".'-")*.W)"$'3" "J" 5(')$%".*"('-"$Q",$'?(W$%".,*+?.*(-"SE[H"U";V"b"Ea;"U":"S.Q*(%"9")(,$'-)V" "I" [%+(Q/W"P%())"*>(".&*$6.*+,")*$P"P&)>Y&**$'"SE59"U":V"b"Ea;"U":" "<" 7,*+?.*("A\A08AC@]"##"SE7;"U":V"b"Ea;"U":" "H" \.'&./"6$-("SE5:"U":V"b"Ea;"U":" "L" 5R+*,>"$QQ")*.*+$'"SET:"U":V"b"Ea;"U":" "c" @W/+'-(%"'$*"%(*%.,*(-"SE[;"U":V"b"Ea;"U":" ";:" %$d(,*")&,,())Q&//W".%,>+?(-" """

Page 130: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5@F;9::C0;I:J3-$,K" " "@" �L����M��NO����MP�Q��L����M�"�G'"*>+)"(K(%,+)(R".'"GBA",$&'*(%"+)"*$"S(".--(-"*$"*>("TUHU0C7VHU"W#X;Y"Z&',*+$'"S/$,[3"H>("(K\.'-(-"Z&',*+$'"S/$,["]+//"S("\/.''(-R"\%$=%.66(-".'-"*()*(-""H>("6.=._+'("Z$%"\/.)*+,">$/-)"$'/"I"\.%*)3"H>("\.%*)".%("*>(%(Z$%("S(",$&'*(-".*"*>("('-"$Z"*>(",$'?($%3"a>('"I"\.%*)".%(")*$%(-"+'"*>("6.=._+'(R".&*$6.*+,"6$-("+)"*$"S(")*$\\(-3"U',("*>("6.=._+'(">.)"S(('"(6\*+(-R".&*$6.*+,"6$-("]+//"S("%()*.%*(-"]+*>"5*.%*C,$66.'-"+)")*.%*(-".=.+'".'-"*>(",$&'*(%"+)"%()(*3""NO�����b����!������ �c(%(R"$&")(("*>("*(,>'$/$="-+.=%.6"Z$%"*>("*.)[3"" "#+=&%("E"H(,>'$/$="-+.=%.6" "#+=&%("J"A$'*%$/"\.'(/""

Page 131: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;J:K3-$,L" " "I3E"M�N���������O��H>("P$//$Q+'=")+='./)".%("'((-(-".)"=/$R./"$S(%.'-)"P$%"*>+)"*.)T3"��� �!U�� ������N���� ������� V��VW�G":3:" XYYZ" F7;" 0(*&%'")+='./"(6(%=(',[")*$S"$T" DA"G":3;" XYYZ" F\:" ].+'")Q+*,>"YD" DY"G":39" XYYZ" F5:" ]$-(")(/(,*$%"6.'&./"_:a".&*$6.*+,"_;" ].'&./"b":"7&*$"b";"G":3E" XYYZ" F5;" c&)>R&**$'".&*$6.*+,")*.%*" DY"G":3K" XYYZ" F59" c&)>R&**$'".&*$6.*+,")*$S" DA"G":3J" XYYZ" FX;" 5(')$%",[/+'-(%"]K"%(*%.,*(-" DY"G";3:" XYYZ" FXK" 5(')$%".*",>&*("$,,&S+(-" DY"G";3E" XYYZ" FXI" 5(')$%"S.%*".*"('-"$P",$'?([$%" DY""�W� �!U�� ������N���� ������� �d":3:" XYYZ" Fd;" A$'?([$%"6$*$%"];"P$%Q.%-)"P+L(-")S((-" "efghgijeklmemgkgmgingeopqre""""""""""stu���������c/.'"*>("+6S/(6('*.*+$'"$P"*>("*.)T"$'"[$&%"$Q'3"vlrgwexyz{|}z~���}��y}��y}��}���}���|�y{�}�|}�������}�������}�|}��y}�|��|y}�y���}2Y" 2+=+*./"Y&*S&*"7Y" 7'./$="Y&*S&*"d" Y&*S&*"2G" 2+=+*./"G'S&*"7G" 7'./$="G'S&*"G" G'S&*"DA" D$%6.//["A/$)(-""DY" D$%6.//["YS('""

Page 132: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" 9@" "5ABCBDC:E;FE::"GBAFH+6()".'-"A$&'*(%)"5IF;9::C0;J:K3-$,L" " "I3J"�M��N��O��P��Q����O��" R�S� ��O���T����� �� T������;" A$6U+/+'=")&,,())V&/".'-"W+*>$&*"(%%$%"6()).=(" "9" 2$W'/$.-")&,,())V&/".'-"W+*>$&*"(%%$%"6()).=(" "E" 5W+*,>"$'")*.*+$'"XFY:"Z";["A\/+'-(%"%(*%.,*(-"]"#((-.,_".,*+?.*(-"XF;"Z";["BaB08BDAb"c##"XF7;"Z";["'$*".,*+?.*(-"7dHca7HGA"6$-("XF5:"Z";["e&)>&**$'".&*$6.*+,")*$U"'$*".,*&.*(-"XF59"Z";["%+(V/\"U%())"*>(".&*$6.*+,")*.%*"U&)>&**$'"XF5;"Z";["5(')$%".*",>&*(".,*+?.*(-"XFK"Z";["A$'?(\$%"6$*$%"V$%W.%-)"V+L(-")U((-"*>('")W+*,>()"$'"XFf;"Z";[".'-")*.\)"$'3" "K" 5(')$%".*"('-"$V",$'?(\$%".,*+?.*(-"XFI"Z";["g"Ff;"Z":"X.V*(%"9")(,$'-)[" "J" %+(V/\"U%())"*>(".&*$6.*+,")*$U"U&)>&**$'"XF59"Z":["g"Ff;"Z":" "<" 7,*+?.*("BaB08BDAb"c##"XF7;"Z":["g"Ff;"Z":" "I" a.'&./"6$-("XF5:"Z":["g"Ff;"Z":" "h" 5W+*,>"$VV")*.*+$'"XFY:"Z":["g"Ff;"Z":" "@" A\/+'-(%"'$*"%(*%.,*(-"XF;"Z":["g"Ff;"Z":" ";:" J*>"U.%*"+'"6.=.i+'("g"Ff;"Z":" ";;" e%$j(,*")&,,())V&//\".%,>+?(-" ""

Page 133: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"%+=>*)"%()(%?(-3" @:" "5ABCBDC:@;E@::"FBAEG+6()".'-"A$&'*(%)"5HE;9::C0;I:J3-$,K" " "L" �������������M�� ������N$&",.'"O+'-".--+*+$'./"+'O$%6.*+$'".)".'"$%+('*.*+$'".+-"O$%"+'+*+./".'-".-?.',(-"*%.+'+'=P"O$%"(K.6Q/(R"8(**+'="5*.%*(-P"?+-($)P"*&*$%+./)P".QQ)P"6.'&./)P"Q%$=%.66+'="=&+-(/+'()".'-"*%+./")$O*S.%(TO+%6S.%(P".*"*>("O$//$S+'="/+'UR"""SSS3)+(6(')3,$6T),(T)HE;9::"""

Page 134: SCE-Basic Programming S7-1200 (2016)

����������������������������� ��������������������������������������� ����������������� ��������� �������������� !��"���� �#��� ���$�%&���'�����(����������)����!#� !*��+%�����,-./01234345/-611376869/�����������������*��:�������)���;�������<=��>�����

Page 135: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# :# #6ABCBDC;E<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;C1<J;G4.%-K# # #����L������������������M��N�O����L�N���������������� N�P#���������Q��������� ��R�S�T�UN����O��V�W����������W#X&.)&#(%4Y#=B6I:<GF<HBE;FG8HE#P#���������Q������ �� �� ��UN����O��V�W����������W#X&.)&#(%4Y#=B6I:<GF<8BE;FG8HE#P#Z[������������������Q�\�����]�������UO����Q�����V�UN����O��V�W����������W#X&.)&#(%4Y#=B6I::F;88;EFG_BJ���D%+)#+?/+#+?)*)#+&/,()&#/-a/>)*#/&)#&)0/-).#b,+?#*'--)**%&#/-a/>)*#b?)(#()-)**/&c4#8(#%@)&@,)b#%d#+?)#-'&&)(+0c#/@/,0/e0)#6AB#/-a/>)*#,*#/@/,0/e0)#/+Y#*,)7)(*4-%7f*-)f+#�������������������$%&#&)>,%(/0#6,)7)(*#6AB#-%(+,(').#+&/,(,(>g#-%(+/-+#c%'&#&)>,%(/0#6AB#-%(+/-+#*,)7)(*4-%7f*-)f-%(+/-+#���������������O�� �������������������*,)7)(*4-%7f*-)###��O�� ��������������N��h?)#6AB#+&/,(,(>#-'&&,-'0'7#d%&#+?)#,(+)>&/+).#/'+%7/+,%(#*%0'+,%(#h%+/00c#i(+)>&/+).#8'+%7/+,%(#jhi8k#b/*#&)/&).#d%&#+?)#&%>&/7#l6,)7)(*#8'+%7/+,%(#A%%)&/+)*#b,+?#B.'-/+,%(#j6ABkl#*)-,d,-/00c#d%&#+&/,(,(>#'&%*)*#d%&#'e0,-#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#6,)7)(*#89#.%)*#(%+#>'/&/(+))#+?)#-%(+)(+*4##h?,*#.%-'7)(+#,*#+%#e)#'*).#%(0c#d%&#,(,+,/0#+&/,(,(>#%(#6,)7)(*#&%.'-+*f*c*+)7*g#b?,-?#7)/(*#,+#-/(#e)#-%,).#,(#b?%0)#%&#/&+#/(.#>,@)(#+%#+?%*)#e),(>#+&/,().#d%&#'*)#b,+?,(#+?)#*-%)#%d#+?),&#+&/,(,(>4#A,&-'0/+,%(#%&#-%c,(>#+?,*#+&/,(,(>#-'&&,-'0'7#/(.#*?/&,(>#,+*#-%(+)(+#,*#)&7,++).#b,+?,(#'e0,-#+&/,(,(>#/(.#/.@/(-).#+&/,(,(>#d/-,0,+,)*#d%&#+&/,(,(>#'&%*)*4###BK-)+,%(*#&)m',&)#b&,++)(#-%(*)(+#d&%7#+?)#6,)7)(*#89#-%(+/-+# )&*%(Y#1%0/(.#6-?)')&)&#&%0/(.4*-?)')&)&n*,)7)(*4-%74##Xdd)(.)&*#b,00#e)#?)0.#0,/e0)4#800#&,>?+*#,(-0'.,(>#+&/(*0/+,%(#/&)#&)*)&@).g#/&+,-'0/&0c#,d#/#/+)(+#,*#>&/(+).#%&#/#'+,0,+c#7%.)0#%&#.)*,>(#,*#&)>,*+)&).4##o*)#d%&#,(.'*+&,/0#-'*+%7)&#-%'&*)*#,*#)K0,-,+0c#(%+#)&7,++).4#p)#.%#(%+#-%(*)(+#+%#-%77)&-,/0#'*)#%d#+?)#+&/,(,(>#-'&&,-'0'7*4##p)#b,*?#+%#+?/(a#+?)#ho#3&)*.)(g#/&+,-'0/&0c#q&%d4#3&4Fi(>4#r)%(#o&e/*#/(.#3,04Fi(>4#8(()++#qd)dd)&g#+?)#s,-?/)0#3t,/00/*#B(>,())&,(>#A%&%&/+,%(#/(.#/00#%+?)&#,(@%0@).#)&*%(*#d%&#+?),&#*' %&+#.'&,(>#+?)##&)/&/+,%(#%d#+?,*#+&/,(,(>#-'&&,-'0'74#�

Page 136: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# A# #6BCDCED;A<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;D1<J;G4.%-K# # #L/M0)#%N#-%(+)(+*#<O 9%/0#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#GO:O P&)&)Q',*,+)#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#GOAO L?)%&R#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#GOA4<O $/'0+#.,/>(%*+,-*#/(.#?/&.S/&)#N/'0+*#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#GOA4:O T/&.S/&)#.,/>(%*+,-*#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#JOA4AO 3,/>(%*+,-*#N%&#U&%>&/7#M0%-V*#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#=OGO L/*V#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#IOJO P0/((,(>#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#IOJ4<O W(0,()#,(+)&N/-)#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#IO=O 6+&'-+'&).#*+)UFMRF*+)U#,(*+&'-+,%(*#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#XO=4<O 1)+&,)@)#/(#)K,*+,(>#U&%Y)-+#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#XO=4:O 3%S(0%/.#+?)#U&%>&/7#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#ZO=4AO B%(()-+#%(0,()#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<<O=4GO W(0,()#2#.,/>(%*+,-*#N%&#6[\8L[B#6I#-%(+&%00)&#4444444444444444444444444444444444444444444444444444444444444444444444444#<JO=4JO W(0,()]%NN0,()#-%7U/&,*%(#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#:AO=4=O \%(,+%&#/(.#7%.,NR#+/>*#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#:=O=4IO $%&-)#+/>*#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#:ZO=4XO B?)-V0,*+#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AAOIO CK)&-,*)#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AGOI4<O L/*V##CK)&-,*)#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AGOI4:O P0/((,(>#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AGOI4AO B?)-V0,*+##CK)&-,*)#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AGOXO 8..,+,%(/0#,(N%&7/+,%(#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AJO## # #

Page 137: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# A# #6BCDCED;F<GA<;#H/*,-*#3,/>(%*+,-*#6IG<:;;D1<J;A4.%-K# # #L������M!� ��NOM�����!PO���MO����N����Q(#+?,*#7%.'0)R#+?)#&)/.)&#S,00#T)-%7)#/-U'/,(+).#S,+?#+?)#+%%0*#+?/+#*'VV%&+#+&%'T0)*?%%+,(>4##W?,*#7%.'0)#S,00#V&)*)(+#.,/>(%*+,-#X'(-+,%(*#+?/+R#X%&#)K/7V0)R#Y%'#-/(#+)*+#S,+?#+?)#WQ8#V&%Z)-+#X&%7#+?)#6BCDCED;F<G<;;D$BG[&%>&/77,(>#S,+?#6Q\8WQB#6IG<:;;#7%.'0)4##�������]�����W?,*#-?/V+)&#T',0.*#%(#+?)#?/&.S/&)#-%(X,>'&/+,%(#%X#6Q\8WQB#6I#B[_<:<AB4#%S)@)&R#%+?)&#?/&.S/&)#-%(X,>'&/+,%(*#+?/+#?/@)#.,>,+/0#,(V'+#/(.#%'+V'+#T%/&.*#-/(#T)#'*).4#$%&#+?,*#-?/V+)&R#Y%'#-/(#'*)#+?)#X%00%S,(>#V&%Z)-+R#X%&#)K/7V0)a#6BCDCED;F<D<;;D$BG[&%>&/77,(>D6IG<:;;D1<J;A4b/V<F#���c���"�F4<#!�����������������c���d����e���#�$/'0+*#-/(#T)#-/'*).#TY#/#@/&,)+Y#%X#+?,(>*4##$%&#X/'0+*#+?/+#%--'&#/X+)&#/#-?/(>)%@)&#+%#1_ER#+?)&)#/&)#+S%#)&&%&#V/++)&(*4#<4#W?)#B[_#>%)*#+%#%&#*+/Y*#,(#+?)#6Wf[#%V)&/+,(>#*+/+)4#W?)#Y)00%S#6Wf[#gC3#0,>?+*#'V#/(.#%+?)&#,(.,-/+%&#gC3*#0,>?+#'V#%(#+?)#B[_R#V%S)&#*'VV0Y#'(,+R#Qhf#7%.'0)*#%&#T'*#7%.'0)*4#8#B[_#X/'0+#,*#V&)*)(+#,(#+?,*#-/*)4#$%&#)K/7V0)R#/#7%.'0)#,(#+?)#/'+%7/+,%(#*Y*+)7#7,>?+#T)#.)X)-+,@)#%&#?/@)#/(#,(-%&&)-+#V/&/7)+)&#/**,>(7)(+#%&#/#T'*#*Y*+)7#X/'0+#7,>?+#T)#V&)*)(+4#8(#,(+)&&'V+,%(#/(/0Y*,*#S,00#T)#V)&X%&7).#,(#+?,*#-/*)#TY#)@/0'/+,(>#+?)#?/&.S/&)#.,/>(%*+,-*#/(.#TY#&)/.,(>#+?)#7%.'0)#,(X%&7/+,%(#X&%7#+?)#.,/>(%*+,-#T'XX)&#%X#+?)#B[_4##:4#W?)#B[_#,*#,(#/#X/'0+Y#1_E#%V)&/+,(>#*+/+)4#W?)#>&))(#1_E#gC3#0,>?+*#'V#/(.#%+?)&#,(.,-/+%&#gC3*#0,>?+#'V#%&#X0/*?#%(#+?)#B[_R#V%S)&#*'VV0Y#'(,+R#Qhf#7%.'0)*#%&#T'*#7%.'0)*4##Q(#+?,*#-/*)R#/#X/'0+#7/Y#T)#V&)*)(+#,(#+?)#Qhf#.)@,-)*#%&#V%S)&#*'VV0Y4##8#@,*'/0#-?)-i#S,00#T)#V)&X%&7).#,(,+,/00Y#+%#(/&&%S#.%S(#+?)#X/'0+#/&)/4#W?)#,(.,-/+%&#gC3*#%(#+?)#B[_#/(.#Qhf#.)@,-)*#S,00#T)#)@/0'/+).4#W?)#.,/>(%*+,-#./+/#%X#+?)#X/'0+Y#Qhf#/(.#T'*#7%.'0)*#S,00#T)#&)/.#X&%7#+?)#?/&.S/&)#.,/>(%*+,-*4#Q(#/..,+,%(R#/#X/'0+#/(/0Y*,*#-/(#T)#V)&X%&7).#'*,(>#/#S/+-?#+/T0)#%(#+?)#V&%>&/77,(>#.)@,-)4##

Page 138: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6JG<:;;D1<A;H4.%-K# # #F4:#L���M���������N���N�O?)#.)@,-)#@,)P#,(#%(0,()#7%.)#%Q#+?)#OR8#S%&+/0#>,@)*#T%'#/#U',-V#%@)&@,)P#%Q#+?)#-%(Q,>'&/+,%(#/(.#*T*+)7#*+/+'*#%Q#+?)#/'+%7/+,%(#*T*+)74### # #$,>'&)#<W#X(0,()#@,)P#%Q#.)@,-)#-%(Q,>'&/+,%(## #

Page 139: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# =# #6ABCBDC;E<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;C1<J;G4.%-K# # #E4E# ����L���L�M���N���� �O���PL�Q?)#R&%S)-+#+&))#T,(.%T#%U#+?)#QV8#W%&+/0#,(#%(0,()#7%.)#>,@)*#X%'#/(#%@)&@,)T#%U#+?)#R&%>&/77).#Y0%-Z*#%U#+?)#'*)&#R&%>&/74#8#-%7R/&,*%(#%U#+?)#R&%>&/7#Y0%-Z*#'*).#%UU0,()#/(.#%(0,()#,*#.,*R0/X).#T,+?#+?)#?)0R#%U#.,/>(%*+,-#*X7Y%0*4### #$,>'&)#:[#\(0,()#@,)T#%U#+?)#]/,(#\H<_#Y0%-Z#� �

Page 140: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6AG<:;;D1<J;H4.%-K# # #����LM�N?)#O%00%P,(>#.,/>(%*+,-#O'(-+,%(*#P,00#Q)#*?%P(#/(.#+)*+).#,(#+?,*#-?/R+)&S#T#3,/>(%*+,-#*U7Q%0*#,(#+?)#%(0,()#@,)P#%O#+?)#NV8#W%&+/0#T#3)@,-)#.,/>(%*+,-*#P,+?#7%.'0)#,(O%&7/+,%(#T#XOO0,()Y%(0,()#-%7R/&,*%(#T#Z%(,+%&,(>#/(.#7%.,OU,(>#+/>*#T#$%&-,(>#+/>*#[���������N?)#.,/>(%*+,-#O'(-+,%(*#P,00#Q)#R)&O%&7).#'*,(>#/#O,(,*?).#R&%\)-+#/*#/(#)K/7R0)4#8#R&%\)-+#,(#+?)#NV8#W%&+/0#+?/+#P/*#R&)@,%'*0U#.%P(0%/.).#+%#+?)#-%(+&%00)&#*?%'0.#Q)#%R)(#O%&#+?,*4#V(#%'&#-/*)]#%(-)#U%'#?/@)#%R)().#+?)#NV8#W%&+/0]#U%'#P,00#&)+&,)@)#/#R&)@,%'*0U#-&)/+).#R&%\)-+#+?/+#P/*#/&-?,@).#/(.#.%P(0%/.#,+#+%#+?)#/**%-,/+).#-%(+&%00)&4#%'#-/(#+?)(#*+/&+#,7R0)7)(+,(>#+?)#.,/>(%*+,-#O'(-+,%(*#,(#+?)#NV8#W%&+/04##J4<#_���������������X(0,()#.,/>(%*+,-*#-/(#%(0U#Q)#R)&O%&7).#P?)(#+?)#-%&&)-+#-%77'(,-/+,%(#-%(()-+,%(#+%#+?)#BWa#?/*#Q))(#)*+/Q0,*?).4#b)#-%(()-+#@,/#C+?)&()+YW1X$VECN#,(#+?,*#-/*)4#b?)(#>%,(>#%(0,()]#U%'#7'*+#+?)&)O%&)#*)+#+?)#/RR&%R&,/+)#,(+)&O/-)*#O%&#U%'&#/'+%7/+,%(#*U*+)74# #$,>'&)#FS#B%(()-+,(>#%(0,()#

Page 141: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6JG<:;;D1<K;H4.%-L# # #�����������M��N�O"�M��N���M�������M�P%'#Q,00#R,(.#,(*+&'-+,%(*#%(#?%Q#+%#-/&&S#%'+#T0/((,(>#U)0%Q4#VR#S%'#/0&)/.S#?/@)#/#>%%.#'(.)&*+/(.,(>#%R#)@)&S+?,(>W#,+#Q,00#U)#*'RR,-,)(+#+%#R%-'*#%(#+?)#('7U)&).#*+)T*4#X+?)&Q,*)W#*,7T0S#R%00%Q#+?)#.)+/,0).#*+)T*#,(#+?)#,(*+&'-+,%(*4#=4<#Y�����Z������[�M����N��\����]#I)R%&)#Q)#-/(#*+/&+#+?)#.,/>(%*+,-#R'(-+,%(*W#Q)#()).#/#T&%)-+#Q,+?#T&%>&/77,(>#/(.#/#?/&.Q/&)#-%(R,>'&/+,%(#_)4>4W#6BCDCED;F<G<;;D$BG&%>&/77,(>D6JG<:;;4444a/Tb4##c%#&)+&,)@)#/(#)L,*+,(>#T&%)-+#+?/+#?/*#U))(#/&-?,@).W#S%'#7'*+#*)0)-+#+?)#&)0)@/(+#/&-?,@)#Q,+?#]#&%)-+#]#1)+&,)@)#,(#+?)#T&%)-+#@,)Q4##B%(R,&7#S%'&#*)0)-+,%(#Q,+?#dXT)(d4##_]#&%)-+#]#1)+&,)@)#]#6)0)-+#/#4a/T#/&-?,@)#]#XT)(b###]#c?)#()L+#*+)T#,*#+%#*)0)-+#+?)#+/&>)+#.,&)-+%&S#Q?)&)#+?)#&)+&,)@).#T&%)-+#Q,00#U)#*+%&).4#B%(R,&7#S%'&#*)0)-+,%(#Q,+?#dXed4#_]#c/&>)+#.,&)-+%&S#]#Xeb##

Page 142: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6JG<:;;D1<K;H4.%-L# # #=4:# �M�������N��O���� �P#8Q+)&#+?)#R&%S)-+#?/*#T))(#*'--)**Q'00U#&)+&,)@).V#+?)#-%(+&%00)&#-/(#T)#*)0)-+).#/(.#.%W(0%/.).#+%>)+?)&#W,+?#+?)#-&)/+).#R&%>&/74#XP# Y# ##

Page 143: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# <;# #6ABCBDC;E<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;C1<J;G4.%-K# # #L#6)0)-+#+?)#-%&&)-+#,(+)&M/-)*#/(.#-0,-N#O6+/&+#*)/&-?O4#PL#OQDRSBO#L#6)0)-+,%(#%M#+?)#()+T%&N#/./U+)&#%M#+?)#Q9RQA#L#VWXYZ[\][\_[\ab\cbaL#O6+/&+#*)/&-?Od#e(-)#O6-/(#/(.#,(M%&7/+,%(#&)+&,)@/0#-%7U0)+).O#/UU)/&*f#-0,-N#Og%/.O4#PL#Og%/.Od##L#H)M%&)#.%T(0%/.,(>#-/(#h)#*+/&+).f#%+?)&#/-+,%(*#7/i#?/@)#+%#h)#*)+#PU,(N#7/&N,(>d4#j?)(#-0,-N#Og%/.O#/>/,(4#PL#Og%/.Od4# #

Page 144: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# <<# #6ABCBDC;E<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;C1<J;G4.%-K# # #L#8M+)&#0%/.,(>N#M,&*+#*)0)-+#+?)#O6+/&+#/00O#-?)-P#Q%K#'(.)&#8-+,%(4#R?)(#-0,-P#O$,(,*?O4#SL#*)0)-+#-?)-P#Q%K#L#O$,(,*?OT# #�=4E#���������������L#R%#>)+#*+/&+).#U,+?#+?)#.,/>(%*+,-#M'(-+,%(*N#U)#U,00#*)0)-+#%'&#-%(+&%00)&#SOAVWC<:<GAOT#/(.#-0,-P#O9%#%(0,()O4#SL#AVWC<:<GA#L#9%#%(0,()T# #

Page 145: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# <:# #6ABCBDC;E<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;C1<J;G4.%-K# # #L#M(-)#+?)#%(0,()#-%(()-+,%(#+%#+?)#NOPAC<N#-%(+&%00)&#,*#)*+/Q0,*?).R#+?)#AOS#-/(#Q)#*+/&+).#%&#*+%TT).#U,+?#+?)#V%00%U,(>#Q'++%(*# 4#3,/>(%*+,-#,(V%&7/+,%(#,(#+?)#V%&7#%V#*W7Q%0*#U,00#/0&)/.W#Q)#/@/,0/Q0)#,(#+?)#T&%X)-+#+&))#/(.#,(#+?)#.,/>(%*+,-*#U,(.%U4## #��" Y��Z�[����\���� ]���Z���Z���Z�����\��]�����������L#_?)#.,/>(%*+,-#*W7Q%0*#,(#+?)#T&%X)-+#+&))#*?%U#/#-%7T/&,*%(#*+/+'*#&)T&)*)(+,(>#+?)#%(0,()%VV0,()#-%7T/&,*%(#%V#+?)#T&%X)-+#*+&'-+'&)4#�" Y����������# $%0.)&#-%(+/,(*#%QX)-+*#U,+?#%(0,()#/(.#%VV0,()#@)&*,%(*#+?/+#.,VV)&)(+#a%(0W#,(#+?)#T&%X)-+#+&))b## M(0,()#/(.#%VV0,()#@)&*,%(*#%V#+?)#%QX)-+#/&)#.,VV)&)(+## MQX)-+#%(0W#)K,*+*#%(0,()## MQX)-+#%(0W#)K,*+*#%VV0,()## M(0,()#/(.#%VV0,()#@)&*,%(*#%V#+?)#%QX)-+#/&)#+?)#*/7)####

Page 146: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# <A# #6BCDCED;A<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;D1<J;G4.%-K# # #L#3%'M0)F-0,-N#+?)#O3)@,-)#-%(P,>'&/+,%(O4#QL#3)@,-)#-%(P,>'&/+,%(R# ##ST�������U�����U" V��U�W�����XU�������U��L#Y?)#>&/Z?,-/0#&)Z&)*)(+/+,%(#/(.#.)@,-)#,(P%&7/+,%(#[,(.%[#*?%[#+?)#@/&,%'*#%Z)&/+,(>#*+/+)*#%P#+?)#B\]#%&#-%77'(,-/+,%(#Z&%-)**%&*#QB\*R4#�" V��� ST�������U�����# 1]E## 6Y \## 6Y81Y]\## _ 3## 3C$CBY## ](N(%[(#%Z)&/+,(>#*+/+)## Y?)#-%(P,>'&).#7%.'0)#.%)*#(%+#*'ZZ%&+#.,*Z0/a#%P#+?)#%Z)&/+,(>#*+/+)4###

Page 147: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# <A# #6BCDCED;F<GA<;#H/*,-*#3,/>(%*+,-*#6IG<:;;D1<J;A4.%-K# # # ����L����L" M��L�N��� ����L�������O���L�����P����O�����O��O��Q�R#S?)#>&/T?,-/0#&)T&)*)(+/+,%(#/(.#3)@,-)#%@)&@,)U#U,(.%U#*?%U#+?)#%T)&/+,(>#*+/+)*#%V#+?)#@/&,%'*#7%.'0)*W#BXY#%&#-%77'(,-/+,%(#T&%-)**%&*#ZBX*[#'*,(>#+?)#V%00%U,(>#*\7]%0*4#�" M��� �������# S?)#-%(()-+,%(#+%#/#BXY#,*#-'&&)(+0\#]),(>#)*+/]0,*?).4## S?)#BXY#,*#(%+#/--)**,]0)#/+#+?)#-%(V,>'&).#/..&)**4## S?)#+\T)#%V#BXY#-%(V,>'&).#/(.#+\T)#%V#BXY#/-+'/00\#T&)*)(+#/&)#,(-%7T/+,]0)4## (#)*+/]0,*?7)(+#%V#+?)#%(0,()#-%(()-+,%(#+%#/#T&%+)-+).#BXYW#+?)#T/**U%&.#.,/0%>#U/*#+)&7,(/+).#U,+?%'+#)(+&\#%V#+?)#-%&&)-+#T/**U%&.4## E%#V/'0+## _/,(+)(/(-)#&)',&).## _/,(+)(/(-)#.)7/(.).## $/'0+## S?)#7%.'0)#%&#.)@,-)#,*#.)/-+,@/+).4## S?)#7%.'0)#%&#.)@,-)#-/((%+#])#/--)**).#V&%7#+?)#BXY#Z@/0,.#V%&#7%.'0)*#/(.#.)@,-)*#])0%U#/#BXY[4## 3,/>(%*+,-#./+/#,*#(%+#/@/,0/]0)#])-/'*)#+?)#-'&&)(+#%(0,()#-%(V,>'&/+,%(#./+/#.,VV)&*#V&%7#+?)#%VV0,()#-%(V,>'&/+,%(#./+/4## S?)#-%(V,>'&).#7%.'0)#%&#.)@,-)#/(.#+?)#7%.'0)#%&#.)@,-)#/-+'/00\#T&)*)(+#/&)#,(-%7T/+,]0)#Z@/0,.#V%&#7%.'0)*#%&#.)@,-)*#])0%U#/#BXY[4## S?)#-%(V,>'&).#7%.'0)#.%)*#(%+#*'TT%&+#.,*T0/\#%V#+?)#.,/>(%*+,-#*+/+'*#Z@/0,.#V%&#7%.'0)*#])0%U#/#BXY[4## S?)#-%(()-+,%(#?/*#]))(#)*+/]0,*?).W#]'+#+?)#*+/+)#%V#+?)#7%.'0)#,*#-'&&)(+0\#*+,00#]),(>#.)+)&7,().4## S?)#-%(V,>'&).#7%.'0)#.%)*#(%+#*'TT%&+#.,*T0/\#%V#+?)#.,/>(%*+,-#*+/+'*4## C&&%&#,(#0%U)&G0)@)0#-%7T%()(+a#8#V/'0+#,*#T&)*)(+#,(#/+#0)/*+#%()#0%U)&G0)@)0#?/&.U/&)#-%7T%()(+4#�������������N�b���L�������P��������M��L��R#S?)#*+/+'*#%V#T%&+*#/(.#C+?)&()+#-/]0)*#-/(#])#.,/>(%*).#,(#+?)#()+U%&c#@,)U#/(.#+%T%0%>\#@,)U4#R#S?)#V%00%U,(>#+/]0)#*?%U*#+?)#T%**,]0)#-%0%&*#/(.#+?),&#&)*T)-+,@)#7)/(,(>4#������ �������# E%#V/'0+#%&#7/,(+)(/(-)#&)',&).## _/,(+)(/(-)#.)7/(.).## B%77'(,-/+,%(#)&&%&###

Page 148: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# <A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6JG<:;;D1<A;H4.%-K# # #=4H#L������M������N���N�O������������P������������Q#3%'R0)G-0,-S#TU(0,()#2#.,/>(%*+,-*T#,(#V&%W)-+#+&))4#XQ#U(0,()#2#.,/>(%*+,-*Y#Q#8#BZ[#%V)&/+,(>#V/()0\#+?)#-]-0)#+,7)#/(.#+?)#7)7%&]#'+,0,/+,%(#/&)#.,*V0/]).#,(#+?)#%(0,()#+%%0*#/+#+?)#&,>?+4#6_,+-?#+?)#BZ[#+%#1[E#?)&)4#XQ#1[EY# ##

Page 149: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# <=# #6ABCBDC;E<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;C1<J;G4.%-K# # #L#M?)#N%&O,(>#/&)/#N,(.%N#-%(+/,(*#>)()&/0#,(P%&7/+,%(#/Q%'+#+?)#ARS4#TL#9)()&/0U# ##L#VP#.,/>(%*+,-#,(P%&7/+,%(#,*#/@/,0/Q0)W#,+#,*#.,*X0/Y).#,(#3,/>(%*+,-#*+/+'*4##TL#3,/>(%*+,-#*+/+'*U# #

Page 150: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# <A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6AG<:;;D1<J;H4.%-K# # #L#3)+/,0).#M(N%&7/+,%(#%(#+?)#,(.,@,.'/0#)@)(+*#,*#.,*O0/P).#,(#3,/>(%*+,-*#Q'NN)&4##RL#3,/>(%*+,-*#Q'NN)&S# #L#E)K+#P%'#&)-),@)#,(N%&7/+,%(#/Q%'+#+?)#-P-0)#+,7)#%N#+?)#)K)-'+).#O&%>&/74##RL#BP-0)#+,7)S# ##

Page 151: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# <A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6JG<:;;D1<K;H4.%-L# # #M#N?)#7)7%&O#'+,0,P/+,%(#-/(#Q)#*))(#?)&)#,(#.)+/,0#RM#S)7%&OT# ##M#N?)#()+U%&V#*)++,(>*#/(.#+?)#*+/+'*#%W#+?)#X1Y$ZECN#,(+)&W/-)#[\<]#-/(#/0*%#Q)#.,*0/O).4#RM#X1Y$ZECN#,(+)&W/-)#[\<]T## #

Page 152: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# <A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6JG<:;;D1<K;H4.%-L# # #M#N(.)&#$'(-+,%(*O#P8**,>(#QR#/..&)**PO#S%'#-/(#/**,>(#+?)#QR#/..&)**#+%#/#-%(+&%00)&4#T%U)@)&O#+?,*#,*#%(0S#V%**,W0)#U?)(#(%#?/&.U/&)#?/*#S)+#W))(#.%U(0%/.).#+%#+?)#BRN4##XM#$'(-+,%(*#M#8**,>(#QR#/..&)**Y# ##M#N(.)&#P6)+#+,7)PO#S%'#-/(#*)+#+?)#+,7)#%Z#+?)#BRN4##XM#$'(-+,%(*#M#6)+#+,7)Y# ##

Page 153: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# :;# #6ABCBDC;E<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;C1<J;G4.%-K# # #L#M(.)&#N$,&7O/&)#'P./+)NQ#R%'#-/(#'P./+)#+?)#S,&7O/&)#%S#+?)#TUA4##VL#$'(-+,%(*#L#$,&7O/&)#'P./+)W# #

Page 154: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# :<# #6ABCBDC;E<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;C1<J;G4.%-K# # #L#M(.)&#N8**,>(#(/7)NO#P%'#-/(#/**,>(#/#Q1R$SDBT#.)@,-)#(/7)#+%#+?)#-%(U,>'&).#U,)0.#.)@,-)*#%(#Q1R$SDBT4#T?)#.)@,-)#(/7)#%U#+?)#AQM#-/((%+#V)#-?/(>).#?)&)4#S+#-/(#%(0P#V)#-?/(>).#VP#.%W(0%/.,(>#/#7%.,U,).#?/&.W/&)#-%(U,>'&/+,%(4#XL#$'(-+,%(*#L#8**,>(#(/7)Y# #L#M(.)&#N1)*)+#+%#U/-+%&P#*)++,(>*NO#P%'#-/(#&)*+%&)#+?)#U/-+%&P#*)++,(>*#%U#+?)#AQM4##XL$'(-+,%(*#L#1)*)+#+%#U/-+%&P#*)++,(>*#L#1)+/,(#%&#.)0)+)#SQ#/..&)**#L#1)*)+Y# #

Page 155: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# ::# #6ABCBDC;E<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;C1<J;G4.%-K# # #L#M?)#%(0,()#-%(()-+,%(#*?%'0.#N)#.,*-%(()-+).#/>/,(#N)O%&)#+?)#()K+#-?/P+)&4##QL#R(0,()#/--)**#L#9%#%OO0,()S# ##L#M?)#MT8#U%&+/0#,*#(%V#N/-W#,(#%OO0,()#7%.)4#M?)#%&/(>)F-%0%&).#N/&*#/(.#+?)#.,/>(%*+,-#*X7N%0*#/&)#(%#0%(>)&#.,*P0/X).4#

Page 156: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# :A# #6BCDCED;A<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;D1<J;G4.%-K# # #=4J#L�������MM������� N���O���P#Q+#,*#%R+)(#,7S%&+/(+#+%#T(%U#U?)+?)&#+?)#*/@).#./+/#7/+-?)*#+?)#./+/#0%/.).#,(#+?)#-%(+&%00)&4#$,&*+V#&)7%@)#+?)#()>/+,%(#R&%7#+?)#W6/R)+XD*?'+%RRD/-+,@)W#+/>#/+#+?)#8E3#R'(-+,%(#,(#+?)#WYZ[Z1DY8E\8]#$B<_#0%-T4#[?)(#*/@)#+?)#WYZ[Z1DY8E\8]#$B<_W#0%-TV#'+#.%#aL�#.%U(0%/.#,+#+%#+?)#-%(+&%00)&4#B0%*)#+?)#WYZ[Z1DY8E\8]#$B<_#0%-T#/>/,(4#P#[%#-%7S/&)V#&,>?+F-0,-T#+?)#Wb]BD<W#-%(+&%00)&#/(.#*)0)-+#WB%7S/&)WV#WZRR0,()c%(0,()W4##dP#6)0)-+#-%(+&%00)&#P#B%7S/&)#P#ZRR0,()c%(0,()e# ##P#[?)#B%7S/&)#).,+%&#%(0,()#%S)(*4# #

Page 157: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# :A# #6BCDCED;F<GA<;#H/*,-*#3,/>(%*+,-*#6IG<:;;D1<J;A4.%-K# # #L#MNO#N%&#)K/7P0)O#Q0%-R#.,NN)&)(-)*#/&)#,(.,-/+).# O#N,&*+#*)0)-+#+?)#Q0%-R#,(@%0@).4#S%'#-/(#+?)(#-0,-R#+?)# #Q'++%(#+%#T6+/&+#.)+/,0).#-%7P/&,*%(T4##UL#VWXW1DV8EY8Z#L#6+/&+#.)+/,0).#-%7P/&,*%([4# ##L#X?)#*)0)-+).#%NN0,()\%(0,()#Q0%-R#],00#Q)#-%7P/&).#,(#+?)#-%.)#Q0%-R#-%7P/&,*%(4#8#.)+/,0).#.)*-&,P+,%(#%N#+?)#.,NN)&)(-)#,*#*?%](#,(#+?)#-%7P/&,*%(#&)*'0+4# ##L#B0%*)#+?)#],(.%]#%N#+?)#-%.)#Q0%-R#-%7P/&,*%(4#

Page 158: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# :A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6JG<:;;D1<A;H4.%-K# # #L#8(#/-+,%(#-/(#M)#*)0)-+).#N%&#+?)#M0%-O#,(@%0@).#,(#+?)#B%7P/&)#).,+%&4#C,+?)&#+?)#QRSTS1DR8EU8VQ#M0%-O#W,00#M)#.%W(0%/.).#N&%7#+?)#P&%>&/77,(>#.)@,-)#+%#+?)#-%(+&%00)&#/(.#%@)&W&,++)(#+?)&)#%&#+?)#QRSTS1DR8EU8VQ#M0%-O#W,00#M)#&)/.#,(#N&%7#+?)#-%(+&%00)&#/(.#%@)&W&,++)(#,(#+?)#TX8#Y%&+/04#6)0)-+#+?)#QUP0%/.#N&%7#.)@,-)Q#/-+,%(#Z[\] _ab\cde\bfghifjk# #L#B0,-O#+?)#QCK)-'+)#/-+,%(*Q#M'++%(# #ZL#CK)-'+)#/-+,%(*l# #L#B%(N,&7#QUP0%/.#N&%7#.)@,-)Q#ZL#UP0%/.#N&%7#.)@,-)l4# #L#8N+)&#+?)#'P0%/.m#+?)&)#/&)#(%#7%&)#.,NN)&)(-)*4#n%'#*?%'0.#(%W#*/@)#o%'&#P&%p)-+#/>/,(#/(.#-0%*)#+?)#%(0,()#-%(()-+,%(4#

Page 159: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# :=# #6ABCBDC;E<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;C1<J;G4.%-K# # #=4=#������������ ���L"���M�N#O%#7%(,+%&#/(.#7%.,PQ#+/>*R#Q%'#()).#/#S/+-?#+/T0)4#3%'T0)F-0,-U#V8..#()S#S/+-?#+/T0)V#,(#+?)#W&%X)-+#+&))4#YN#8..#()S#S/+-?#+/T0)Z4# #N#[W)(#+?)#()S0Q#-&)/+).#V\/+-?#+/T0)C<V#TQ#.%'T0)F-0,-U,(>#,+#YN#V\/+-?#+/T0)C<VZ4#]%'#-/(#)(+)&#,(.,@,.'/0#+/>*#,(#+?)#+/T0)#%&#Q%'#-/(#*)0)-+#+?)#VO/>C+/T0)C*%&+,(>C*+/+,%(V#/(.#+?)(#*)0)-+#+?)#+/>*#+%#T)#7%(,+%&).#/(.#.&/>#+?)7#P&%7#+?)#3)+/,0*#@,)S#+%#+?)#S/+-?#+/T0)#YN#O/>C+/T0)C*%&+,(>C*+/+,%(Z4# #

Page 160: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# :A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6AG<:;;D1<J;H4.%-K# # #L#M%#?/@)#/00#7%(,+%&,(>#/(.#7%.,NO,(>#N'(-+,%(*#/@/,0/P0)#N%&#*)0)-+,%(Q#+?)#N%00%R,(>#-%0'7(*#-/(#P)#.,*S0/O).T##UVWWXYZ[\]X_ZWYabcX #da[XUVWWXefgda[e[XYZ[eX_ZWYabcX 4##B%(+,(')#PO#*)0)-+,(>#+?)#+&,>>)&#+,7,(>#N%&#+?)#7%(,+%&,(>#hL#i)&7/()(+j4# ##�k��l����m��� ������������� ���l"��� ���n������o����p��q�r# i)&7/()(+#h,(#+?,*#7%.)Q#+?)#,(S'+*#/&)#7%(,+%&).s7%.,N,).#/+#+?)#*+/&+#%N#+?)#-O-0)#/(.#+?)#%'+S'+*#/+#+?)#)(.4j#r# t(-)#%(0OQ#/+#*+/&+#%N#*-/(#-O-0)#r# t(-)#%(0OQ#/+#)(.#%N#*-/(#-O-0)#r# i)&7/()(+0OQ#/+#*+/&+#%N#*-/(#-O-0)#r# i)&7/()(+0OQ#/+#)(.#%N#*-/(#-O-0)#r# t(-)#%(0OQ#/+#+&/(*,+,%(#+%#6Mti#r# i)&7/()(+0OQ#/+#+&/(*,+,%(#+%#6Mti## #i&%-)**#,7/>)#%N#+?)#,(S'+*#tI#<# u8+#*+/&+#%N#*-/(#-O-0)u#+&,>>)&#S%,(+#i&%-)**#,7/>)#%N#+?)#%'+S'+*#u8+#)(.#%N#*-/(#-O-0)u#+&,>>)&#S%,(+#u8+#+&/(*,+,%(#+%#6Mtiu#+&,>>)&#S%,(+#

Page 161: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# :A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6JG<:;;D1<K;H4.%-L# # #M#E)L+N#-0,-O#PQ%(,+%&#/00#@/0')*#%(-)#/(.#(%RP# #%&#PQ%(,+%&#/00#@/0')*#/--%&.,(>#+%#+&,>>)&#*)++,(>*P# #SM# #Q%(,+%&#/00T4# #M#U%#7%.,VW#+/>*N#)(+)&#+?)#.)*,&).#PQ%.,VW#@/0')*P4#U?)(N#-0,-O# #+%#PQ%.,VW#/00#/-+,@/+).#@/0')*#%(-)#/(.#(%RP#%&# #+%#P800#/-+,@)#@/0')*#R,00#X)#7%.,V,).#XW#7%.,VW#R,+?#+&,>>)&P4#S#M#U1YC#M# #P800#/-+,@)#@/0')*#R,00#X)#7%.,V,).#XW#7%.,VW#R,+?#+&,>>)&PT## #M#B%(V,&7#+?)#R/&(,(>#R,+?#Z[�\Z#SM#])*T4###M#U?)#%'+'+#X)-%7)*#/-+,@)#)@)(#+?%'>?#+?)#&%>&/77).#-%(.,+,%(*#/&)#(%+#7)+4# #_ abcdefghijgklhmighlnojgpqgmorqjsgrtghijgmruujmhprughrghijgvwxgpqgorqhygloogzrspf{gmrzzlusqgltjgu|oopfpjs}g

Page 162: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# :A# #6BCDCED;F<GH<;#I/*,-*#3,/>(%*+,-*#6JG<:;;D1<K;H4.%-L# # #=4J#!�������M�N#O?)#P$%&-)P#Q'(-+,%(#-/(#R)#'*).#+%#/**,>(#/#Q,L).#@/0')#+%#+/>*4#$%&-)#@/0')*#/&)#*S)-,Q,).#,(#/#*,7,0/&#T/U#/*#Q%&#+?)#PV%.,QU#+/>*P#Q'(-+,%(#R'+W#,(#-%(+&/*+W#/&)#&)+/,().#/Q+)&#+?)#BXY#,*#*T,+-?).#%QQ#%&#*+%SS).4#O?)#PV%.,QU#+/>*P#/(.#P$%&-)P#Q'(-+,%(*#)**)(+,/00U#.,QQ)&#/*#Q%00%T*Z#[(#-%(+&/*+#+%#PV%.,QU#+/>*PW#,+#,*#(%+#S%**,R0)#+%#/**,>(#@/0')*#+%#./+/#R0%-\*W#+,7)&*W#-%'(+)&*#/(.#R,+#7)7%&U#T,+?#+?)#P$%&-)P#Q'(-+,%(4#[]#.)@,-)#,(S'+*#_)4>4W#[LLZXa#-/((%+#R)#7%.,Q,).#R'+#-/(#R)#S&)G/**,>().#RU#+?)#P$%&-)P#Q'(-+,%(4#Y(0,\)#T,+?#+?)#PV%.,QUP#Q'(-+,%(W#@/0')*#S)&7/()(+0U#/**,>().#RU#+?)#P$%&-)P#Q'(-+,%(#-/((%+#R)#%@)&T&,++)(#RU#+?)#'*)&#S&%>&/74#[Q#U%'#-0%*)#+?)#Q%&-)#+/R0)W#+?)#Q%&-)#@/0')*#/&)#&)+/,().4#O?,*#,*#(%+#+?)#-/*)#T,+?#+?)#PV%.,QUP#Q'(-+,%(4#[Q#+?)#%(0,()#-%(()-+,%(#+%#+?)#BXY#,*#,(+)&&'S+).W#+?)#+/>*#/**,>().#T,+?#+?)#P$%&-)P#Q'(-+,%(#&)+/,(#+?),&#@/0')4##O%#Q%&-)#+/>*W#U%'#7'*+#Q,&*+#.%'R0)G-0,-\#+?)#Q%&-)#+/R0)#+%#%S)(#,+4#_N#$%&-)#+/R0)a# #

Page 163: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# A;# #6BCDCED;A<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;D1<J;G4.%-K# # #L#6)0)-+#+?)#MN<M#%O)&/(.#P,+?#/..&)**#QN;4;#R&%7#+?)#0,*+4#SL#N<T# #L#U,+?#R%&-,(>V#+?)#%O)&/(.*#/&)#)(+)&).#P,+?#.,&)-+#WXY#/--)**#SQN;4;Z[T4# #L#C(+)&#+?)#.)*,&).#R%&-)#@/0')#/(.#/-+,@/+)#,+# 4##B0,-\#M6+/&+#%&#&)O0/-)#R%&-,(>M# 4#]?)#()P#R%&-)#&)')*+#P,00#_)#+&/(*R)&&).#+%#+?)#B[ 4##SL#QN;4;Z[#L#]1 C#L# #L# #6+/&+#%&#&)O0/-)#R%&-,(>T# #L#B%(R,&7#+?)#P/&(,(>#P,+?#ab�ca#SL#d)*T4# #

Page 164: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# A<# #6BCDCED;A<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;D1<J;G4.%-K# # #L#$%&-,(>#,*#/-+,@/+).#/(.#+?)#M)00%N#���O��P� #%(#+?)#BQR#0,>?+*#'S4#T(#/..,+,%(U#/(#!�%(#/#&).#V/-W>&%'(.#,*#*?%N(#/+#+?)#+%S#&,>?+#%X#+?)#.,*S0/M#%X#+?)#6IF<:;;4# #YZ[\]_abcdaefbgcabfhidajkagilkdmalnabcdagloodgbjloablabcdapqrajkailkbsatZuvwxyu\z{wx|{v[w}\afomabcda~diilea��������aloabcdarp�aglobjo�dkablahdaijb�aL#�������������������������������������������� #6+%S#X%&-,(> #/(.#-%(X,&7#+?)#()K+#.,/0%>#N,+?# ¡)* 4##¢L# #6+%S#X%&-,(>£#¤¥�¦§#¢L#¡)*£# #$%&-,(>#,*#*+%SS).#/(.#+?)#M)00%N#���O��P� #%(#+?)#BQR#*N,+-?)*#%XX4#L#TX#/#X%&-)#&)')*+#/0&)/.M#)K,*+*#,(#+?)#-%(+&%00)&U#+?,*#,*#,(.,-/+).#VM#+?)# #*M7V%0#,(#+?)#N/+-?#+/V0)4#TX#M%'#+?)(#-0,-W# U#/..,+,%(/0#,(X%&7/+,%(#N,00#V)#.,*S0/M).#¢L# £4# ##

Page 165: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# A:# #6BCDCED;A<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;D1<J;G4.%-K# # #L#MN#/#N%&-)#&)O')*+#/0&)/.P#)K,*+*#,(#+?)#-%(+&%00)&Q#,+#-/(#/0*%#R)#.,*S0/P).#/(.#*+%SS).#@,/#+?)#%(0,()#.)@,-)#@,)T4#U%#.%#+?,*Q#P%'#7'*+#&,>?+F-0,-V#+?)#BWX#,(#%(0,()#7%.)#%N#+?)#.)@,-)#@,)T#/(.#*)0)-+#YXS./+)#/(.#.,*S0/P#N%&-).#%S)&/(.*Y4#ZL#&,>?+F-0,-V#+?)#BWX#L#XS./+)#/(.#.,*S0/P#N%&-).#%S)&/(.*Y[# #L#U?)#N%&-)#+/R0)#T,+?#+?)#-'&&)(+#N%&-)#&)O')*+*#T,00#(%T#R)#.,*S0/P).#/(.#P%'#-/(#*+%S#+?)*)4#ZL# 6+%S#N%&-,(>[# #

Page 166: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# AA# #6BCDCED;A<FG<;#H/*,-*#3,/>(%*+,-*#6IF<:;;D1<J;G4.%-K# # #=4L#�M��N��O��# P�Q� �O���R����� �� R������<# S&%T)-+#;A<F<;;D$BFUVWXVYZZ[\X] _aab__cdde&)+&,)@).4# #:# BSf#<:<GB#g&%7#h&%T)-+#;A<F<;;D$BFiVWXVYZZ[\X]^*'--)**g'00j#.%k(0%/.).4# #A# BSf#<:<GB#-%(()-+).#%(0,()4# #G# 6+/+'*#%g#+?)#BSf#<:<GB#-?)-l).#k,+?#m(0,()#2#3,/>(%*+,-*4# #J# mgg0,()n%(0,()#-%7h/&,*%(#%g#o0%-l*#,(#+?)#BSf#<:<GB#h)&g%&7).4# #=# p/+-?#+/o0)D<#-&)/+).4# #I# q/>*#rF6;#n#F6A#n#Fs;#n#FH<#n#F6G#n#F8<#n#Ft<u#)(+)&).#,(#k/+-?#+/o0)4# #L# 6k,+-?#%(#-%(@)j%&#7%+%&#g%&k/&.#oj#7%.,gj,(>#+?)#%'+h'+#rFt<#v#<u#,(#k/+-?#+/o0)4# #w# 6k,+-?#%gg#-%(@)j%&#7%+%&#g%&k/&.#oj#7%.,gj,(>#+?)#%'+h'+#rFt<#v#;u#,(#k/+-?#+/o0)4# #<;# mh)(#g%&-)#+/o0)# #<<# q/>#rFt<xSu#)(+)&).#,(#g%&-)#+/o0)4# #<:# 6k,+-?#%(#-%(@)j%&#7%+%&#g%&k/&.#oj#g%&-,(>#+?)#%'+h'+##rFt<#v#<u#,(#g%&-)#+/o0)4# #<A# $%&-)#%'+h'+#Ft<#+%#*k,+-?#%gg#/>/,(4# ##

Page 167: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# AB# #6CDEDFE;A<GB<;#H/*,-*#3,/>(%*+,-*#6IG<:;;E1<J;B4.%-K# # #L��M����N��I4<#��NO�P��M����N�#�Q(#+?,*#)K)&-,*)R#+?)#STUT1E8VUT#W$H<X#Y'(-+,%(#Z0%-[#Y&%7#-?/\+)&#6CDEDFE;A<G:;;E$HG]&%>&/77,(>#,*#+%#Z)#+)*+).4#U?)#-?/00)(>)#?)&)#,*#+?/+#+?)#-0,(.)&#,*#,(#+?)#Y&%(+#)(.#\%*,+,%(#/(.#+?'*#+?)#)(/Z0)#-%(.,+,%(*#Y%&#*_,+-?,(>#%(#+?)#-%(@)%&#/&)#(%+#7)+4#V*,(>#/#_/+-?#+/Z0)R#+?)#-0,(.)&#,*#+%#Z)#7%@).#+%#,+*#&)/&#)(.#\%*,+,%(#*%#+?/+#+?)#)(/Z0)#-%(.,+,%(*#Y%&#+?)#STUT1E8VUT#W$H<X#Z0%-[#/&)#7)+4##I4:#��������]0/(#+?)#,7\0)7)(+/+,%(#%Y#+?)#+/*[#,(.)\)(.)(+0#'*,(>#+?)#*+)\GZG,(*+&'-+,%(*#/*#/(#/,.4##I4A#� ��O��N��P��M����N��# a�b� �N���c����� �� c������<# ]&%d)-+#;A<G:;;E$HGefghfijjklhmnopqqroospttunfrvfkrwrxy# #:# C]V#<:<BC#Y&%7#\&%d)-+#;A<G:;;E$HGefghfijjklhmnopqqroospttun.%_(0%/.).4# #A# z/+-?#+/Z0)#-&)/+).#/(.#&)(/7).#/*#{z/+-?E+/Z0)E-0,(.)&{4# #B# U/>*#|GH<#}#GH:#}#GS:~#)(+)&).#,(#_/+-?#+/Z0)4# #J# 1)+&/-+#-0,(.)&#Z#7%.,Y,(>#+?)#%'+\'+#|GS:#�#<~#,(#_/+-?#+/Z0)4# #=# C0,(.)&#&)+&/-+).#|GH<#�#<~# #I# 1)*)+#%'+\'+#Y%&#1)+&/-+#-0,(.)&#,(#_/+-?#+/Z0)#/>/,(#|�S:#�#;~4# ##

Page 168: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#&,>?+*#&)*)&@).4# AB# #6CDEDFE;A<GH<;#I/*,-*#3,/>(%*+,-*#6JG<:;;E1<B;H4.%-K# # #L��������������M�� ������N%'#-/(#O,(.#/..,+,%(/0#,(O%&7/+,%(#/*#/(#%&,)(+/+,%(#/,.#O%&#,(,+,/0#/(.#/.@/(-).#+&/,(,(>P#O%&#)K/7Q0)R#9)++,(>#6+/&+).P#@,.)%*P#+'+%&,/0*P#/QQ*P#7/('/0*P#Q&%>&/77,(>#>',.)0,()*#/(.#+&,/0#*%O+S/&)TO,&7S/&)P#/+#+?)#O%00%S,(>#0,(UR###SSS4*,)7)(*4-%7T*-)T*JG<:;;###

Page 169: SCE-Basic Programming S7-1200 (2016)

����������������������������� ��������������������������������������� ����������������� ��������� �������������� !��"���� �#��� ���$�%&�������������������'�(�)����!#� !*��+%�����,-./01234345/-611376869:/�����������������*��;�������)���<�������=>��?�����

Page 170: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :# #6ABCBDC;E<FG:;#3,/>(%*+,-*#@,/#H)I*)&@)&#6JF<:;;C1<K;L4.%-M# # #����N���������������O��P��Q�R����N�Q���������������� Q�S#���������T��������� ��U�V�W�XQ����R��Y�Z����������Z#[&.)&#(%4\#=B6J:<GF<]BE;FG8]E#S#���������T������ �� �� ��XQ����R��Y�Z����������Z#[&.)&#(%4\#=B6J:<GF<8BE;FG8]E#S#O������������������T�_������������XR����T�����Y�XQ����R��Y�Z����������Z#[&.)&#(%4\#=B6JL::F;88;EFGaBK���b0)/*)#(%+)#+?/+#+?)*)#+&/,()&#c/-d/>)*#/&)#&)c0/-).#e,+?#*'--)**%&#c/-d/>)*#e?)(#()-)**/&f4#8(#%@)&@,)e#%g#+?)#-'&&)(+0f#/@/,0/I0)#6AB#c/-d/>)*#,*#c&%@,.).#/+\#*,)7)(*4-%7h*-)h+c####�����������������$%&#&)>,%(/0#6,)7)(*#6AB#-%(+,(').#+&/,(,(>i#c0)/*)#-%(+/-+#f%'&#&)>,%(/0#6AB#-%(+/-+#*,)7)(*4-%7h*-)h-%(+/-+###�������������R�� �������������������*,)7)(*4-%7h*-)###��R�� ��������������Q��j?)#6AB#+&/,(,(>#-'&&,-'0'7#g%&#+?)#,(+)>&/+).#/'+%7/+,%(#*%0'+,%(#j%+/00f#k(+)>&/+).#8'+%7/+,%(#ljk8m#e/*#c&)c/&).#g%&#+?)#c&%>&/7#n6,)7)(*#8'+%7/+,%(#A%%c)&/+)*#e,+?#B.'-/+,%(#l6ABmn#*c)-,g,-/00f#g%&#+&/,(,(>#c'&c%*)*#g%&#c'I0,-#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#6,)7)(*#89#.%)*#(%+#>'/&/(+))#+?)#-%(+)(+*4##j?,*#.%-'7)(+#,*#+%#I)#'*).#%(0f#g%&#,(,+,/0#+&/,(,(>#%(#6,)7)(*#c&%.'-+*h*f*+)7*4#j?,*#7)/(*#,+#-/(#I)#-%c,).#,(#e?%0)#%&#c/&+#/(.#>,@)(#+%#+?%*)#I),(>#+&/,().#g%&#'*)#e,+?,(#+?)#*-%c)#%g#+?),&#+&/,(,(>4#A,&-'0/+,%(#%&#-%cf,(>#+?,*#+&/,(,(>#-'&&,-'0'7#/(.#*?/&,(>#,+*#-%(+)(+#,*#c)&7,++).#e,+?,(#c'I0,-#+&/,(,(>#/(.#/.@/(-).#+&/,(,(>#g/-,0,+,)*#g%&#+&/,(,(>#c'&c%*)*4###BM-)c+,%(*#&)o',&)#e&,++)(#-%(*)(+#g&%7#+?)#6,)7)(*#89#-%(+/-+\#1%0/(.#6-?)')&)&#&%0/(.4*-?)')&)&p*,)7)(*4-%74##[gg)(.)&*#e,00#I)#?)0.#0,/I0)4#800#&,>?+*#,(-0'.,(>#+&/(*0/+,%(#/&)#&)*)&@).i#c/&+,-'0/&0f#,g#/#c/+)(+#,*#>&/(+).#%&#/#'+,0,+f#7%.)0#%&#.)*,>(#,*#&)>,*+)&).4##q*)#g%&#,(.'*+&,/0#-'*+%7)&#-%'&*)*#,*#)Mc&)**0f#c&%?,I,+).4#H)#.%#(%+#-%(*)(+#+%#-%77)&-,/0#'*)#%g#+?)#+&/,(,(>#-'&&,-'0'7*4##H)#e,*?#+%#+?/(d#+?)#jq#3&)*.)(i#)*c)-,/00f#b&%g4#3&4Fk(>4#r)%(#q&I/*#'(.#3,c04Fk(>4#8(()++#bg)gg)&i#+?)#s,-?/)0#3t,/00/*#B(>,())&,(>#A%&c%&/+,%(#/(.#/00#%+?)&#,(@%0@).#c)&*%(*#g%&#+?),&#*'cc%&+#.'&,(>#+?)#c&)c/&/+,%(#%g#+?,*#+&/,(,(>#-'&&,-'0'74#

Page 171: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A# #6BCDCED;A<FG:;#3,/>(%*+,-*#@,/#H)I*)&@)&#6JF<:;;D1<K;L4.%-M# # #N/I0)#%O#-%(+)(+*�#<P 9%/0#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#GQ:P R&)&)S',*,+)#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#GQAP N?)%&T#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#GQA4<P 3,/>(%*+,-*#@,/#U)I#*)&@)&#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#GPGP N/*V#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#=QKP R0/((,(>#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#=Q=P 6+&'-+'&).#*+)WFITF*+)W#,(*+&'-+,%(*#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#JQ=4<P 1)+&,)@)#/(#)M,*+,(>#W&%X)-+#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#JP=4:P B%(O,>'&)#+?)#U)I#*)&@)&#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#LP=4AP 6/@)#W&%X)-+#/(.#.%U(0%/.#BRY#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<:P=4GP 3,/>(%*+,-*#O%&#+?)#6JF<:;;#@,/#+?)#U)I#444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<AP=4KP B?)-V0,*+#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<LPJP 8..,+,%(/0#,(O%&7/+,%(#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<ZQ## # #

Page 172: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A# #6BCDCED;F<GA:;#3,/>(%*+,-*#@,/#H)I*)&@)&#6JG<:;;D1<K;L4.%-M# # #3N89EO6PNB6#QN8#HCR#6C1QC1#��S����N(#+?,*#7%.'0)T#+?)#&)/.)&#U,00#I)-%7)#/-V'/,(+).#U,+?#+?)#-%(+)(+*#+?/+#-/(#I)#.,*W0/X).#@,/#+?)#U)I#*)&@)&#%Y#+?)#BZ[#<:<AB4##P?,*#7%.'0)#U,00#W&)*)(+#+?)#.,/>(%*+,-#Y'(-+,%(*#,(#+?)#U)I#*)&@)&#+?/+T#Y%&#)M/7W0)T#X%'#-/(#+)*+#U,+?#+?)#PN8#W&%\)-+#Y&%7#+?)#6BCDCED;F<GA<;DR/*,-*#3,/>(%*+,-*#U,+?#6N]8PNB#6JG<:;;#7%.'0)4##��������_����P?,*#-?/W+)&#I',0.*#%(#+?)#?/&.U/&)#-%(Y,>'&/+,%(#%Y#+?)#6N]8PNB#6J#BZ[<:<AB#3B3B3B4#a%U)@)&T#%+?)&#?/&.U/&)#-%(Y,>'&/+,%(*#-/(#I)#'*).4#b%'#-/(#'*)#+?)#Y%00%U,(>#W&%\)-+#Y%&#+?,*#-?/W+)&T#Y%&#)M/7W0)c#6BCDCED;F<GA<;DR/*,-*D3,/>(%*+,-*D6JG<:;;4d/W<F#���e���"��f�� ����_���_�g���h�i�_��g���P?)#U)I#*)&@)&#)(/I0)*#7%(,+%&,(>#/(.#/.7,(,*+)&,(>#%Y#+?)#BZ[#IX#/'+?%&,d).#'*)&*#%@)&#/#()+U%&j4##P?,*#W)&7,+*#)@/0'/+,%(#/(.#.,/>(%*+,-*#%@)&#0%(>#.,*+/(-)*4#]%(,+%&,(>#/(.#)@/0'/+,%(#,*#W%**,I0)#U,+?%'+#+?)#PN8#Z%&+/0k#/00#X%'#()).#,*#/#U)I#I&%U*)&4###P?)#U)I#*)&@)&#,*#.)/-+,@/+).#,(#+?)#.)0,@)&X#*+/+)#%Y#+?)#BZ[4#P?,*#7)/(*#+?/+#X%'#7'*+#0%/.#/#W&%\)-+#,(#U?,-?#+?)#U)I#*)&@)&#,*#/-+,@/+).#+%#)(/I0)#/--)**#'*,(>#+?)#U)I#I&%U*)&4###�e��h�i�_��g����ll��_��e��l����h���_�����"�l������_m�G#8--)**#@,/#*)-'&)#n?++W*n#+&/(*7,**,%(#W&%+%-%0#G#[*)&#/'+?%&,d/+,%(#IX#7)/(*#%Y#/#'*)&#0,*+#G#1)*+&,-+,%(#%Y#/--)**#Y&%7#-)&+/,(#,(+)&Y/-)*##

Page 173: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A# #6BCDCED;F<GH:;#3,/>(%*+,-*#@,/#I)J*)&@)&#6KG<:;;D1<A;L4.%-M# # #N%'#()).#/#O)J#J&%O*)&#+%#/--)**#+?)#PQRS#T/>)*#%U#+?)#BVW4#�X��Y����Z���Z�[�[��Z\��\�X�]��[������\����Y����� ���������Z��X��X���� _�G#(+)&()+#CMT0%&)&#ab)&*,%(#Lc#G#R%d,00/#$,&)U%M#ab)&*,%(#:<c#G#R%J,0)#6/U/&,#a,e6Ac## #$,>'&)#<f#I)J#*)&@)&#%U#+?)#BVW#<:<HB#3Bg3Bg3B#O,+?#R%.'0)#(U%&7/+,%(##hijklmnopqmrstqmuvoumwxsmytxuqzumuvqm{|}m~tx�m�o��ys�ou�x�mo��ms�osuvxt��q�mozzqrrmuvtxs�vmuvqmsrqmx~m��~~qtq�um�quvx�rm�q����m����u���m�qu�xtpmozzqrr�msr���m~�tq�o��r��mm� �

Page 174: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# =# #6ABCBDC;E<FG:;#3,/>(%*+,-*#@,/#H)I*)&@)&#6JF<:;;C1<K;L4.%-M# # #����NO�P?)#Q%00%R,(>#/.@/(-).#.,/>(%*+,-#Q'(-+,%(*#R,00#I)#*?%R(#/(.#+)*+).#,(#+?,*#-?/S+)&T#U#A%(Q,>'&/+,%(#%Q#+?)#R)I#*)&@)&#%Q#+?)#AVW#<:<GA#3AX3AX3A#U#3,*S0/Y#7)**/>)*#@,/#+?)#R)I#*)&@)&#%Q#+?)#AVW#<:<GA#3AX3AX3A#Z���������P?)#.,/>(%*+,-#Q'(-+,%(*#R,00#I)#S)&Q%&7).#'*,(>#/#Q,(,*?).#S&%[)-+#/*#/(#)M/7S0)4#8#S&%[)-+#,(#+?)#P\8#V%&+/0#+?/+#R/*#S&)@,%'*0Y#.%R(0%/.).#+%#+?)#-%(+&%00)&#*?%'0.#I)#%S)(#Q%&#+?,*4#\(#%'&#-/*)]#/Q+)&#*+/&+,(>#+?)#P\8#V%&+/0]#/#S&)@,%'*0Y#-&)/+).#S&%[)-+#R,00#I)#&)+&,)@).#Q&%7#+?)#/&-?,@)#/(.#.%R(0%/.).#+%#+?)#/**%-,/+).#-%(+&%00)&4#%'#-/(#+?)(#-%(Q,>'&)#+?)#R)I#*)&@)&#,(#+?)#P\8#V%&+/04##P%#.)7%(*+&/+)#+?)#.,*S0/Y#%Q#/(#)&&%&#,(#+?)#7%.'0)#,(Q%&7/+,%(]#+?)#-%(Q,>'&).#*,>(/0#I%/&.#8_#<M<:,+]#Q%&#)M/7S0)]#-/(#I)#&)7%@).4#������a#P?)#VbA#*?%'0.#I)#.,*-%(()-+).#Q&%7#+?)#*'SS0Y#@%0+/>)#I)Q%&)?/(.4##

Page 175: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A# #6BCDCED;F<GH:;#3,/>(%*+,-*#@,/#I)J*)&@)&#6AG<:;;D1<K;L4.%-M# # #�����������N��O�P"�N��O���N�������N�Q%'#-/(#R,(.#,(*+&'-+,%(*#%(#?%S#+%#-/&&T#%'+#U0/((,(>#J)0%S4#VR#T%'#/0&)/.T#?/@)#/#>%%.#'(.)&*+/(.,(>#%R#)@)&T+?,(>W#,+#S,00#J)#*'RR,-,)(+#+%#R%-'*#%(#+?)#('7J)&).#*+)U*4#X+?)&S,*)W#*,7U0T#R%00%S#+?)#.)+/,0).#*+)U*#,(#+?)#,(*+&'-+,%(*4#�Y��Z�����[������\�N����O��]����^#_)R%&)#S)#J)>,(#S,+?#.,/>(%*+,-*#@,/#+?)#S)J#*)&@)&W#S)#()).#/#U&%)-+#R&%7#+?)#6BCDCED;F<GH<;#_/*,-*#3,/>(%*+,-*#6AG<:;;#7%.'0)4##a)4>4W#6BCDCED;F<GH<;D_/*,-*#3,/>(%*+,-*D6AG<:;;D:4b/U<Fc##d%#&)+&,)@)#/(#)M,*+,(>#U&%)-+#+?/+#?/*#J))(#/&-?,@).W#T%'#7'*+#*)0)-+#+?)#&)0)@/(+#/&-?,@)#S,+?# e&%)-+# 1)+&,)@)#,(#+?)#U&%)-+#@,)S4##B%(R,&7#T%'&#*)0)-+,%(#S,+?#fXU)(f4##a #e&%)-+# #1)+&,)@)# #6)0)-+#/#4b/U#/&-?,@)# #XU)(c###^#d?)#()M+#*+)U#,*#+%#*)0)-+#+?)#+/&>)+#.,&)-+%&T#S?)&)#+?)#&)+&,)@).#U&%)-+#S,00#J)#*+%&).4#B%(R,&7#T%'&#*)0)-+,%(#S,+?#fXgf4##a #d/&>)+#.,&)-+%&T# #Xgc##

Page 176: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A# #6BCDCED;F<GH:;#3,/>(%*+,-*#@,/#I)J*)&@)&#6KG<:;;D1<L;A4.%-M# # #�N�����O�����P��Q�R�S��T���U#V%#-%(W,>'&)#+?)#X)J#*)&@)&Y#%Z)(#+?)#.)@,-)#-%(W,>'&/+,%(#%W#+?)#B[\#<:<HB#3B]3B]3B4#U#B[\D<:<HB#_B[\#<:<HB#3B]3B]3B#U#3)@,-)#-%(W,>'&/+,%(a##U#6)0)-+#+?)#B[\#/(.#-?%%*)#+?)#bI)J#*)&@)&b#7)('#,+)7#,(#+?)#Z&%Z)&+,)*4##U#B[\D<:<HB#U#[&%Z)&+,)*#U#I)J#*)&@)&a# #

Page 177: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A# #6BCDCED;F<GH:;#3,/>(%*+,-*#@,/#I)J*)&@)&#6KG<:;;D1<L;M4.%-N# # #O#8-+,@/+)#+?)#P)J#*)&@)&#%(#+?,*#7%.'0)#/(.#-%(Q,&7#+?)#*)-'&,+R#(%+)4##SO# #8-+,@/+)#P)J#*)&@)&#%(#+?,*#7%.'0)#O#TUV# #O#W)/@)#+?)#-?)-X#7/&X# #Q%&#YC(/J0)#/'+%7/+,-#'Z./+)Y[#/(.#*)0)-+#+?)#*)-'&,+R#*)++,(>*#%Q#+?)#YC@)&RJ%.RY#'*)&4#C(/J0)#+?,*#'*)&#+%#-/&&R#%'+#/00#Z%**,J0)#/-+,%(*#/(.#/--)Z+#R%'&#*)++,(>*4#SO# #O# V# #\]_abcdefghifhjkdfglmhnmfoejnpqjmfekmlkfrmlmfspnrftpuumlminfhenrdlpvhnpdikwfxrmkmfekmlkfnrmiflmyeplmfhfqhkksdltwf# #

Page 178: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <;# #6ABCBDC;E<FG:;#3,/>(%*+,-*#@,/#H)I*)&@)&#6JF<:;;C1<K;L4.%-M# # #N#8*#/#&)*'0+#%O#+?)*)#/'+?%&,P/+,%(*Q#+?)#RB@)&SI%.SR#'*)&#,*#(%T#/'+%7/+,-/00S#/**,>().#+?)#/--)**#0)@)0#R8.7,(,*+&/+,@)R4# ##N#U(#+?)#RH/+-?#+/I0)*R#7)('#,+)7Q#+?)#RH/+-?#+/I0)CAS0,(.)&R#-/(#(%T#I)#)(+)&).#,(#+?)#T)I#*)&@)&4##VNH/+-?#+/I0)CAS0,(.)&#N# W# ##

Page 179: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <<# #6ABCBDC;E<FG:;#3,/>(%*+,-*#@,/#H)I*)&@)&#6JF<:;;C1<K;L4.%-M# # #N#O?)#/--)**#?)&)#,*#&)/.PQ&,+)#/--)**4#RN#1)/.PH&,+)S# ##N#T*)&F.)U,().#Q)I#V/>)*#Q,00#(%+#I)#-&)/+).#?)&)4#H)#7'*+#)(/I0)#W1X$YDBO#,(+)&U/-)C<#U%&#/--)**#+%#+?)#Q)I#*)&@)&##RN#B(/I0).#Q)I#*)&@)&#/--)**#N# #W1X$YDBO#,(+)&U/-)C<S# ##

Page 180: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <:# #6ABCBDC;E<FG:;#3,/>(%*+,-*#@,/#H)I*)&@)&#6JF<:;;C1<K;L4.%-M# # #�N����O��P��Q����������R��������S�T#U%#*/@)#V%'&#W&%X)-+Y#-0,-Z#+?)# #I'++%(#,(#+?)#7)('4#U?)#-%7W0)+)#-%(+&%00)&#[,+?#+?)#7%.,\,).#-%(\,>'&/+,%(#*)++,(>*#,(#+?)#?/&.[/&)#-%(\,>'&/+,%(Y#/*#.)*-&,I).#,(#+?)#W&)@,%'*#7%.'0)*Y#-/(#I)#.%[(0%/.).4##]T# T# # #� #

Page 181: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A# #6BCDCED;A<FG:;#3,/>(%*+,-*#@,/#H)I*)&@)&#6JF<:;;D1<K;L4.%-M# # #�N�� ����O���O�P����Q���R������S����Q��T�U�V#W(#%&.)&#+%#/--)**#+?)#X)I#*)&@)&#%Y#+?)#BZ[#<:<GB#3B\3B\3B]#X)#%)(#/(_#X)I#I&%X*)&#%(#/#ZB#+?/+#,*#-%(()-+).#+%#+?)#BZ[#@,/#BZ\WZ4##V# ?)&)#X)#)(+)&#+?)#WZ#/..&)**#%Y#+?)#BZ[#<:<GB#3B\3B\3B4#aV#<b:4<=L4;4<c###V#d(#+?)#.,*0/_).#X)I#/>)]#X)#Y,&*+#*)0)-+#+?)#0/(>'/>)#/(.#+?)(#-0,-e#f�g��hf4##aV#C(>0,*?#V#CE C1c# #

Page 182: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A# #6BCDCED;F<GA:;#3,/>(%*+,-*#@,/#H)I*)&@)&#6JG<:;;D1<K;L4.%-M# # #N#O(#+?)#PQ� �����P#R)#*))#>)()&/0#,(S%&7/+,%(#/I%'+#+?)#TUB#/(.#,+*#*+/+'*4##VN#W%7)#T/>)X# ##N#W/&.R/&)Y#$,&7R/&)#Z)&*,%(#/(.#6)&,/0#('7I)&#/&)#.,*[0/\).#'(.)&#P].)(+,S,-/+,%(P4##VN#].)(+,S,-/+,%(X# ## # #

Page 183: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A# #6BCDCED;F<GH:;#3,/>(%*+,-*#@,/#I)J*)&@)&#6KG<:;;D1<A;L4.%-M# # #N#O(.)&#P3,/>(%*+,-*#Q'RR)&P#S)#*))#.)*-&,T+,@)#,(R%&7/+,%(#R%&#/00#)@)(+*#,(#+?)#BUO4#C@)(+#,(R%&7/+,%(#,*#&)-%&.).#,(#/#-,&-'0/&#J'RR)&4#V?)#7%*+#&)-)(+#/0/&7#,*#.,*T0/W).#,(#+?)#+%T#0,()4#XN#3,/>(%*+,-*#Q'RR)&Y# ##N#V?)#*+/+'*#%R#+?)#,(.,@,.'/0#7%.'0)*#%R#%'&#6Z[8VZB#6KG<:;;#,*#.,*T0/W).#S,+?#/..,+,%(/0#.)+/,0*#,(#+?)#P[%.'0)#Z(R%&7/+,%(P#@,)S4##XN#[%.'0)#Z(R%&7/+,%(Y# ## # #

Page 184: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <=# #6ABCBDC;E<FG:;#3,/>(%*+,-*#@,/#H)I*)&@)&#6JF<:;;C1<K;L4.%-M# # #N#3)+/,0*#/I%'+#-%77'(,-/+,%(*#*)++,(>*#/&)#.,*O0/P).#'(.)&#QA%77'(,-/+,%(Q4##RN#A%77'(,-/+,%(S# ##N#T/0')*#%U#+?)#,(.,@,.'/0#+/>*#-/(#I)#.,*O0/P).#/(.#-?/(>).#'(.)&#QT/&,/I0)#6+/+'*Q4##RN#T/&,/I0)#6+/+'*S# ##

Page 185: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A# #6BCDCED;F<GH:;#3,/>(%*+,-*#@,/#I)J*)&@)&#6AG<:;;D1<K;L4.%-M# # #N#3/+/#-/(#J)#*+%&).#.,&)-+0O#%(#+?)#7)7%&O#-/&.#,(#+?)#BPQ#%&#0%/.).#R&%7#+?)&)#'*,(>#+?)#S$,0)#T&%U*)&S4##VN#$,0)#T&%U*)&W# ##N#X(.,@,.'/00O#-&)/+).#Y/>)*#R%&#+?)#@,*'/0,Z/+,%(#/(.#/0*%#R%&#%Y)&/+%&#-%(+&%0#%R#Y&%-)**)*#U%'0.#J)#*))(#'(.)&#SQ*)&#Y/>)*S4##VN#Q*)&#Y/>)*W# ### #

Page 186: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A# #6BCDCED;F<GH:;#3,/>(%*+,-*#@,/#I)J*)&@)&#6KG<:;;D1<L;A4.%-M# # #�NO��P��Q��R��# S�N� �R���T����� �� T������<# U&%V)-+#;F<GH<;DW/*,-*#3,/>(%*+,-*D6KGXYZZ[\]__]]abbc\&)+&,)@).4# #:# I)J#*)&@)&#d%&#+?)#BUe#<:<HB#d&%7#f&%V)-+#;F<GH<;DW/*,-*#3,/>(%*+,-*D6KGXYZZ[\]__]]abbc\_ghaijklm# #F# BUe#<:<HB#d&%7#f&%V)-+#;F<GH<;DW/*,-*#3,/>(%*+,-*D6KGXYZZ[\]__]]abbc\lgnhbgollm# #H# p%0+/>)#*'ff0q#*r,+-?).#%dd4# #L# 6,>(/0#J%/&.#8s#<M<:W,+#&)7%@).4# #=# p%0+/>)#*'ff0q#*r,+-?).#%(#/>/,(4# #K# I)J#*)&@)&#%d#+?)#BUe#<:<HB#%f)().#,(#%()#%d#+?)#/ff&%@).#r)J#J&%r*)&*4# #A# 3,*f0/q#-?)-t).#d%&#7,**,(>#*,>(/0#J%/&.#8s#<M<:W,+#,(#+?)#u%.'0)#v(d%&7/+,%(#7)('#,+)7#%d#+?)#r)J#*)&@)&4# #

Page 187: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A# #6BCDCED;F<GH:;#3,/>(%*+,-*#@,/#I)J*)&@)&#6KG<:;;D1<L;M4.%-N# # #O��������������P�� �������Q%'#-/(#R,(.#/..,+,%(/0#,(R%&7/+,%(#/*#/(#%&,)(+/+,%(#/,.#R%&#,(,+,/0#/(.#/.@/(-).#+&/,(,(>S#R%&#)N/7T0)U#9)++,(>#6+/&+).S#@,.)%*S#+'+%&,/0*S#/TT*S#7/('/0*S#T&%>&/77,(>#>',.)0,()*#/(.#+&,/0#*%R+V/&)WR,&7V/&)S#/+#+?)#R%00%V,(>#0,(XU####VVV4*,)7)(*4-%7W*-)W*KG<:;;##

Page 188: SCE-Basic Programming S7-1200 (2016)

����������������������������� ��������������������������������������� ����������������� ��������� �������������� !��"���� �#��� ���$�%&������ ���'� ����(����!#� !)��*%�����+,-./0123234.,5002657589.�����������������)��:�������;���<�������=>��?�����

Page 189: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :#6ABCBDC;E<FG;;#8(/0%>#H/0')*#6IF<:;;C1<G;J4.%-K# #����L���������������M��N��O�P����L�O���������������� O����������Q��������� ��R�S�T�UO����P��V�W����������W#X&.)&#(%4Y#=B6I:<ZF<[BE;FZ8[E#���������Q������ �� �� ��UO����P��V�W����������W#X&.)&#(%4Y#=B6I:<ZF<8BE;FZ8[E#\M������������������Q�]������������UP����Q�����V�UO����P��V�W����������W#X&.)&#(%4Y#=B6IJ::F;88;EFZ_BG���0)/*)#(%+)#+?/+#+?)*)#+&/,()&#a/-b/>)*#/&)#&)a0/-).#c,+?#*'--)**%&#a/-b/>)*#c?)(#()-)**/&d4#8(#%@)&@,)c#%e#+?)#-'&&)(+0d#/@/,0/f0)#6AB#a/-b/>)*#,*#a&%@,.).#/+Y#*,)7)(*4-%7g*-)g+a####�����������������$%&#&)>,%(/0#6,)7)(*#6AB#-%(+,(').#+&/,(,(>h#a0)/*)#-%(+/-+#d%'&#&)>,%(/0#6AB#-%(+/-+#*,)7)(*4-%7g*-)g-%(+/-+###�������������P�� �������������������*,)7)(*4-%7g*-)###��P�� ��������������O��i?)#6AB#+&/,(,(>#-'&&,-'0'7#e%&#+?)#,(+)>&/+).#/'+%7/+,%(#*%0'+,%(#i%+/00d#j(+)>&/+).#8'+%7/+,%(#kij8l#c/*#a&)a/&).#e%&#+?)#a&%>&/7#m6,)7)(*#8'+%7/+,%(#A%%a)&/+)*#c,+?#B.'-/+,%(#k6ABlm#*a)-,e,-/00d#e%&#+&/,(,(>#a'&a%*)*#e%&#a'f0,-#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#6,)7)(*#89#.%)*#(%+#>'/&/(+))#+?)#-%(+)(+*4##i?,*#.%-'7)(+#,*#+%#f)#'*).#%(0d#e%&#,(,+,/0#+&/,(,(>#%(#6,)7)(*#a&%.'-+*g*d*+)7*4#i?,*#7)/(*#,+#-/(#f)#-%a,).#,(#c?%0)#%&#a/&+#/(.#>,@)(#+%#+?%*)#f),(>#+&/,().#e%&#'*)#c,+?,(#+?)#*-%a)#%e#+?),&#+&/,(,(>4#A,&-'0/+,%(#%&#-%ad,(>#+?,*#+&/,(,(>#-'&&,-'0'7#/(.#*?/&,(>#,+*#-%(+)(+#,*#a)&7,++).#c,+?,(#a'f0,-#+&/,(,(>#/(.#/.@/(-).#+&/,(,(>#e/-,0,+,)*#e%&#+&/,(,(>#a'&a%*)*4###BK-)a+,%(*#&)n',&)#c&,++)(#-%(*)(+#e&%7#+?)#6,)7)(*#89#-%(+/-+Y#1%0/(.#6-?)')&)&#&%0/(.4*-?)')&)&o*,)7)(*4-%74##Xee)(.)&*#c,00#f)#?)0.#0,/f0)4#800#&,>?+*#,(-0'.,(>#+&/(*0/+,%(#/&)#&)*)&@).h#a/&+,-'0/&0d#,e#/#a/+)(+#,*#>&/(+).#%&#/#'+,0,+d#7%.)0#%&#.)*,>(#,*#&)>,*+)&).4##p*)#e%&#,(.'*+&,/0#-'*+%7)&#-%'&*)*#,*#)Ka&)**0d#a&%?,f,+).4#q)#.%#(%+#-%(*)(+#+%#-%77)&-,/0#'*)#%e#+?)#+&/,(,(>#-'&&,-'0'7*4##q)#c,*?#+%#+?/(b#+?)#ip#3&)*.)(h#)*a)-,/00d#&%e4#3&4Fj(>4#r)%(#p&f/*#'(.#3,a04Fj(>4#8(()++#e)ee)&h#+?)#s,-?/)0#3t,/00/*#B(>,())&,(>#A%&a%&/+,%(#/(.#/00#%+?)&#,(@%0@).#a)&*%(*#e%&#+?),&#*'aa%&+#.'&,(>#+?)#a&)a/&/+,%(#%e#+?,*#+&/,(,(>#-'&&,-'0'74#�

Page 190: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A#6BCDCED;A<FG;;#8(/0%>#H/0')*#6IF<:;;D1<G;J4.%-K# #L/M0)#%N#-%(+)(+*#<O 9%/0#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#PO:O Q&)&)R',*,+)#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#POAO L?)%&S#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#POA4<O 8(/0%>#*,>(/0*#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#POA4:O T)/*'&,(>#+&/(*.'-)&*#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#GOA4AO 8(/0%>#7%.'0)*#U#8V3#-%(@)&+)&#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#GOA4PO 3/+/#+SW)*#%N#+?)#6XT8LXB#6IF<:;;#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#=OA4GO 1)/.,(>V%'+W'++,(>#/(/0%>#@/0')*#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#IOA4=O E%&7/0,Y,(>#/(/0%>#@/0')*#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#ZOPO L/*[#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<;OGO Q0/((,(>#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<;OG4<O 8(/0%>#-%(+&%0#%N#+?)#-%(@)S%&#*W)).#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<;OG4:O L)-?(%0%>S#.,/>&/7#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<<OG4AO 1)N)&)(-)#0,*+#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<:O=O 6+&'-+'&).#*+)WFMSF*+)W#,(*+&'-+,%(*#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<AO=4<O 1)+&,)@)#/(#)K,*+,(>#W&%\)-+#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#<AO=4:O B&)/+)#+?)#]T L 1D6QCC3B EL1 _]#N'(-+,%(#44444444444444444444444444444444444444444444444444444444444444444444#<GO=4AO B%(N,>'&/+,%(#%N#+?)#/(/0%>#%'+W'+#-?/(()0#44444444444444444444444444444444444444444444444444444444444444444444444444444444#::O=4PO CKW/(.#+?)#+/>#+/M0)#+%#,(-0'.)#/(/0%>#*,>(/0*#44444444444444444444444444444444444444444444444444444444444444444444444444#:AO=4GO B/00#+?)#M0%-[#,(#+?)#%&>/(,Y/+,%(#M0%-[#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444#:PO=4=O 6/@)#/(.#-%7W,0)#+?)#W&%>&/7#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#:IO=4IO 3% (0%/.#+?)#W&%>&/7#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#:JO=4JO T%(,+%&#W&%>&/7#M0%-[*#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#:ZO=4ZO 8&-?,@)#+?)#W&%\)-+#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#A<OIO B?)-[0,*+#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#A:OJO CK)&-,*)#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AAOJ4<O L/*[#U#CK)&-,*)#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AAOJ4:O L)-?(%0%>S#.,/>&/7#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#APOJ4AO 1)N)&)(-)#0,*+#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AGOJ4PO Q0/((,(>#44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AGOJ4GO B?)-[0,*+#U#CK)&-,*)#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#A=OZO 8..,+,%(/0#,(N%&7/+,%(#4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444#AIO# ## �

Page 191: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6JG<:;;D1<H;K4.%-L# #�M�NOP�Q�NR���!OS����������T��������P����U(#+?,*#-?/V+)&W#X%'#Y,00#Z)-%7)#/-['/,(+).#Y,+?#+?)#/(/0%>#@/0')#V&%-)**,(>#%\#+?)#6U]8 UB#6JG<:;;#Y,+?#+?)#U8#_%&+/0#V&%>&/77,(>#+%%04##?)#7%.'0)#)LV0/,(*#+?)#/-[',*,+,%(#/(.#V&%-)**,(>#%\#/(/0%>#*,>(/0*#/(.#>,@)*#/#*+)VGZXG*+)V#.)*-&,V+,%(#%\#&)/.#/(.#Y&,+)#/--)**#+%#/(/0%>#@/0')*#,(#+?)#6U]8 UB#6JG<:;;4#��������a����?,*#-?/V+)&#Z',0.*#%(#+?)#-?/V+)&#UCB#,7)&*#/(.#B%'(+)&*#Y,+?#+?)#6U]8 UB#6J#B_b<:<AB4#c%'#-/(#'*)#+?)#\%00%Y,(>#V&%d)-+#\%&#+?,*#-?/V+)&W#\%&#)L/7V0)e#6BCDCED;F<GF;;DUCBD,7)&*DB%'(+)&*D6JG<:;;4f/V#���g���"��h��������a����a�ijklmjnopqnknmkpkrsjpotkqsujpvwkxyslyklpjkpqqz{|kmjvtknxmkqsujpvkqnpn|qk}~�mvnpu|k�o|q|jnk���k��kpj�k~�mvnpu|kjmnk�o|q|jnk�k���wkpjpvmukqsujpvqklpjkpqqz{|kpjtk�pvz|kxsnysjkpk�|�sj|�k&/(>)4#8#+XV,-/0#)L/7V0)#%\#/(#/(/0%>#*)(*%&#,*#/#V%+)(+,%7)+)&4#3)V)(.,(>#%(#+?)#V%*,+,%(#%\#+?)#�(%ZW#/(X#&)*,*+/(-)#-/(#Z)#*)+W#'V#+%#+?)#7/L,7'7#@/0')4##CL/7V0)*#%\#/(/0%>#['/(+,+,)*#,(#-%(+&%0#)(>,())&,(>e#G# )7V)&/+'&)#GH;#+%#�<H;#�B#G# $0%Y#&/+)#;#+%#:;;#0�7,(#G# 6V)).#GH;;#+%#�H;#&V7##G# )+-4##

Page 192: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A#6BCDCED;F<GA;;#8(/0%>#H/0')*#6IG<:;;D1<A;J4.%-K# #�L�����M��������M����M�N?)*)#O'/(+,+,)*#/&)#-%(@)&+).#+%#)0)-+&,-/0#@%0+/>)*P#-'&&)(+*#%&#&)*,*+/(-)*#Q,+?#+?)#?)0R#%S#/#7)/*'&,(>#+&/(*.'-)&4#TSP#S%&#)K/7R0)P#/#*R)).#,*#+%#U)#7)/*'&).P#+?)#*R)).#&/(>)#%S#A;;#+%#<A;;#&R7#-/(#U)#-%(@)&+).#+%#/#@%0+/>)#&/(>)#%S#;#+%#V<;#H#'*,(>#/#7)/*'&,(>#+&/(*.'-)&4#8+#/#7)/*'&).#*R)).#%S#J=A#&R7P#+?)#7)/*'&,(>#+&/(*.'-)&#Q%'0.#%'+R'+#/#@%0+/>)#@/0')#%S#VF4=A#H4## ##�L�������� ����M�W��� ����X������#N?)*)#)0)-+&,-/0#@%0+/>)*P#-'&&)(+*#%&#&)*,*+/(-)*#/&)#+?)(#-%(()-+).#+%#/(#/(/0%>#7%.'0)#+?/+#.,>,+,Y)*#+?,*#*,>(/0#S%&#S'&+?)&#R&%-)**,(>#,(#+?)#Z[B4#TS#/(/0%>#O'/(+,+,)*#Q,00#U)#R&%-)**).#Q,+?#/#Z[BP#+?)#&)/.G,(#@%0+/>)P#-'&&)(+#%&#&)*,*+/(-)#@/0')#7'*+#U)#-%(@)&+).#+%#.,>,+/0#,(S%&7/+,%(4#N?)#/(/0%>#@/0')#,*#-%(@)&+).#+%#/#U,+#R/++)&(4#N?,*#-%(@)&*,%(#,*#&)S)&&).#+%#/*#/(/0%>G+%G.,>,+/0#-%(@)&*,%(#\8]3#-%(@)&*,%(4#N?,*#7)/(*P#S%&#)K/7R0)P#+?/+#+?)#@%0+/>)#@/0')#%S#F4=A#H#,*#*+%&).#/*#,(S%&7/+,%(#,(#/#*)&,)*#%S#U,(/&_#.,>,+*4##N?)#&)*'0+#%S#+?,*#-%(@)&*,%(#,*#/0Q/_*#/#<=GU,+#Q%&.#S%&#6T8NTB#R&%.'-+*4#N?)#,(+)>&/+).#83B#\/(/0%>G+%G.,>,+/0#-%(@)&+)&#%S#+?)#/(/0%>#,(R'+#7%.'0)#.,>,+,Y)*#+?)#/(/0%>#*,>(/0#U),(>#/-O',&).#/(.#/RR&%K,7/+)*#,+*#@/0')#,(#+?)#S%&7#%S#/#*+)RR).#-'&@)4#N?)#7%*+#,7R%&+/(+#R/&/7)+)&*#%S#/(#83B#/&)#,+*#&)*%0'+,%(#/(.#-%(@)&*,%(#&/+)4###<a#8(/0%>#@/0')#:4#3,>,+/0#@/0')## #F=A <;;;#b]7,(<;H ��cd������e� ���f������c�e� ������e� ���g������c�e� ���f�������c h��c��� i�� �����e� �����cd�������j �f��L���c��j ������j �g��L���c��j �f��L���c#������j �#h���c#<;;;#&R7#

Page 193: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# =#6ABCBDC;E<FG;;#8(/0%>#H/0')*#6IF<:;;C1<G;J4.%-K# #L?)#7%&)#M,(/&N#.,>,+*#+?)#.,>,+/0#&)O&)*)(+/+,%(#'*)*P#+?)#Q,()&#+?)#&)*%0'+,%(#,*4#$%&#)K/7O0)P#,Q#%(0N#<#M,+#R/*#/@/,0/M0)#Q%&#+?)#@%0+/>)#&/(>)#%Q#;#+%#S<;#HP#N%'#R%'0.#%(0N#T(%R#R?)+?)&#+?)#7)/*'&).#@%0+/>)#,*#M)+R))(#;#/(.#SG#H#%&#M)+R))(#SG#H#/(.#S<;#H4#U,+?#:#M,+*P#+?)#&/(>)#-/(#M)#.,@,.).#,(+%#V#,(.,@,.'/0#&/(>)*P#,4)4P#;#+%#:4G#W#:4G#+%#G#W#G#+%#I4G#W#I4G#+%#<;#H4#A%(@)(+,%(/0#8W3#-%(@)&+)&*#,(#-%(+&%0#)(>,())&,(>#'*)#J#M,+*P#<<#M,+*#%&#7%&)#Q%&#-%(@)&+,(>4#U,+?#J#M,+*#N%'#?/@)#:G=#,(.,@,.'/0#&/(>)*P#R?,0)#<<#M,+*#O&%@,.)#/#&)*%0'+,%(#%Q#:;VJ#,(.,@,.'/0#&/(>)*4# ##�XY� �����"Z�[��\��]�����������������L?)#6_8L_A#6IF<:;;#?/*#7/(N#.,QQ)&)(+#./+/#+NO)*#Q%&#&)O&)*)(+,(>#.,QQ)&)(+#('7)&,-/0#Q%&7/+*4#8#0,*+#%Q#*%7)#%Q#+?)#)0)7)(+/&N#./+/#+NO)*#,*#>,@)(#M)0%R4## �����"Z����a��bc��[d�e���� �f� Z����\����[���������"�g%%0# <# ;#+%#<# L1hBP#$8i6BP#jP#<#gN+)# J# <=k;;#+%#<=k$$# <=k<:P#<=k8g#U%&.# <=# <=k;;;;#+%#<=k$$$$# <=k8gA3P#<=k;;;<#3U%&.# E:# <=k;;;;;;;;#+%#<=k$$$$$$$$# <=k;:V=J8AB#A?/&# J# <=k;;#+%#<=k$$# lmlnopqrnopsr#6,(+# J# F<:J#+%#<:I# <:EPF<:E#���� ��� �����t��������� ����������3,(+# E:# F:P<VIPVJEP=VJ#+%#:P<VIPVJEP=VI# <:EP#F<:E#h6_(+# J# ;#+%#:GG# <:E#h0(+# <=# ;#+%#=GPGEG# <:E#h3_(+# E:# ;#+%#VP:uVPu=IP:uG# <:E#e���� ��� v���X�t�f������t����v���XY��f�����t� ���XY������XY����X��v�����XY����i1)/0# =V# SWF:4:E#K#<;#FE;J#+%#SWF<4Iu#K#<;#E;J#<:EVG4<:EVG=IJu##F<4:BSV;#L,7)# E:# LkF:V.C:;?CE<#7C:E*C=VJ7*#+%#Lk:V.C:;?CE<#7C:E*C=VI7*##6/@).#/*w#F:P<VIPVJEP=VJ#7*#+%#S:P<VIPVJEP=VI#7*# LkG7CE;*##GkF:.#Lk<.C:?C<G7CE;KCVG7*#6+&,(># H/&,/M0)# ;#+%#:GV#-?/&/-+)&*#,(#MN+)#*,x)# y8gAy#z{|}~�������z��������������������������������������������������������������������������������������������������������������������������������������������� �z���¡��¢��£������������������������������¡������������������������������¡����������������¢��������������������������������������������������������¡� �z���� ���¤¥���Yt�¦�����Ytt�t��¤��������\\������[��\�§� ¤�����c����������#�� ����¤#����¤# ��Yt#<<#g,+#

Page 194: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6AG<:;;D1<H;J4.%-K# #�L��M��������N�����������O���P�8(/0%>#@/0')*#/&)#&)/.#,(+%#+?)#QRB#%&#%'+S'+#T&%7#+?)#QRB#/*#U%&.#,(T%&7/+,%(4#V?)*)#U%&.*#/&)#/--)**).W#T%&#)K/7S0)W#U,+?#+?)#T%00%U,(>#%S)&/(.*X##YZ[#=\# # 8(/0%>#,(S'+#U%&.#=\#Y][#=\# # 8(/0%>#%'+S'+#U%&.#=\##C/-?#/(/0%>#@/_abcdefgg hiajdd_klmajgalgk_najoaj_nk_napjoqraseatjoufnalmavwxyzW#/(#,(+)>)&4##V?)#/..&)**,(>#%T#,(S'+#/(.#%'+S'+#U%&.*#-%(T%&7*#+%#+?)#/..&)**,(>#,(#+?)#.)@,-)#%@)&@,)U4#$%&#)K/7S0)X## ##{)&)W#+?)#/..&)**#%T#+?)#T,&*+#/(/0%>#,(S'+#U%'0.#|)#YZ[#=\W#/(.#+?)#/..&)**#%T#+?)#*)-%(.#/(/0%>#,(S'+#U%'0.#|)#YZ[#==4##V?)#/..&)**#%T#+?)#/(/0%>#%'+S'+#U%'0.#|)#Y][#=\4### #

Page 195: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6JG<:;;D1<H;A4.%-K# #L?)#/(/0%>#@/0')#+&/(*M%&7/+,%(#M%&#M'&+?)&#N&%-)**,(>#,(#+?)#OPB#,*#+?)#*/7)#M%&#/(/0%>#,(N'+*#/(.#/(/0%>#%'+N'+*4#L?)#.,>,+,Q).#@/0')#&/(>)*#/&)#/*#M%00%R*S## ##TM+)(U#+?)*)#.,>,+,Q).#@/0')*#*+,00#?/@)#+%#V)#(%&7/0,Q).#VW#M'&+?)&#N&%-)**,(>#+?)7#,(#+?)#OPB#,(#/(#/NN&%N&,/+)#7/(()&4### # X� �����������Y��Z��������[���#�� ����\#����\# �]�_# ��������� [���� Y��� Y��Z���a����bb�������Z���c�#��_�# �� ���\#

Page 196: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6JG<:;;D1<H;K4.%-L# #�M��N�� ���O���������P���Q�#RS#/(#/(/0%>#,(T'+#@/0')#)L,*+*#/*#/#.,>,+,U).#@/0')#,(#+?)#&/(>)#VWG#:J=XKY#,+#7'*+#'*'/00Z#*+,00#[)#(%&7/0,U).#*%#+?/+#+?)#('7)&,-/0#@/0')*#-%&&)*T%(.#+%#+?)#T?Z*,-/0#\'/(+,+,)*#,(#+?)#T&%-)**4##],)_,*)Y#+?)#/(/0%>#%'+T'+#'*'/00Z#&)*'0+*#S&%7#*)++,(>#%S#/#(%&7/0,U).#@/0')#+?/+#+?)(#*+,00#?/*#+%#[)#*-/0).#+%#+?)#%'+T'+#@/0')#VWG#:J=XK4##R(#+?)#R8#a%&+/0Y#&)/.ZG7/.)#[0%-*#%&#/&,+?7)+,-#%T)&/+,%(*#/&)#'*).#S%&#(%&7/0,U,(>#/(.#*-/0,(>4#$%&#+?,*#+%#[)#-/&&,).#%'+#/*#)L/-+0Z#/*#T%**,[0)Y#+?)#@/0')*#S%&#+?)#(%&7/0,U,(>#7'*+#[)#-%(@)&+).#+%#+?)#1C8]#./+/#+ZT)#+%#7,(,7,U)#&%'(.,(>#)&&%&*4###

Page 197: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <;#6ABCBDC;E<FG;;#8(/0%>#H/0')*#6IF<:;;C1<G;J4.%-K# #L���MN�O(#+?,*#-?/P+)&Q#/#R'(-+,%(#R%&#/(/0%>#-%(+&%0#%R#+?)#-%(@)S%&#*P)).#T,00#U)#/..).#+%#+?)#P&%>&/7#R&%7#-?/P+)&#V6ABCBDC;E<FE;;#OBA#W,7)&*#/(.#A%'(+)&*#6IF<:;;V4#����������W?)#/(/0%>#-%(+&%0#%R#+?)#-%(@)S%&#*P)).#T,00#U)#P&%>&/77).#,(#+?)#VXYWY1C6ZBB3AYDW1Y[V#\$A<;]#R'(-+,%(#/*#/(#)KP/(*,%(#%R#+?)#V6ABCBDC;E<FE;;#OBA#W,7)&*#/(.#A%'(+)&*#6IF<:;;V#P&%)-+4#W?,*#P&%)-+#7'*+#U)#&)+&,)@).#R&%7#+?)#/&-?,@)#,(#%&.)&#+%#/..#+?,*#R'(-+,%(4#W?)#VXYWY1C#6ZBB3AYDW1Y[V#\$A<;]#R'(-+,%(#T,00#U)#-/00).#,(#_abcdefghbijklmcbnopegfqe_fngbrsntubegvbwfoavxbyabtng_onsbnzb_abtng{a|nob}n_nob}~�_brab-?/(>).#+%#��E#�-%(@)S%&#7%+%&#FX<#@/&,/U0)#*P)).�4##������������������������������"���M�����W?)#*P)).#T,00#U)#*)+#/+#/(#,(P'+#%R#+?)#VXYWY1C6ZBB3AYDW1Y[V#\$A<;]#R'(-+,%(#,(#&)@%0'+,%(*#P)&#7,('+)#�&/(>)�#��F#G;#&P7�4#W?)#./+/#+SP)#,*#E:FU,+#R0%/+,(>FP%,(+#('7U)&#�1)/0�4#$,&*+Q#+?)#R'(-+,%(#T,00#U)#-?)-�).#R%&#-%&&)-+#)(+&S#%R#+?)#*P)).#*)+P%,(+#,(#+?)#&/(>)#��F#G;#&P74#OR#+?)#*P)).#*)+P%,(+#,*#%'+*,.)#+?)#&/(>)#��F#G;#&P7Q#+?)#@/0')#;#T,+?#./+/#+SP)#<=FU,+#,(+)>)&#�O(+�#T,00#U)#%'+P'+#/+#+?)#%'+P'+4#W?)#&)+'&(#@/0')#%R#+?)#R'(-+,%(#�1)+CH/0�#T,00#+?)(#U)#/**,>().#+?)#@/0')#W1�B#�<�4##OR#+?)#*P)).#*)++,(>#,*#T,+?,(#+?)#&/(>)#��F#G;#&P7Q#+?,*#@/0')#T,00#R,&*+#U)#(%&7/0,�).#+%#+?)#oegpab��lbegvb_agb�tesavb_nb��F#:I=�J#T,+?#./+/#+SP)#<=FU,+#,(+)>)&#�O(+�#R%&#%'+P'+#/*#+?)#*P)).#7/(,P'0/+).#@/0')#/+#+?)#/(/0%>#%'+P'+4##W?)#%'+P'+#T,00#+?)(#U)#-%(()-+).#T,+?#*,>(/0#�<#�7/(,P'0/+).#@/0')#*P)).#%R#+?)#7%+%&#,(#:#.,&)-+,%(*#��F#<;H#-%&&)*P%(.*#+%#��F#G;#&P7�4###

Page 198: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <<#6ABCBDC;E<FG;;#8(/0%>#H/0')*#6IF<:;;C1<G;J4.%-K# #�L�����M����"������ �N)&)#O%'#*))#+?)#+)-?(%0%>O#.,/>&/7#P%&#+?)#+/*Q4## #$,>'&)#<R#S)-?(%0%>O#.,/>&/7# #$,>'&)#:R#A%(+&%0#T/()0##

Page 199: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <:#6ABCBDC;E<FG;;#8(/0%>#H/0')*#6IF<:;;C1<G;J4.%-K# #�L��M�N���������O��P?)#Q%00%R,(>#*,>(/0*#/&)#&)S',&).#/*#>0%T/0#%U)&/(.*#Q%&#+?,*#+/*V4# �� �"W�� ������N���� !������� X��XY�Z#;4;# [\\]# F8<# 1)+'&(#*,>(/0#)7)&>)(-#*+%U#\_# DA#Z#;4<# [\\]# F_;# /,(#*R,+-?#a\Da# D\#Z#;4:# [\\]# F6;# %.)#*)0)-+%&#7/('/0#b;cd#/'+%7/+,-#b<c# /('/0#e#;#8'+%#e#<#Z#;4E# [\\]# F6<# f'*?T'++%(#/'+%7/+,-#*+/&+# D\#Z#;4g# [\\]# F6:# f'*?T'++%(#/'+%7/+,-#*+%U# DA#Z#;4G# [\\]# F[<# 6)(*%&#-0,(.)&#Fg#&)+&/-+).# D\#Z#<4;# [\\]# F[g# 6)(*%&#U/&+#/+#*0,.)# D\#Z#<4E# [\\]# F[I# 6)(*%&#U/&+#/+#)(.#%Q#-%(@)%&# D\## Y� �"W�� ������N���� !������� �h#;4:# [\\]# FhE# A%(@)%&#7%+%&#F<#@/&,/T0)#*U)).# #hi#=g# [\\]# Fj<# /(,U'0/+).#@/0')#*U)).#%Q#+?)#7%+%&#,(#:#.,&)-+,%(*#kdF#<;H#-%&&)*U%(.*#+%#kdF#G;#&U7# #lmnonpqlrstltnrntnpunlvwxyl#lllllll# 3\# 3,>,+/0#\'+U'+#8\# 8(/0%>#\'+U'+#h# \'+U'+#3Z# 3,>,+/0#Z(U'+#8Z# 8(/0%>#Z(U'+#Z# Z(U'+#DA# D%&7/00#A0%*).##D\# D%&7/00#\U)(##

Page 200: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A#6BCDCED;A<FG;;#8(/0%>#H/0')*#6IF<:;;D1<G;J4.%-K# #�����������L��M�N"�L��M���L�������L�O%'#-/(#P,(.#,(*+&'-+,%(*#%(#?%Q#+%#-/&&R#%'+#S0/((,(>#T)0%Q4#UP#R%'#/0&)/.R#?/@)#/#>%%.#'(.)&*+/(.,(>#%P#)@)&R+?,(>V#,+#Q,00#T)#*'PP,-,)(+#+%#P%-'*#%(#+?)#('7T)&).#*+)S*4#W+?)&Q,*)V#*,7S0R#P%00%Q#+?)#.)+/,0).#*+)S*#,(#+?)#,(*+&'-+,%(*4#�X��Y�����Z������[�L����M��\����]# )P%&)#Q)#-/(#)KS/(.#+?)#_6BCDCED;A<FA;;DUCBD,7)&*DB%'(+)&*D6IF<:;;4a/S<A_#S&%b)-+#P&%7#-?/S+)&#_6BCDCED;A<FA;;DUCBD,7)&*DB%'(+)&*D6IF<:;;_V#Q)#7'*+#&)+&,)@)#+?,*#S&%b)-+#P&%7#+?)#/&-?,@)4#%#&)+&,)@)#/(#)K,*+,(>#S&%b)-+#+?/+#?/*#T))(#/&-?,@).V#R%'#7'*+#*)0)-+#+?)#&)0)@/(+#/&-?,@)#Q,+?#]#c&%b)-+#]#1)+&,)@)#,(#+?)#S&%b)-+#@,)Q4#B%(P,&7#R%'&#*)0)-+,%(#Q,+?#WS)(4##d]#c&%b)-+#]#1)+&,)@)#]#6)0)-+#/#4a/S#/&-?,@)#]#WS)(e###]# ?)#()K+#*+)S#,*#+%#*)0)-+#+?)#+/&>)+#.,&)-+%&R#Q?)&)#+?)#&)+&,)@).#S&%b)-+#Q,00#T)#*+%&).4#B%(P,&7#R%'&#*)0)-+,%(#Q,+?#_Wf_4##d]#/&>)+#.,&)-+%&R#]#Wfe##

Page 201: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6JG<:;;D1<H;K4.%-L# #M#6/@)#+?)#%N)().#N&%O)-+#'(.)&#+?)#(/7)#;F<GH;;D8(/0%>DI/0')*D6JG<:;;4##PM#Q&%O)-+#M#RSTUVSWVXVM#;F<GH;;D8(/0%>DI/0')*D6JG<:;;#M#6/@)Y# #�

Page 202: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A#6BCDCED;F<GA;;#8(/0%>#H/0')*#6IG<:;;D1<A;J4.%-K# #�L����������M��N�O�OPQ���� �OR�POSN�T�������U#6)0)-+#+?)#VW&%>&/7#X0%-Y*V#Z%0.)&#%Z#[%'&#BW\D<:<]B#/(.#+?)(#-0,-Y#8..#()_#X0%-Y#+%#-&)/+)#/#()_#Z'(-+,%(#+?)&)4#U#BW\D<:<]B#aBW\#<:<]B#3Bb3Bb3Bc#U#8..#()_#X0%-Yd###U#6)0)-+# #,(#+?)#()K+#.,/0%>#/(.#&)(/7)#[%'&#()_#X0%-Y#+%e#fghg1D6WCC3BgEh1gi4#6)+#+?)#0/(>'/>)#+%#$j3#/(.#7/('/00[#/**,>(#+?)#('7X)&#<;4#6)0)-+#+?)#8..#()_#/(.#%k)(#-?)-Y#X%K4#B0,-Y#gl4#U U#E/7)e#fghg1D6WCC3BgEh1gi#U#i/(>'/>)e#$j3#U#E'7X)&e#<;#f/('/0#U##8..#()_#/(.#%k)(#U#gld# #

Page 203: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <=#6ABCBDC;E<FG;;#8(/0%>#H/0')*#6IF<:;;C1<G;J4.%-K# #L#A&)/+)#+?)#0%-/0#+/>*#M,+?#+?),&#-%77)(+*#/*#*?%M(#?)&)#/(.#-?/(>)#+?)#./+/#+NO)#%P#+?)#Q1)+'&(Q#+/>#P&%7#QH%,.Q#+%#QR%%0Q4#SL#R%%0T# #UVWXYZ[\Z]_\ZaZ]\Zb\Zca__\cZdeeZfg\]hZL#i(*)&+#/(#8**,>(7)(+#Q Q#,(#+?)#P,&*+#()+M%&j#/(.#/(#Q8(.Q Q#,(#P&%(+#%P#,+4#k?)(#'*)#.&/>F/(.F.&%O#+%#7%@)#+?)#QA%7O/&/+%&#%O)&/+,%(Q#Ql)**#%&#)m'/0Q#P&%7#+?)#QR/*,-#,(*+&'-+,%(*Q#%(+%#+?)#P,&*+#,(O'+#%P#+?)# #8D3#0%>,-#%O)&/+,%(4#SL# #L# #L#R/*,-#,(*+&'-+,%(*#L#A%7O/&/+%&#%O)&/+,%(*L#AnopqT# #

Page 204: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6AG<:;;D1<H;J4.%-K# #L#E)K+#'*)#.&/>G/(.G.&%M#+%#7%@)#+?)#NB%7M/&/+%&#%M)&/+,%(N#N9&)/+)&#%&#)O'/0N#%(+%#+?)#*)-%(.#,(M'+#%P#+?)# #8E3#0%>,-#%M)&/+,%(4##QL#R/*,-#,(*+&'-+,%(*#L#B%7M/&/+%&#%M)&/+,%(*L#BSTUVW# ##L#B%(()-+#+?)#-%(+/-+*#,(#E)+X%&Y#<#X,+?#+?)#-%(*+/(+*#/(.#0%-/0#+/>*#/*#*?%X(#?)&)4#Z?)#./+/#+[M)*#,(#+?)#-%7M/&/+%&#%M)&/+,%(*#/&)#/'+%7/+,-/00[#/./M+).#+%#N1)/0N4##

Page 205: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6JG<:;;D1<H;A4.%-K# #L#M*)#.&/>G/(.G.&%N#+%#7%@)#+?)#OB%(@)&*,%(#%N)&/+,%(O#OEP1QDRO#,(+%#E)+S%&T#:#,(#%&.)&#+%#(%&7/0,U)#+?)#*N)).#*)+N%,(+#%V#WXG#H;#&N7#+%#WXG#<4#YL#Z/*,-#,(*+&'-+,%(*#L#B%(@)&*,%(#%N)&/+,%(*#L#EP1QDR[# #L##B%(()-+#+?)#-%(+/-+*#,(#E)+S%&T#:#S,+?#+?)#-%(*+/(+*#/(.#0%-/0#+/>*#/*#*?%S(#?)&)4#\?)#./+/#+]N)*#,(#OEP1QDRO#/&)#/'+%7/+,-/00]#/./N+).#+%#O1)/0O4# #

Page 206: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# <A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6JG<:;;D1<H;K4.%-L# #M#N*)#.&/>G/(.G.&%O#+%#7%@)#+?)#PB%(@)&*,%(#%O)&/+,%(P#P6B8QCDRP#,(+%#E)+S%&T#F#,(#%&.)&#+%#*-/0)#+?)#*O)).#*)+O%,(+#U&%7#+?)#(%&7/0,V).#WXG#<#%(+%#+?)#&/(>)#U%&#+?)#/(/0%>#%'+O'+#WXG#:JY=K4##ZM#[/*,-#,(*+&'-+,%(*#M#B%(@)&*,%(#%O)&/+,%(*#M#6B8QCDR\# ##M#B%(()-+#+?)#-%(+/-+*#S,+?#+?)#-%(*+/(+*#/(.#0%-/0#+/>*#,(#E)+S%&T#F#/*#S)00]#/*#*?%S(#?)&)4#?)#./+/#+_O)*#,(#P6B8QCDRP#/&)#/'+%7/+,-/00_#-?/(>).#+%#P1)/0P#%&#P(+P4##

Page 207: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :;#6ABCBDC;E<FG;;#8(/0%>#H/0')*#6IF<:;;C1<G;J4.%-K# #L#M(*)&+#/(#8**,>(7)(+#N N#,(#+?)#O%'&+?#()+P%&Q4#R*)#.&/>F/(.F.&%S#+%#7%@)#+?)#NT%@)N#-%77/(.#O&%7#+?)#NT%@)#%S)&/+,%(*N#O%0.)&#'(.)&#NU/*,-#,(*+&'-+,%(*N#,(#O&%(+#%O#+?)#8**,>(7)(+4##VL# #L#U/*,-#,(*+&'-+,%(*#L#T%@)#%S)&/+,%(*#L#TWHBX# #L#Y?)#-%(+/-+*#,(#D)+P%&Q#Z#P,00#(%P#[)#-%(()-+).#P,+?#-%(*+/(+*#/(.#0%-/0#+/>*#/*#*?%P(#?)&)4#MO#+?)#*S)).#*)+S%,(+#,*#(%+#P,+?,(#+?)#&/(>)#\]F#G;#&S7#+?)#@/0')#N;N#,*#%'+S'+#/+#+?)#/(/0%>#%'+S'+#/(.#+?)#@/0')#Y1RB#,*#/**,>().#+%#+?)#&)+'&(#@/0')#V1)+'&(X#%O#+?)#_abacdefgghiajbcaklmnopqrstpu# #

Page 208: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :<#6ABCBDC;E<FG;;#8(/0%>#H/0')*#6IF<:;;C1<G;J4.%-K# #L#3%#(%+#M%&>)+#+%#-0,-N# 4#O?)#M,(,*?).#M'(-+,%(#PQROR1C6SBB3ARDO1RTP#U$A<;V#,(#$W3#,*#*?%X(#Y)0%X4# ##

Page 209: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# ::#6ABCBDC;E<FG;;#8(/0%>#H/0')*#6IF<:;;C1<G;J4.%-K# #�L�����M���������M��N����������O���N������P#3%'Q0)F-0,-R#+?)#S3)@,-)#-%(T,>'&/+,%(S#+%#%U)(#,+4##P#A?)-R#+?)#/..&)**#*)++,(>#/(.#+?)#-%(T,>'&/+,%(#%T#+?)#/(/0%>#%'+U'+#-?/(()0#;4##VP#WXYZZ[\]]X_a_bXPc&%U)&+,)*#P#9)()&/0#P#8(/0%>#%'+U'+*#P#1)/-+,%(#+%#Acd#6efcg#d*)#*'Q*+,+'+)#@/0')#P#A?/(()0#;#P#8(/0%>#%'+U'+#+hU)g#H%0+/>)#P#6'Q*+,+'+)#@/0')#T%&#-?/(()0#%(#/#-?/(>)#T&%7#1dD#+%#6efcg#;4;;;#H#P# #B(/Q0)#*?%&+#-,&-',+#.,/>(%*+,-*i# #

Page 210: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :A#6BCDCED;A<FG;;#8(/0%>#H/0')*#6IF<:;;D1<G;J4.%-K# #�LM��NO�����P�������Q�������������������R����R�S#3%'T0)F-0,-U#+?)#VW/>#+/T0)D*%&+,(>#*+/+,%(V#+%#%X)(#,+4###S#8..#+?)#>0%T/0#+/>*#Y%&#+?)#/(/0%>#@/0')#X&%-)**,(>#+%#+?)#ZW/>#+/T0)D*%&+,(>#*+/+,%(Z4#8(#/(/0%>#,(X'+#[J#/(.#/(#/(/0%>#%'+X'+#\<#7'*+#T)#/..).4##]S#\<#S#_ =a#S#[J#S#b=ac# ##

Page 211: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6JG<:;;D1<H;K4.%-L# #�M��������N��O���P�����N�������Q������O���P�R#ST)(#+?)#UV/,(#WSX<YU#%&>/(,Z/+,%(#[0%-\#],+?#/#.%'[0)G-0,-\4##R#8..#+?)#+)7T%&/&#+/>#_V%+%&D*T)).D7%(,+%&,(>D1)+DI/0_#+%#+?)#0%-/0#+/>*#%#SX<4#a?)*)#],00#[)#()).).#,(#%&.)&#+%#,(+)&-%(()-+#+?)#&)+'&(#@/0')#%#+?)#UVSaS1D6bCC3BSEa1ScU#'(-+,%(4##dR#a)7T#R#V%+%&D*T)).D7%(,+%&,(>D1)+DI/0#R#X%%0e# ##

Page 212: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :A#6BCDCED;F<GA;;#8(/0%>#H/0')*#6IG<:;;D1<A;J4.%-K# #L#6)0)-+#+?)#M0%-N#+,+0)#%O#PQ<#/(.#+?)(#-0,-N#R R#+%#,(*)&+#/#()S#E)+S%&N#<#,(#O&%(+#%O#+?)#%+?)&#()+S%&N*#TL# U# ##L#V*)#.&/>G/(.G.&%W#+%#7%@)#X%'&#YZP[P1D6\CC3BPE[1P]#$B<;_Y#O'(-+,%(#%(+%#+?)#>&))(#0,()#,(#E)+S%&N#<4# ##

Page 213: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :=#6ABCBDC;E<FG;;#8(/0%>#H/0')*#6IF<:;;C1<G;J4.%-K# #L#A%(()-+#+?)#-%(+/-+*#M,+?#+?)#-%(*+/(+*#/(.#>0%N/0#/(.#0%-/0#+/>*#?)&)#/*#*?%M(4####L#A?/(>)#+?)#-%(()-+,%(#%O#%'+P'+#+/>#QA%(@)R%&C7%+%&C/'+%7/+,-C7%.)Q#,(#D)+M%&S#:#+%#TFUET#VA%(@)R%&#7%+%&#FW<#@/&,/N0)#*P)).X#*%#+?/+#+?)#-%(@)R%&#7%+%&#,*#-%(+&%00).#+/S,(>#+?)#/(/0%>#*P)).#*)++,(>#,(+%#-%(*,.)&/+,%(4#VL#FUEX# #

Page 214: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6AG<:;;D1<H;J4.%-K# #�L����M�������� N�����O��N���� �P#Q%#*/@)#R%'&#S&%T)-+U#*)0)-+#+?)# #V'++%(#,(#+?)#7)('4#Q%#-%7S,0)#/00#V0%-W*U#-0,-W#+?)#XY&%>&/7#V0%-W*X#Z%0.)&#/(.#*)0)-+#+?)# #,-%(#Z%&#-%7S,0,(>#,(#+?)#7)('4##[P #P#Y&%>&/7#V0%-W*#P# \# ##P#Q?)#X](Z%XU#XB%7S,0)X#/&)/#*?% *#?,-?#V0%-W*#)&)#*'--)**Z'00R#-%7S,0).4# #�

Page 215: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6JG<:;;D1<H;A4.%-K# #�LM� �N�������O��P���� �Q#8R+)&#*'--)**R'0#-%7S,0/+,%(T#+?)#-%7S0)+)#-%(+&%00)&#U,+?#+?)#-&)/+).#S&%>&/7#,(-0'.,(>#+?)#?/&.U/&)#-%(R,>'&/+,%(#-/(T#/*#.)*-&,V).#,(#+?)#S&)@,%'*#7%.'0)*T#V)#.%U(0%/.).4#WQ# X# #�

Page 216: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# :A#6BCDCED;F<GH;;#8(/0%>#I/0')*#6JG<:;;D1<H;K4.%-L# #�MN���������O���� �P���QR�S#T?)#.)*,&).#U0%-V#7'*+#U)#%W)(#X%&#7%(,+%&,(>#+?)#.%Y(0%/.).#W&%>&/74#T?)#7%(,+%&,(>#-/(#(%Y#U)#/-+,@/+).Z.)/-+,@/+).#U[#-0,-V,(>#+?)## #,-%(4##\S#]/,(#_ <a#S# b# ##

Page 217: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A;#6BCDCED;A<FG;;#8(/0%>#H/0')*#6IF<:;;D1<G;J4.%-K# #L#M?)#NOPMP1D6QCC3BPEM1PRN#S$B<;T#U'(-+,%(#-/00).#,(#+?)#NO/,(#SPV<TN#%&>/(,W/+,%(#X0%-Y#-/(#X)#*)0)-+).#.,&)-+0Z#U%&#NP[)(#/(.#7%(,+%&N#/U+)&#&,>?+F-0,-Y,(>#/(.#+?)#[&%>&/7#-%.)#,(#+?)#U'(-+,%(#-/(#+?'*#X)#7%(,+%&).4#\L#NOPMP1D6QCC3BPEM1PRN#S$B<;T#L#P[)(#/(.#7%(,+%&]# ###

Page 218: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A<#6BCDCED;A<FG;;#8(/0%>#H/0')*#6IF<:;;D1<G;J4.%-K# #�LM����N�O���N��P��Q����R#8*#+?)#S,(/0#*+)TU#V)#V/(+#+%#/&-?,@)#+?)#-%7T0)+)#T&%W)-+4#6)0)-+#+?)#R#X8&-?,@)#444X#-%77/(.#,(#+?)#R#XY&%W)-+X#7)('4#6)0)-+#/#S%0.)&#V?)&)#Z%'#V/(+#+%#/&-?,@)#Z%'&#T&%W)-+#/(.#*/@)#,+#V,+?#+?)#S,0)#+ZT)#[\]8#Y%&+/0#T&%W)-+#/&-?,@)[4##R#Y&%W)-+#R#8&-?,@)#R#\]8#Y%&+/0#T&%W)-+#/&-?,@)#R#;A<FG;;D8(/0%>DH/0')*D6IF_aabcdR#6/@)e# #f

Page 219: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A:#6BCDCED;A<FG;;#8(/0%>#H/0')*#6IF<:;;D1<G;J4.%-K# #L��M��N��O��E%4# 3)*-&,P+,%(# B%7P0)+).#<# B%7P,0,(>#*'--)**Q'0#/(.#R,+?%'+#)&&%&#7)**/>)# #:# 3%R(0%/.#*'--)**Q'0#/(.#R,+?%'+#)&&%&#7)**/>)# #A# 6R,+-?#%(#*+/+,%(#SFT;#U#<V#BW0,(.)&#&)+&/-+).#X#$)).Y/-Z#/-+,@/+).#SF[<#U#<V#C\C19CEB]#$$#SF8<#U#<V#(%+#/-+,@/+).#8_ \8 aB#7%.)#SF6;#U#<V#b'*?Y'++%(#/'+%7/+,-#*+%P#(%+#/-+'/+).#SF6:#U#<V#[&,)Q0W#P&)**#+?)#/'+%7/+,-#*+/&+#P'*?Y'++%(#SF6<#U#<V#6)(*%&#P/&+#/+#*0,.)#/-+,@/+).#SF[c#U#<V#+?)(#B%(@)W%&#7%+%&#F\<#@/&,/Y0)#*P)).#SFdA#U#<V#*R,+-?)*#%(#/(.#*+/W*#%(4#?)#*P)).#-%&&)*P%(.*#+%#+?)#*P)).#*)+P%,(+#,(#+?)#&/(>)#eXF#G;#&P7# #c# 6)(*%&#P/&+#/+#)(.#%Q#-%(@)W%&#/-+,@/+).#SF[I#U#<V#f#FdA#U#;#S/Q+)&#:#*)-%(.*V# #G# [&,)Q0W#P&)**#+?)#/'+%7/+,-#*+%P#P'*?Y'++%(#SF6:#U#;V#f#FdA#U#;# #=# 8-+,@/+)#C\C19CEB]#$$#SF8<#U#;V#f#FdA#U#;# #I# \/('/0#7%.)#SF6;#U#;V#f#FdA#U#;# #J# 6R,+-?#%QQ#*+/+,%(#SFT;#U#;V#f#FdA#U#;# #g# BW0,(.)&#(%+#&)+&/-+).#SF[<#U#;V#f#FdA#U#;# #<;# b&%h)-+#*'--)**Q'00W#/&-?,@).# ###

Page 220: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# AA#6BCDCED;A<FG;;#8(/0%>#H/0')*#6IF<:;;D1<G;J4.%-K# #L��M����N��LO����NP�Q��M����N�#�R(#+?,*#)K)&-,*)#/#STUVU1D6WCC3TUERVU1RE9S#X$B<<Y#Z'(-+,%(#[,00#\)#-&)/+).#/..,+,%(/00]4#V?)#/-+'/0#@/0')#[,00#\)#7/.)#/@/,0/\0)#+%#J#_6)(*%&#/-+'/0#@/0')#*)).#%Z#+?)#7%+%&#abF<;H#-%&&)*%(.*#+%#abF#G;#&7c#/*#/(#/(/0%>#@/0')#/(.#d')&,).#/+#/(#,('+#%Z#+?)#STUVU1D6WCC3TUERVU1RE9S#X$B<<Y#Z'(-+,%(4#V?)#./+/#+])#,*#<=F\,+#,(+)>)&#_R(+c4#V?,*#/-+'/0#*)).#@/0')#[,00#Z,&*+#\)#(%&7/0,e).#+%#+?)#&/(>)#abF#<#/*#A:F\,+#Z0%/+,(>F%,(+#('7\)&#_1)/0c#,(#+?)#Z'(-+,%(4#V?)#(%&7/0,e).#/-+'/0#*)).#@/0')#[,00#+?)(#\)#*-/0).#+%#&)@%0'+,%(*#)&#7,('+)#_&/(>)f#abF#G;#&7c#/*#A:F\,+#Z0%/+,(>F%,(+#('7\)&#_1)/0c#/(.#7/.)#/@/,0/\0)#/+#/(#%'+'+4#V?)#Z%00%[,(>#g#0,7,+#@/0')*#-/(#\)#*)-,Z,).#/*#A:F\,+#Z0%/+,(>F%,(+#('7\)&*#_1)/0c#/+#+?)#\0%-h#,('+*#,(#%&.)&#+%#7%(,+%&#+?)7#,(#+?)#Z'(-+,%(f#6)).#i#T%+%&D*)).D7%(,+%&,(>D)&&%&D7/K#6)).#i#T%+%&D*)).D7%(,+%&,(>D[/&(,(>D7/K#6)).#j#T%+%&D*)).D7%(,+%&,(>D[/&(,(>D7,(#6)).#j#T%+%&D*)).D7%(,+%&,(>D)&&%&D7,(##RZ#/#0,7,+#@/0')#,*#)K-)).).#%&#Z/00)(#\)0%[k#+?)#@/0')#V1lC#_<c#,*#/**,>().#+%#+?)#-%&&)*%(.,(>#%'+'+#\,+4##RZ#/#Z/'0+#,*#&)*)(+k#+?)#&%+)-+,@)#+&, ,(>#%Z#+?)#STUVU1D8lVUS#X$ <Y#Z'(-+,%(#\0%-h#[,00#\)#+&, ).4###

Page 221: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# AB#6CDEDFE;A<GH;;#8(/0%>#I/0')*#6JG<:;;E1<H;K4.%-L# #MN�����O����"������ �P)&)#Q%'#*))#+?)#+)-?(%0%>Q#.,/>&/7#R%&#+?)#+/*S4## #$,>'&)#AT#U)-?(%0%>Q#.,/>&/7# #$,>'&)#BT#C%(+&%0#V/()0##

Page 222: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# AB#6CDEDFE;A<GB;;#8(/0%>#H/0')*#6IG<:;;E1<B;J4.%-K# #LM��N�O���������P��Q?)#R%00%S,(>#*,>(/0*#/&)#&)T',&).#/*#>0%U/0#%V)&/(.*#R%&#+?,*#+/*W4# �� �"X�� ������O���� !������� Y��YZ�[#;4;# \]] # G8<# 1)+'&(#*,>(/0#)7)&>)(-_#*+%V#] # FC#[#;4<# \]] # G;# a/,(#*S,+-?#b]Fb# F]#[#;4:# \]] # G6;# a%.)#*)0)-+%&#7/('/0#c;de#/'+%7/+,-#c<d# a/('/0#f#;#8'+%#f#<#[#;4A# \]] # G6<# g'*?U'++%(#/'+%7/+,-#*+/&+# F]#[#;4h# \]] # G6:# g'*?U'++%(#/'+%7/+,-#*+%V# FC#[#;4B# \]] # G\<# 6)(*%&#-_0,(.)&#Gah#&)+&/-+).# F]#[#<4;# \]] # G\h# 6)(*%&#V/&+#/+#*0,.)# F]#[#<4A# \]] # G\I# 6)(*%&#V/&+#/+#)(.#%R#-%(@)_%&# F]#[i=h# \]] # G\J# 6)(*%&#/-+'/0#@/0')#*V)).#%R#+?)#7%+%&#jeG<;H#-%&&)*V%(.*#+%#jeG#B;#&V7# ## Z� �"X�� ������O���� !������� �k#;4:# \]] # GkA# C%(@)_%&#7%+%&#Ga<#@/&,/U0)#*V)).# #ki#=h# \]] # Gl<# a/(,V'0/+).#@/0')#*V)).#%R#+?)#7%+%&#,(#:#.,&)-+,%(*#jeG#<;H#-%&&)*V%(.*#+%#jeG#B;#&V7# #mnopoqrmstumuosouoqvomwxyzm#mmmmmm #LM{���������g0/(#+?)#,7V0)7)(+/+,%(#%R#+?)#+/*W#%(#_%'&#%S(4#3]# 3,>,+/0#]'+V'+#8]# 8(/0%>#]'+V'+#k# ]'+V'+#3[# 3,>,+/0#[(V'+#8[# 8(/0%>#[(V'+#[# [(V'+#FC# F%&7/00_#C0%*).##F]# F%&7/00_#]V)(##

Page 223: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# A=#6BCDCED;A<FG;;#8(/0%>#H/0')*#6IF<:;;D1<G;J4.%-K# #LM���N��O��P��Q��R����P��# E%4# 3)*-&,S+,%(# B%7S0)+).#<# B%7S,0,(>#*'--)**T'0#/(.#U,+?%'+#)&&%&#7)**/>)# #:# 3%U(0%/.#*'--)**T'0#/(.#U,+?%'+#)&&%&#7)**/>)# #A# 6U,+-?#%(#*+/+,%(#VFW;#X#<Y#BZ0,(.)&#&)+&/-+).#[#$)).\/-]#/-+,@/+).#VF<#X#<Y#C_C19CEB #a$$#VF8<#X#<Y#(%+#/-+,@/+).#8bca_8cdB#7%.)#VF6;#X#<Y#e'*?\'++%(#/'+%7/+,-#*+%S#(%+#/-+'/+).#VF6:#X#<Y#&,)T0Z#S&)**#+?)#/'+%7/+,-#*+/&+#S'*?\'++%(#VF6<#X#<Y#6)(*%&#S/&+#/+#*0,.)#/-+,@/+).#VFf#X#<Y#+?)(#B%(@)Z%&#7%+%&#_<#@/&,/\0)#*S)).#VFgA#X#<Y#*U,+-?)*#%(#/(.#*+/Z*#%(4#c?)#*S)).#-%&&)*S%(.*#+%#+?)#*S)).#*)+S%,(+#,(#+?)#&/(>)#h[F#G;#&S7# #f# 6)(*%&#S/&+#/+#)(.#%T#-%(@)Z%&#/-+,@/+).#VFI#X#<Y#i#FgA#X#;#V/T+)&#:#*)-%(.*Y# #G# &,)T0Z#S&)**#+?)#/'+%7/+,-#*+%S#S'*?\'++%(#VF6:#X#;Y#i#FgA#X#;# #=# 8-+,@/+)#C_C19CEB #a$$#VF8<#X#;Y#i#FgA#X#;# #I# _/('/0#7%.)#VF6;#X#;Y#i#FgA#X#;# #J# 6U,+-?#%TT#*+/+,%(#VFW;#X#;Y#i#FgA#X#;# #j# BZ0,(.)&#(%+#&)+&/-+).#VF<#X#;Y#i#FgA#X#;# #<;# 6S)).#k#_%+%&D*S)).D7%(,+%&,(>D)&&%&D7/K#i#FgA#X#;# #<<# 6S)).#l#_%+%&D*S)).D7%(,+%&,(>D)&&%&D7,(#i#FgA#X#;# #<:# e&%m)-+#*'--)**T'00Z#/&-?,@).# ## # #

Page 224: SCE-Basic Programming S7-1200 (2016)

������������������ ����������������������������������������������� ������!�����"�� !�!�#$%&#'(&)*+&,-+).#'*)#,(#).'-/+,%(/0#/(.#123#,(*+,+'+,%(*4#5#6,)7)(*#89#:;<=4#800#1,>?+*#1)*)&@).4# AB#6CDEDFE;A<GH;;#8(/0%>#I/0')*#6BG<:;;E1<H;J4.%-K# #L��������������M�� �������N%'#-/(#O,(.#/..,+,%(/0#,(O%&7/+,%(#/*#/(#%&,)(+/+,%(#/,.#O%&#,(,+,/0#/(.#/.@/(-).#+&/,(,(>P#O%&#)K/7Q0)R#9)++,(>#6+/&+).P#@,.)%*P#+'+%&,/0*P#/QQ*P#7/('/0*P#Q&%>&/77,(>#>',.)0,()*#/(.#+&,/0#*%O+S/&)TO,&7S/&)P#/+#+?)#O%00%S,(>#0,(UR####SSS4*,)7)(*4-%7T*-)T*BG<:;;##

Page 225: SCE-Basic Programming S7-1200 (2016)

����������������������������� ��������������������������������������� ����������������� ��������� �������������� !��"���� �#��� ���$�%����� �&� ������' �(��)��������!#� !*��+%�����,-./01234345/-611376869:/�����������������*��;�������<���=�������>?��@�����

Page 226: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 9"5@ABACB:D;E<::"8/$F./"2.*."G/$,H)"5IE;9::B0;J:K3-$,L"����M���������������N��O��P�Q����M�P���������������� P�R"���������S������������T�U�V�WP����Q��X�Y����������Y"Z%-(%"'$3["<A5I9;\E;GAD:E\7GD"R"���������S���������������WP����Q��X�Y����������Y"Z%-(%"'$3["<A5I9;\E;7AD:E\7GD"R"]N������������������S������_�������WQ����S�����X�WP����Q��X�Y����������Y"Z%-(%"'$3["<A5IK99E:77:DE\AJ��"a/(.)("'$*("*>.*"*>()("*%.+'(%"b.,H.=()".%("%(b/.,(-"c+*>")&,,())$%"b.,H.=()"c>('"'(,()).%d3"7'"$?(%?+(c"$e"*>(",&%%('*/d".?.+/.F/("5@A"b.,H.=()"+)"b%$?+-(-".*[")+(6(')3,$6f),(f*b""""�����������������#$%"%(=+$'./"5+(6(')"5@A",$'*+'&(-"*%.+'+'=g"b/(.)(",$'*.,*"d$&%"%(=+$'./"5@A",$'*.,*")+(6(')3,$6f),(f,$'*.,*"""�������������Q�� �������������������)+(6(')3,$6f),("""��Q�� ��������������P��h>("5@A"*%.+'+'=",&%%+,&/&6"e$%"*>("+'*(=%.*(-".&*$6.*+$'")$/&*+$'"h$*.//d"i'*(=%.*(-"7&*$6.*+$'"jhi7k"c.)"b%(b.%(-"e$%"*>("b%$=%.6"l5+(6(')"7&*$6.*+$'"@$$b(%.*()"c+*>"A-&,.*+$'"j5@Akl")b(,+e+,.//d"e$%"*%.+'+'="b&%b$)()"e$%"b&F/+,"(-&,.*+$'./".'-"012"+')*+*&*+$')3"5+(6(')"78"-$()"'$*"=&.%.'*(("*>(",$'*('*)3""h>+)"-$,&6('*"+)"*$"F("&)(-"$'/d"e$%"+'+*+./"*%.+'+'="$'"5+(6(')"b%$-&,*)f)d)*(6)3"h>+)"6(.')"+*",.'"F(",$b+(-"+'"c>$/("$%"b.%*".'-"=+?('"*$"*>$)("F(+'="*%.+'(-"e$%"&)("c+*>+'"*>("),$b("$e"*>(+%"*%.+'+'=3"@+%,&/.*+$'"$%",$bd+'="*>+)"*%.+'+'=",&%%+,&/&6".'-")>.%+'="+*)",$'*('*"+)"b(%6+**(-"c+*>+'"b&F/+,"*%.+'+'=".'-".-?.',(-"*%.+'+'="e.,+/+*+()"e$%"*%.+'+'="b&%b$)()3"""AL,(b*+$')"%(m&+%("c%+**('",$')('*"e%$6"*>("5+(6(')"78",$'*.,*["0$/.'-"5,>(&(%(%"%$/.'-3),>(&(%(%n)+(6(')3,$63""Zee('-(%)"c+//"F(">(/-"/+.F/(3"7//"%+=>*)"+',/&-+'="*%.')/.*+$'".%("%()(%?(-g"b.%*+,&/.%/d"+e"."b.*('*"+)"=%.'*(-"$%"."&*+/+*d"6$-(/"$%"-()+='"+)"%(=+)*(%(-3""o)("e$%"+'-&)*%+./",&)*$6(%",$&%)()"+)"(Lb%())/d"b%$>+F+*(-3"p("-$"'$*",$')('*"*$",$66(%,+./"&)("$e"*>("*%.+'+'=",&%%+,&/&6)3""p("c+)>"*$"*>.'H"*>("ho"2%()-('g"()b(,+.//d"a%$e3"2%3Ei'=3"q($'"o%F.)"&'-"2+b/3Ei'=3"7''(**"ae(ee(%g"*>("r+,>.(/"2s+.//.)"A'=+'((%+'="@$%b$%.*+$'".'-".//"$*>(%"+'?$/?(-"b(%)$')"e$%"*>(+%")&bb$%*"-&%+'="*>("b%(b.%.*+$'"$e"*>+)"*%.+'+'=",&%%+,&/&63"�

Page 227: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @"5ABCBDC:@;E<::"8/$F./"2.*."G/$,H)"5IE;9::C0;J:K3-$,L"M.F/("$N",$'*('*)";O 8$./"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"PO9O Q%(%(R&+)+*("3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"PO@O M>($%S"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"PO@3;O 2.*."F/$,H)"33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"PO@39O 2.*."*ST()"$N"*>("5UV7MUA"5IE;9::"33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"JO@3@O WT*+6+X(-"F/$,H)"33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"<O@3PO 2$Y'/$.-+'="Y+*>$&*"%(+'+*+./+X.*+$'"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"<OPO M.)H"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"IOJO Q/.''+'="333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"IOJ3;O 8/$F./"-.*."F/$,H"N$%")T((-",$'*%$/".'-")T((-"6$'+*$%+'="$N"*>("6$*$%"33333333333333333333333333333333333333"IOJ39O M(,>'$/$=S"-+.=%.6"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"KOJ3@O 0(N(%(',("/+)*"33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"ZO<O 5*%&,*&%(-")*(TEFSE)*(T"+')*%&,*+$')"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";:O<3;O 0(*%+(?(".'"(L+)*+'="T%$[(,*"33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333";:O<39O A%(.*("*>("=/$F./"-.*."F/$,H"\5QBB2CVWMW0\"333333333333333333333333333333333333333333333333333333333333333333333333";9O<3@O 7,,())"*$"-.*."$N"*>("-.*."F/$,H"+'"*>("$%=.'+X.*+$'"F/$,H"333333333333333333333333333333333333333333333333333333333";IO<3PO 5.?(".'-",$6T+/("*>("T%$=%.6"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9;O<3JO 2$Y'/$.-"*>("T%$=%.6"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"99O<3<O V$'+*$%]6$-+NS"?./&()"+'"-.*."F/$,H)"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9@O<3IO U'+*+./+X(")(*T$+'*)]%()(*")*.%*"?./&()"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9PO<3KO 5'.T)>$*)"+'"-.*."F/$,H)"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"9<O<3ZO BLT.'-"-.*."F/$,H".'-"-$Y'/$.-"+*"Y+*>$&*"%(+'+*+./+X.*+$'"33333333333333333333333333333333333333333333333333333333"@:O<3;:O7%,>+?("*>("T%$[(,*"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"@POIO A>(,H/+)*"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"@JOKO BL(%,+)("3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"@<OK3;O M.)H""BL(%,+)("33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"@<OK39O M(,>'$/$=S"-+.=%.6"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"@<OK3@O 0(N(%(',("/+)*"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"@IOK3PO Q/.''+'="33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"@IOK3JO A>(,H/+)*""BL(%,+)("3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"@KOZO 7--+*+$'./"+'N$%6.*+$'"3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"@ZO" " "

Page 228: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;K:L3-$,M"NOPQ�O������QOP�R�� PS��T�����������U��������N����V'"*>+)",>.W*(%X"Y$&"Z+//"G(,$6(".,[&.+'*(-"Z+*>"*>("&)("$\"=/$G./"-.*."G/$,I)"\$%"*>("5V]7 VA"5JF;9::"Z+*>"*>("V7"_$%*./"W%$=%.66+'="*$$/3"">("6$-&/("(MW/.+')"*>(")*%&,*&%(".'-",%(.*+$'"$\".'-".,,())"*$"=/$G./"-.*."G/$,I)"\$%"*>("5V]7 VA"5JF;9::3"V*"./)$")>$Z)"*>(")*(W)"\$%",%(.*+'="."=/$G./"-.*."G/$,I"+'"*>("V7"_$%*./".'-"\$%".,,())+'="*>+)"-.*."+'"*>("W%$=%.6"Z+*>"%(.-".'-"Z%+*(".,,())3"��������a����>+)",>.W*(%"G&+/-)"$'"*>(",>.W*(%"7'./$="b./&()"Z+*>"*>("5V]7 VA"5J"A_c;9;@A"2Ad2Ad2A3"e$&",.'"&)("*>("\$//$Z+'="W%$f(,*"\$%"*>+)",>.W*(%X"\$%"(M.6W/(g"h5ABCBDC:E;FK::C7'./$=Cb./&()C5JFijkklmnoipql"���r���!��s�������t���ua�V'",$'*%.)*"*$"/$=+,"G/$,I)X"-.*."G/$,I)",$'*.+'"'$"+')*%&,*+$')3"0.*>(%X"*>(Y")(%?(".)"6(6$%Y"\$%"&)(%"-.*.3"2.*."G/$,I)"*>&)",$'*.+'"?.%+.G/("-.*."*>.*"+)"&)(-"GY"*>("&)(%"W%$=%.63"e$&",.'"-(\+'("*>(")*%&,*&%("$\"=/$G./"-.*."G/$,I)".)"%([&+%(-3""8/$G./"-.*."G/$,I)")*$%("-.*."*>.*",.'"G("&)(-"vwxyzzx{|}~�xvz{���"�)(("#+=&%(";�3"�'/Y"*>(".))$,+.*(-"\&',*+$'"G/$,I")>$&/-".,,())"+')*.',("-.*."G/$,I)3">("6.M+6&6")+�("$\"-.*."G/$,I)"?.%+()"-(W('-+'="$'"*>("&*+/+�(-"A_c3"" "#+=&%(";g"2+\\(%(',("G(*Z(('"=/$G./"2H".'-"+')*.',("2H3"#&',*+$'C;:�#&',*+$'C;;� V')*.',("2H"�2HCV')*.',(��#&',*+$'C"G/$,IC;9� 8/$G./"2H"�2HC8/$G./�� 7,,())"\$%".//"G/$,I)"�7,,())"$'/Y"\$%""#&',*+$'C-.*.CG/$,IC;9�

Page 229: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;@:K3-$,L"7MM/+,.*+$'"(L.6M/()"N$%"��O��������O���PQ".%(R"S"5.?+'="$N"+'N$%6.*+$'".G$&*".")*$%.=(")T)*(63"UV>+,>"M%$-&,*"+)"/$,.*(-"W>(%(XU"S"5.?+'="$N"%(,+M()"N$%"M.%*+,&/.%"M%$-&,*)3"Y>("-.*."+'"-.*."G/$,I)"+)")*$%(-"%(*('*+?(/T"+'"6$)*",.)()3"Y>+)"-.*."+)"*>('"%(*.+'(-"+'"*>("(?('*"$N"."M$W(%"N.+/&%("$%".N*(%"."5YZ[\5Y70Y"$N"*>("A[]3"���������!_�Q����a�����������b������Y>("5cd7YcA"5JF;9::">.)"6.'T"-+NN(%('*"-.*."*TM()"N$%"%(M%()('*+'="-+NN(%('*"'&6(%+,./"N$%6.*)3"7"/+)*"$N")$6("$N"*>("(/(6('*.%T"-.*."*TM()"+)"=+?('"G(/$W3"������!_����e��fO��Qg�h���� �i� _��������Q���������!�H$$/" ;" :"*$";" Y0]Bj"#7k5Bj"Zj";"HT*(" K" ;<l::"*$";<l##" ;<l;9j";<l7H"V$%-" ;<" ;<l::::"*$";<l####" ;<l7HA2j";<l:::;"2V$%-" E9" ;<l::::::::"*$";<l########" ;<l:9m<K7AB"A>.%" K" ;<l::"*$";<l##" nonpqrstpqrut"5+'*" K" F;9K"*$";9J" ;9EjF;9E"c'*" ;<" FE9jJ<K"*$"E9jJ<J" ;9Ej"F;9E"2+'*" E9" F9j;mJjmKEj<mK"*$"9j;mJjmKEj<mJ" ;9Ej"F;9E"]5c'*" K" :"*$"9@@" ;9E"]/'*" ;<" :"*$"<@j@E@" ;9E"]2c'*" E9" :"*$"mj9vmjv<Jj9v@" ;9E"0(./" E9" w\F;3;K"L";:"FEK"*$"w\FE3m:"L";:"EK" ;9E3m@<j"FE3mj";39Bw;9""E3mBFE"k0(./" <m" w\F939E"L";:"FE:K"*$"w\F;3Jv"L";:"E:K";9Em@3;9Em@<JKv""F;39Bwm:"Y+6(" E9" YlF9m-C9:>CE;"6C9E)C<mK6)"*$"Yl9m-C9:>CE;"6C9E)C<mJ6)""5.?(-".)R"F9j;mJjmKEj<mK"6)"*$"w9j;mJjmKEj<mJ"6)" Yl@6CE:)""@lF9-"Yl;-C9>C;@6CE:LCm@6)"5*%+'=" x.%+.G/(" :"*$"9@m",>.%.,*(%)"+'"GT*(")+y(" z7HAz"7%%.T" " V+*>".%%.T)j"-.*."$N"."&'+N$%6"-.*."*TM("+)".%%.'=(-"$'(".N*(%"*>("$*>(%".'-".--%())(-",$')(,&*+?(/T"+'"*>(".--%())".%(.3"Y>("M%$M(%*+()"$N"(.,>".%%.T"(/(6('*".%("+-('*+,./".'-".%(",$'N+=&%(-"+'"*>(".%%.T"*.=3"""5*%&,*" " Y>("5Y0]AY"-.*."*TM("%(M%()('*)"."-.*.")*%&,*&%("*>.*",$')+)*)"$N"."N+L(-"'&6G(%"$N",$6M$'('*)"$N"-+NN(%('*"-.*."*TM()3"A$6M$'('*)"$N"5Y0]AY"$%"7007{"-.*."*TM(",.'"./)$"G("'()*(-"+'".")*%&,*&%(3"" "|" " #$%"$*>(%"-.*."*TM()j"%(N(%"*$"*>("$'/+'(">(/M3" "" "

Page 230: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" <"5@ABACB:D;E<::"8/$F./"2.*."G/$,H)"5IE;9::B0;J:K3-$,L"�M��NO�� �P���Q���RS�5IE;9::",$'*%$//(%)">.?("$T*+6+U(-"-.*.")*$%.=(3"V'"$T*+6+U(-"F/$,H)".//"*.=)".%(".&*$6.*+,.//W")$%*(-"F.)(-"$'"*>(+%"-.*."*WT(3"X>(")$%*+'="(')&%()"*>.*"-.*."=.T)"F(*Y(('"*>("*.=)".%("6+'+6+U(-".'-"*>("*.=)".%(")*$%(-"+'"."6.''(%"*>.*"$T*+6+U()"*>(+%".,,())"FW"*>(",$'*%$//(%3"Z"X>("*.=)".%("./Y.W)".,,())(-".)"[.)*".)"T$))+F/("F(,.&)("*>("[+/(")*$%.=("FW"*>(")W)*(6"+)"$T*+6+U(-".'-"+)"+'-(T('-('*"$["*>("-(,/.%.*+$'3"Z"X>(%("+)"'$"-.'=(%"$["+',$')+)*(',+()"-&("*$"+',$%%(,*\".F)$/&*(".,,())()"F(,.&)(")W6F$/+,".,,())"+)"=('(%.//W"&)(-3"Z"2(,/.%.*+$'",>.'=()"-$"'$*"%()&/*"+'".,,())"(%%$%)"F(,.&)(".,,())()"FW"T%$,())"?+)&./+U.*+$'")W)*(6)\"[$%"(L.6T/(\"$,,&%")W6F$/+,.//W3"Z"V'-+?+-&./"*.=)",.'"F(")(/(,*+?(/W"-([+'(-".)"%(*('*+?(3"Z"C$")(**+'=)".%("'((-(-"$%"T$))+F/("+'"*>("+')*.',("-.*."F/$,H3"A?(%W*>+'="Y+//"F(")(*"+'"*>(".))+='(-"#G"](3=3\"%(*('*+?+*W3"Z"_(6$%W"%()(%?()"+'"*>("-.*."F/$,H"('.F/(",>.'=()"*$"F("6.-("Y+*>$&*"/$))"$[".,*&./"?./&()"]-$Y'/$.-"Y+*>$&*"%(+'+*+./+U.*+$'3"�M���a��������a��b�������������P������X$"('.F/("*>(")&F)(c&('*"(-+*+'="$["&)(%"T%$=%.6)"*>.*".%("./%(.-W"%&''+'="+'"."@de\"*>("5IE;9::",$'*%$//(%)")&TT$%*"*>("$T*+$'"$["(LT.'-+'="*>("+'*(%[.,()"$["$T*+6+U(-"[&',*+$'"$%"-.*."F/$,H)"-&%+'="$T(%.*+$'3"f$&",.'"-$Y'/$.-"*>("6$-+[+(-"F/$,H)"Y+*>$&*")Y+*,>+'="*>(",$'*%$//(%"*$"5Xgd"6$-(".'-"Y+*>$&*".[[(,*+'="*>(".,*&./"?./&()"$["T%(?+$&)/W"-$Y'/$.-(-"*.=)3" "#+=&%("9h"2$Y'/$.-"Y+*>$&*"%(+'+*+./+U.*+$'"X>("[$//$Y+'=")*(T)",.'"F("T(%[$%6(-"Y>+/("*>(",$'*%$//(%"+)"+'"0eC"6$-(h";3"7,*+?.*("i2$Y'/$.-"Y+*>$&*"%(+'+*+./+U.*+$'i"93"V')(%*"'(Y/W"-([+'(-"*.=)"+'".'"(L+)*+'="F/$,H"D3"2$Y'/$.-"(LT.'-(-"F/$,H"*$"*>(",$'*%$//(%"X>("'(Y/W"-([+'(-"*.=)".%("+'+*+./+U(-3"X>("(L+)*+'="*.=)"%(*.+'"*>(+%",&%%('*"?./&(3"d%(%(c&+)+*(h"."6(6$%W"%()(%?("6&)*">.?("F(('"-([+'(-"[$%"*>("F/$,H"F([$%(>.'-".'-"*>("F/$,H"Y+*>"*>+)"6(6$%W"%()(%?("6&)*">.?("-$Y'/$.-(-"*$"*>("@de3"

Page 231: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5@F;9::C0;J:K3-$,L"M���NO�P'"*>+)",>.Q*(%R"*>("Q%$=%.6"S%$6",>.Q*(%"T5ABCBDC:E;FJ::"7'./$="U./&()C5@FVWXXYZ[\]]Z_Z(LQ.'-(-"*$"+',/&-("."-.*."G/$,I"*>.*",('*%.//"Q%$?+-()"*>("Q.%.6(*(%)"S$%"*>("*a$"S&',*+$')"TbcdcefghiijkcldecmY"n#A;:o".'-"TbcdcefZghiijbclpdceplqY"n#A;;o3"r���������s>("-.*."6.'.=(6('*".'-")(*Q$+'*")(**+'="S$%"*>("Ttusu0C5vBB2AuDs0uwT"n#A;:o".'-"Ttusu0C5vBB2tuDPsu0PD8T"n#A;;o"S&',*+$')"a+//"G(",.%%+(-"$&*"&)+'="*>("=/$G./"-.*."G/$,I"T5vBB2Ctusu0T"n2H9o3"s>+)"a+//"G(".--(-"*$"*>("T:E;FJ::C7'./$=CU./&()C5@F;9::T"Q%$x(,*3"s>+)"Q%$x(,*"6&)*"G("%(*%+(?(-"S%$6"*>(".%,>+?("G(S$%(>.'-3"P'"*>("Tt.+'T"nuH;o"$%=.'+y.*+$'"G/$,IR"*>("*a$"S&',*+$')"Ttusu0C5vBB2AuDs0uwT"n#A;:o".'-"Ttusu0C5vBB2tuDPsu0PD8T"n#A;;o"6&)*"*>('"G(",$''(,*(-"a+*>"*>("*.=)"S%$6"=/$G./"-.*."G/$,I"T5vBB2Ctusu0T"n2H9o3""rz��{��|��������|���O�}���N~����������������N~���� ����������}����� �����5Q((-")(*Q$+'*".'-".,*&./")Q((-"?./&("a+//"G(",%(.*(-"+'"0(./"-.*."S$%6.*"�E9FG+*"S/$.*+'=FQ$+'*"'&6G(%�".)"*>("S+%)*"*.=)"+'"*>("T5vBB2Ctusu0T"n2H9o"-.*."G/$,I3"s>(")Q((-")(*Q$+'*"+)"*>(%(G"=+?('"*>(")*.%*"?./&("�";:"%Q63"7")*%&,*&%("�5*%&,*�"�v$)+*+?(C5Q((-�"a+//"*>('"G(",%(.*(-"S$%"6$'+*$%+'="*>("Q$)+*+?(")Q((-"/+6+*)3"s>+)")*%&,*&%(",$'*.+')"*>("9"*.=)"�s>%()>$/-CB%%$%�"�)*.%*"?./&("�";J"%Q6�".'-"�s>%()>$/-C�.%'+'=�"�)*.%*"?./&("�";:"%Q6�"+'"0(./"-.*."S$%6.*"�E9FG+*"S/$.*+'=FQ$+'*"'&6G(%�".'-"*>("9"*.=)"�B%%$%�".'-"��.%'+'=�"+'"H$$/"-.*."S$%6.*"�G+'.%"'&6G(%�3"s>(")*%&,*&%("�5*%&,*�"�v$)+*+?(C5Q((-�"a+//"*>('"G("+')(%*(-".=.+'".)".",$Q".'-"%('.6(-"*$"�D(=.*+?(C5Q((-�"S$%"6$'+*$%+'="*>("'(=.*+?(")Q((-"/+6+*)3"s>("�s>%()>$/-CB%%$%�"*.="+)"=+?('"*>(")*.%*"?./&("F";<"%Q6".'-"*>("�s>%()>$/-C�.%'+'=�"*.="*>(")*.%*"?./&("F";�"%Q63""

Page 232: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;K:@3-$,L"MN�����O����!������ �P(%("Q$&")(("*>("*(,>'$/$=Q"-+.=%.6"R$%"*>("*.)I3"" "#+=&%("ES"T(,>'$/$=Q"-+.=%.6" "#+=&%("US"A$'*%$/"V.'(/""

Page 233: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;K:L3-$,M"NO��P�Q���������R��S>("T$//$U+'=")+='./)".%("%(V&+%(-".)"=/$G./"$W(%.'-)"T$%"*>+)"*.)I3"��� �!X�� ������Q���� ������� Y��YZ�[":3:" H\\]" F7;" 0(*&%'")+='./"(6(%=(',")*$W"\_" DA"[":3;" H\\]" F_:" .+'")U+*,>"a\Da" D\"[":39" H\\]" F5:" $-(")(/(,*$%"6.'&./"b:cd".&*$6.*+,"b;c" .'&./"e":"7&*$"e";"[":3E" H\\]" F5;" f&)>G&**$'".&*$6.*+,")*.%*" D\"[":3g" H\\]" F59" f&)>G&**$'".&*$6.*+,")*$W" DA"[":3K" H\\]" FH;" 5(')$%",/+'-(%"Fg"%(*%.,*(-" D\"[";3:" H\\]" FHg" 5(')$%"W.%*".*")/+-(" D\"[";3E" H\\]" FHJ" 5(')$%"W.%*".*"('-"$T",$'?($%" D\"[h<g" H\\]" FHL" 5(')$%".,*&./"?./&(")W((-"$T"*>("6$*$%"idF;:j",$%%()W$'-)"*$"idF"K:"%W6" ""�Z� �!X�� ������Q���� ������� �k":39" H\\]" FkE" A$'?($%"6$*$%"F;"?.%+.G/(")W((-" "kh"<g" H\\]" Fl;" .'+W&/.*(-"?./&(")W((-"$T"*>("6$*$%"+'"9"-+%(,*+$')"idF";:j",$%%()W$'-)"*$"idF"K:"%W6" "mnopoqrmstumuosouoqvomwxyzm"mmm"" 2\" 2+=+*./"\&*W&*"7\" 7'./$="\&*W&*"k" \&*W&*"2[" 2+=+*./"['W&*"7[" 7'./$="['W&*"[" ['W&*"DA" D$%6.//"A/$)(-""D\" D$%6.//"\W('""

Page 234: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" ;:"5@ABACB:D;E<::"8/$F./"2.*."G/$,H)"5IE;9::B0;J:K3-$,L"�����������M��N�O!�M��N���M�������M�P$&",.'"Q+'-"+')*%&,*+$')"$'">$R"*$",.%%S"$&*"T/.''+'="F(/$R3"UQ"S$&"./%(.-S">.?("."=$$-"&'-(%)*.'-+'="$Q"(?(%S*>+'=V"+*"R+//"F(")&QQ+,+('*"*$"Q$,&)"$'"*>("'&6F(%(-")*(T)3"W*>(%R+)(V")+6T/S"Q$//$R"*>("-(*.+/(-")*(T)"+'"*>("+')*%&,*+$')3"�X��Y�����Z������[�M����N��\����]"G(Q$%("R(",.'"(LT.'-"*>("5@ABACB:D;EJ::B7'./$=B_./&()B5IE;9::3.T;D"T%$a(,*"Q%$6",>.T*(%"5@ABACB:D;EJ::B7'./$=B_./&()B5IE;9::V"R("6&)*"%(*%+(?("*>+)"T%$a(,*"Q%$6"*>(".%,>+?(3"b$"%(*%+(?(".'"(L+)*+'="T%$a(,*"*>.*">.)"F(('".%,>+?(-V"S$&"6&)*")(/(,*"*>("%(/(?.'*".%,>+?("R+*>"]"c%$a(,*"]"0(*%+(?("+'"*>("T%$a(,*"?+(R3"@$'Q+%6"S$&%")(/(,*+$'"R+*>"WT('3""d]"c%$a(,*"]"0(*%+(?("]"5(/(,*"."3.T".%,>+?("]"WT('e"""]"b>("'(L*")*(T"+)"*$")(/(,*"*>("*.%=(*"-+%(,*$%S"R>(%("*>("%(*%+(?(-"T%$a(,*"R+//"F(")*$%(-3"@$'Q+%6"S$&%")(/(,*+$'"R+*>"Wf3""d]"b.%=(*"-+%(,*$%S"]"Wfe""

Page 235: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" ;;"5@ABACB:D;E<::"8/$F./"2.*."G/$,H)"5IE;9::B0;J:K3-$,L"M"5.?("*>("$N('(-"N%$O(,*"&'-(%"*>("'.6(":D;E<::B8/$F./B2.*.BG/$,H)B5IE;9::3""PM"Q%$O(,*"M"RSTUVSWVXVM":D;E<::B8/$F./B2.*.BG/$,H)B5IE;9::"M"5.?(Y" "�

Page 236: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" ;9"5@ABACB:D;E<::"8/$F./"2.*."G/$,H)"5IE;9::B0;J:K3-$,L"�M����������N����O��������O���P�Q�����R�S�STQ�U"5(/(,*"*>("VW%$=%.6"F/$,H)V"X$/-(%"$X"Y$&%"@WZ";9;[@"2@\2@\2@".'-"*>('",/+,H"]7--"'( "F/$,H]"*$",%(.*("."'( "=/$F./"-.*."F/$,H"*>(%(3"_U"@WZB;9;[@"@WZ";9;[@"2@\2@\2@a"U"7--"'( "F/$,Hb"""U"5(/(,*" "+'"*>("'(L*"-+./$=".'-"%('.6("Y$&%"'( "F/$,H"*$c"]5WAA2Bdefe0]3"5(/(,*"V8/$F./"2GV".)"*>("*Yg(3"f>("'&6F(%"V9V"+//"F(".&*$6.*+,.//Y".))+='(-3"5(/(,*"*>("]7--"'( ".'-"$g(']",>(,H"F$L3"@/+,H"]eh]3""_U U"C.6(c"5WAA2Bdefe0"U"fYg(c"8/$F./"2G"U""7--"'( ".'-"$g('"U"ehb""

Page 237: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" ;@"5ABCBDC:@;E<::"8/$F./"2.*."G/$,H)"5IE;9::C0;J:K3-$,L"M"N>("O5PBB2CQRNR0O"-.*."F/$,H"+)".&*$6.*+,.//S"-+)T/.S(-3"5*.%*"FS",%(.*+'="*>("U5T((-C5(*T$+'*U".'-"U5T((-C7,*&./CV./&(U"*.=)")>$W'">(%("W+*>"*>(+%".))$,+.*(-",$66('*)3"5(/(,*"U0(./U".)"*>("-.*."*ST(3"7/)$")(*".")*.%*"?./&("$X";:3:"%T6"X$%"*>("U5T((-C5(*T$+'*U3""YM"5T((-C5(*T$+'*"M"0(./"M";:3:"M"5T((-C7,*&./CV./&("M"0(./Z" "[\]_abcdebfgdcbfhbigeebifjkfkflmbcn"M"D(L*"W(",%(.*("."*.=")*%&,*&%("U5*%&,*U")$"+*",.'"F("-&T/+,.*(-"/.*(%3"YM"5*%&,*Z" ""

Page 238: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" ;@"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;K:L3-$,M"N"D.6("*>(")*%&,*&%("OP$)+*+?(C5Q((-O".'-"('*(%".",$66('*3""RN"P$)+*+?(C5Q((-S" ""N"A%(.*("*>("*.=)"T$%"*>(")Q((-"6$'+*$%+'="U+*>"*>(",$%%()Q$'-+'=")*.%*"?./&()"G(/$U"*>(")*%&,*&%(".)")>$U'">(%(3" "VWXYZ[\][_][ab[_][ac][db ]da[efaf[agh]i["

Page 239: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" ;@"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;@:K3-$,L"M"N>('")(/(,*"*>(")*%&,*&%(".'-",$OP"+*3""QM"A$OPR" ""M"S.)*("*>(",$O+(-")*%&,*&%("G(/$T"*>("US$)+*+?(C5O((-U")*%&,*&%(".=.+'3""QM"S.)*(R" "

Page 240: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" ;<"5@ABACB:D;E<::"8/$F./"2.*."G/$,H)"5IE;9::B0;J:K3-$,L"M"0('.6("*>("'(N")*%&,*&%("*$"OC(=.*+?(B5P((-O".'-"('*(%".",$66('*3""QM"C(=.*+?(B5P((-R" ""M"2$"'$*"S$%=(*"*$",/+,H" 3"T>("S+'+)>(-"=/$F./"-.*."F/$,H"U5VAA2BWXTX0U"Y2G9Z"+)")>$N'"F(/$N3"@>(,H"*$"?(%+S["*>.*"0(*.+'"+)")(/(,*(-"".'-"*>(",$%%()P$'-+'=")*.%*"?./&("+)"('*(%(-"S$%".//"*.=)3"T>("-.*."N+//"*>&)"F("%(*.+'(-"+'"*>("-.*."F/$,H"(?('".S*(%"."P$N(%"S.+/&%("$%"."5TXV\5T70T"$S"*>("@V]3"T>(",>(,H"F$L()"S$%"O7,,())+F/("S%$6"W_O"".'-"O+)+F/("+'"W_O"")>$&/-"./)$".//">.?(".",>(,H"6.%H")$"*>.*".//"*.=)"+'"S&*&%("(LP.')+$')"$S"*>+)"P%$a(,*"N+//"F(".,,())+F/("F["*>("?+)&./+b.*+$'")[)*(6)"QW_R3"c("N+//")(/(,*"*>("O5(*P$+'*O",>(,H"F$L""$'/["S$%"*>("-(S.&/*"?./&()"+'"$&%"-.*."F/$,H3""QM""""R" "defghijklimnliopinlqrostqnisniulnvwsxluipmwqklwixlyozistiqklinqlr{x|{nqlristnqwmvqsotn}i

Page 241: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" ;@"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5@F;9::C0;J:K3-$,L"�M������NN����������O��P�������Q���R�����P�������S������Q���R�T"UVWXYZ[WY\] _XYaUbcdYefgX_hZ_eXYijeklYm_Z[YYneoijWF,/+,I3"""T"pWjWZWYZ[WYZWqVeffrYZgsY_XY\] _XYaUbcdYZ[ZYfWYXeYjeXgWfYXWWnWntYUXjrYZ[WYbeejWXY*.="uv$*$%C5w((-CA$'*%$/C0(*Cx./u"+)")*+//"'((-(-3""yT"2(/(*(z" ""

Page 242: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" ;@"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;K:@3-$,L"M"N.?("*>("O5PBB2CQRSR0O"T2H9U"-.*."G/$,I".'-"*>("OQ.+'O"TRH;U"$%=.'+V.*+$'"G/$,I"-+)W/.X(-")+-("GX")+-("GX",/+,I+'="*>("Y Y"+,$'"*$"?(%*+,.//X")W/+*"*>("(-+*$%".%(.3""ZM" [" ""M"\)("-%.=F.'-F-%$W"*$"6$?("*>("*.=)"'((-(-"]$%"*>("+'*(%,$''(,*+$'"]%$6"*>("O5PBB2CQRSR0O"T2H9U"-.*."G/$,I"$'*$"*>(",$''(,*+$')"$]"*>(",.//(-"]&',*+$')".'-"]&',*+$'"G/$,I)"+'"*>("OQ.+'O"TRH;U"$%=.'+V.*+$'"G/$,I3"#+%)*"("6$?("*>("Y5W((-C7,*&./C_./&(Y"*.="$'*$"*>("Y7,*&./C)W((-Y"$&*W&*"$]"*>("OQRSR0C5PBB2QRDSR0D8O"T#A;;U"G/$,I3"ZM"5W((-C7,*&./C_./&([" ""

Page 243: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" ;@"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;K:L3-$,M"N"7/)$",$''(,*"*>("$*>(%",$'*.,*)"+'"D(*O$%I";"O+*>"*.=)"P%$6"*>("Q5RBB2CSTUT0Q"V2H9W"-.*."G/$,I".)")>$O'">(%(3"" ""N"A$''(,*"*>(",$'*.,*)"+'"D(*O$%I"9"O+*>"*.=)"P%$6"*>("Q5RBB2CSTUT0Q"V2H9W"-.*."G/$,I".)")>$O'">(%(3"" "

Page 244: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 9:"5@ABACB:D;E<::"8/$F./"2.*."G/$,H)"5IE;9::B0;J:K3-$,L"M"@$''(,*"*>(",$'*.,*)"+'"C(*N$%H"D"N+*>"*.=)"O%$6"*>("P5QAA2BRSTS0P"U2G9V"-.*."F/$,H".)")>$N'">(%(3"" ""

Page 245: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 9;"5@ABACB:D;E<::"8/$F./"2.*."G/$,H)"5IE;9::B0;J:K3-$,L"�MN���O�������� P�����Q��P���� �R"S$").?("T$&%"U%$V(,*W",/+,H"*>(" "F&**$'"+'"*>("6('&3"S$",$6U+/(".//"F/$,H)W",/+,H"*>("XY%$=%.6"F/$,H)X"Z$/-(%".'-")(/(,*"*>(" "+,$'"Z$%",$6U+/+'="+'"*>("6('&3""[R "R"Y%$=%.6"F/$,H)"R" \" "R"S>("X]'Z$XW"X@$6U+/(X".%(.")>$ )">+,>"F/$,H)"(%(")&,,())Z&//T",$6U+/(-3" "�

Page 246: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 99"5@ABACB:D;E<::"8/$F./"2.*."G/$,H)"5IE;9::B0;J:K3-$,L"�MN���O�������P��Q���� �R"7S*(%")&,,())S&/",$6T+/.*+$'U"*>(",$6T/(*(",$'*%$//(%"V+*>"*>(",%(.*(-"T%$=%.6"+',/&-+'="*>(">.%-V.%(",$'S+=&%.*+$'",.'U".)"-(),%+F(-"+'"*>("T%(?+$&)"6$-&/()U"F("-$V'/$.-(-3"WR" X" "�

Page 247: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 9@"5ABCBDC:@;E<::"8/$F./"2.*."G/$,H)"5IE;9::C0;J:K3-$,L"�M���������� ���N!�O���P���������Q���RP"�S"T>("-()+%(-"F/$,H"6&)*"F("$U('"V$%"6$'+*$%+'="*>("*.=)"$V"."-$W'/$.-(-"-.*."F/$,H3"T>("6$'+*$%+'=",.'"*>('"F(".,*+?.*(-X-(.,*+?.*(-"FY",/+,H+'="*>(" "+,$'3""ZS"5[BB2C\]T]0"2G9_"S" " ""S"a'"*>("b\$'+*$%"?./&(b",$/&6'c"*>("?./&()",&%%('*/Y".?.+/.F/("+'"*>("A[d",.'"F("6$'+*$%(-3"""

Page 248: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 9@"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;K:L3-$,M"N"OP"Q$&%"%+=>*F,/+,I"$'"$'("$P"*>("?./&()R"*>("ST$-+PQS"-+./$="P$%"6$-+PQ+'="*>+)"?./&("$U(')"VN"T$-+PQ"N"T$-+PQ"?./&(W";:3:"N"XYZ" "�[\���������]����_�������������������N"a>(")(*U$+'*)",.'"G("+'+*+./+b(-"GQ",/+,I+'="*>("S S"+,$'3"#$%"*>("*.=)"c>$)("S5(*U$+'*S",>(,I"G$M"+)")(/(,*(-""R"*>(")*.%*"?./&("c+//"*>('"G(".UU/+(-".)"*>(",&%%('*"?./&(3""VN Z" ""

Page 249: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 9@"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;@:K3-$,L"M"7//")*.%*"?./&()",.'"G("%()(*"GN",/+,I+'="*>(" "+,$'3""OM" P"" """"

Page 250: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 9<"5@ABACB:D;E<::"8/$F./"2.*."G/$,H)"5IE;9::B0;J:K3-$,L"�MN����OPQ��P���������R���SP�T"UV"W$&",/+,H"*>("X X"+,$'Y".")'.Z)>$*"$V"*>("6$'+*$%(-"?./&()",.'"F("*.H('"+'"$%-(%"*$".ZZ/W"*>()("?./&()".)")*.%*"?./&()"$%"*$"*%.')V(%"*>(6"F.,H"*$"*>("@[\"/.*(%""]T" 3" """

Page 251: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 9@"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5@F;9::C0;J:K3-$,L"M"7/*(%'.*+?(/NO"?./&()"P%$6"*>(")'.Q)>$*",.'"G(".QQ/+(-"GN",/+,I+'="*>("R R"+,$'"P$%".//"?./&()"$%"GN",/+,I+'="*>("R R"+,$'"P$%"*>(")*.%*"?./&()"$'/N3"S'/N"*>(")(*Q$+'*)".%("'((-(-">(%("+'"6$)*",.)()""TM" U" """

Page 252: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 9@"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;K:@3-$,L"M"N$"*%.')O(%"-.*.",.P*&%(-"+'"*>(")'.P)>$*"G.,I"*$"*>("AQRS"T$&"6&)*",/+,I"U U3""VM" "W" ""

Page 253: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" 9@"5ABCBDC:E;F<::"8/$G./"2.*."H/$,I)"5JF;9::C0;K:L3-$,M"N"OP"Q$&"R.'*"*$"$?(%R%+*(".//")(*S$+'*)"R+*>"*>(")*.%*"?./&()T"Q$&",.'"+'+*+.*("*>+)"GQ",/+,I+'="UU3"V>("?./&()"+'"*>("AWX"P$%"R>+,>"*>("U5(*S$+'*U",>(,I"G$M"R.)"'$*")(/(,*(-".%("*>(%(GQ"%(*.+'(-3""YN" Z" """

Page 254: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @:"5ABCBDC:@;E<::"8/$F./"2.*."G/$,H)"5IE;9::C0;J:K3-$,L"�MN��OP���������Q���R�������S���������S��T�������������U������V"W$"('.F/("X2$Y'/$.-"Y+*>$&*"%(+'+*+./+Z.*+$'X"[$%"*>("\5]BB2C _W_0\"2G9a"-.*."F/$,Hb"c$&"6&)*"=$"$[[/+'("X X".'-"*>('"$d('"*>("d%$d(%*+()"$["*>("-.*."F/$,H3""eV" "V"5]BB2C _W_0"2G9a"V"]%$d(%*+()f" ""V"5(/(,*"*>("X_d*+6+Z(-"F/$,H".,,())X",>(,H"F$L""+'"*>("d%$d(%*+()"&'-(%"X8('(%./Xb"X7**%+F&*()X3""eV"8('(%./"V"7**%+F&*()"V""_d*+6+Z(-"F/$,H".,,())f" ""

Page 255: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @;"5ABCBDC:@;E<::"8/$F./"2.*."G/$,H)"5IE;9::C0;J:K3-$,L"M"7))+='"."N0(*('*+?("6(6$%O"%()(%?(N"*$"*>("-.*."F/$,H"P$%"N2$Q'/$.-"Q+*>$&*"%(+'+*+./+R.*+$'N3""SM2$Q'/$.-"Q+*>$&*"%(+'+*+./+R.*+$'"M"0(*('*+?("6(6$%O"%()(%?("M";:"FO*()"M"TUV"""M"2$Q'/$.-"O$&%"W5XBB2CYTZT0W"[2G\"-.*."F/$,H"*$"*>(",$'*%$//(%".=.+'".'-")(/(,*"NN3""SM5XBB2CYTZT0"[2G\"M" "M" V" "

Page 256: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @9"5ABCBDC:@;E<::"8/$F./"2.*."G/$,H)"5IE;9::C0;J:K3-$,L"M"N>('",/+,H"*>("O O"+,$'"*$".,*+?.*("-$P'/$.-+'="P+*>$&*"%(+'+*+./+Q.*+$'".'-",$'R+%6"*>(").R(*S"T%$6T*"P+*>"OUVO3""WM" "M"UVX" ""

Page 257: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @@"5ABCBDC:@;E<::"8/$F./"2.*."G/$,H)"5IE;9::C0;J:K3-$,L"M"D(L*".--".'N"*.="+'"N$&%"-.*."F/$,H"OM"D.6(P"Q./&(C*()*"M"2.*."*NR(P"0(./"M"5*.%*"?./&(P"SS3:T" "M"2$U'/$.-"N$&%"V5WBB2CXYZY0V"[2G\"-.*."F/$,H"*$"*>(",$'*%$//(%".=.+'3"OM5WBB2CXYZY0"[2G\"M" "M"2$U'/$.-T" ""

Page 258: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @A"5BCDCED:@;F<::"8/$G./"2.*."H/$,I)"5JF;9::D0;K:L3-$,M"N"OP"Q$&",/+,I"R R"*$"6$'+*$%"*>("G/$,I".=.+'S"Q$&"T+//")(("*>.*"*>("6$'+*$%(-"?./&()"P$%"*>("U%(?+$&)/Q"(M+)*+'="*.=)">.?("'$*"G(('"$?(%T%+**('"T+*>"*>(")*.%*"?./&()3""VN" W" ""�X������Y�Z���Y��[��\����N"7)"*>("P+'./")*(US"T("T.'*"*$".%,>+?("*>(",$6U/(*("U%$](,*3"5(/(,*"*>("N"R7%,>+?("333R",$66.'-"+'"*>("N"R%$](,*R"6('&3"5(/(,*"."P$/-(%"T>(%("Q$&"T.'*"*$".%,>+?("Q$&%"U%$](,*".'-").?("+*"T+*>"*>("P+/("*QU("_O7"$%*./"U%$](,*".%,>+?(_3""VN"%$](,*"N"7%,>+?("N"O7"$%*./"U%$](,*".%,>+?("N":@;F<::D8/$G./D2.*.DH/$,I)D5JFabccdefN"5.?(W" "

Page 259: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @A"5BCDCED:@;F<::"8/$G./"2.*."H/$,I)"5JF;9::D0;A:K3-$,L"M��N��O��P��E$3" 2(),%+Q*+$'" B$6Q/(*(-";" 2.*."G/$,I"5RCC2DSTUT0"V2H9W")&,,())X&//Y",%(.*(-3" "9" R%$=%.6",>.'=()"6.-("+'"S.+'"VTH;W3" "@" B$6Q+/+'=")&,,())X&/".'-"Z+*>$&*"(%%$%"6()).=(" "[" 2$Z'/$.-")&,,())X&/".'-"Z+*>$&*"(%%$%"6()).=(" "A" 5Z+*,>"$'")*.*+$'"\F]:"";_"BY/+'-(%"%(*%.,*(-""#((-G.,I".,*+?.*(-"\FH;"";_"CSC08CEBa"T##"\F7;"";_"'$*".,*+?.*(-"7bUTS7UcB"6$-("\F5:"";_"R&)>G&**$'".&*$6.*+,")*$Q"'$*".,*&.*(-"\F59"";_"H%+(X/Y"Q%())"*>(".&*$6.*+,")*.%*"Q&)>G&**$'"\F5;"";_"5(')$%"Q.%*".*")/+-(".,*+?.*(-"\FH["";_"*>('"B$'?(Y$%"6$*$%"S;"?.%+.G/(")Q((-"\Fd@"";_")Z+*,>()"$'".'-")*.Y)"$'3"U>(")Q((-",$%%()Q$'-)"*$"*>(")Q((-")(*Q$+'*"+'"*>("%.'=("eF"A:"%Q6" "<" 5(')$%"Q.%*".*"('-"$X",$'?(Y$%".,*+?.*(-"\FHJ"";_"f"Fd@"":"\.X*(%"9")(,$'-)_" "J" H%+(X/Y"Q%())"*>(".&*$6.*+,")*$Q"Q&)>G&**$'"\F59"":_"f"Fd@"":" "K" 7,*+?.*("CSC08CEBa"T##"\F7;"":_"f"Fd@"":" "g" S.'&./"6$-("\F5:"":_"f"Fd@"":" ";:" 5Z+*,>"$XX")*.*+$'"\F]:"":_"f"Fd@"":" ";;" BY/+'-(%"'$*"%(*%.,*(-"\FH;"":_"f"Fd@"":" ";9" 5Q((-"h"S$*$%D)Q((-D6$'+*$%+'=D(%%$%D6.L"f"Fd@"":" ";@" 5Q((-"i"S$*$%D)Q((-D6$'+*$%+'=D(%%$%D6+'"f"Fd@"":" ";[" R%$j(,*")&,,())X&//Y".%,>+?(-" ""

Page 260: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @<"5ABCBDC:@;E<::"8/$F./"2.*."G/$,H)"5IE;9::C0;J:K3-$,L"M��N����O��MP����OQ�R��N����O�"�S'"*>+)"(L(%,+)("."=/$F./"-.*."F/$,H"TU787VSDBCWX75YSAT"Z2G@["\+//"F(",%(.*(-".--+*+$'.//]3"Y>(")(*$+'*".'-".,*&./"?./&("$_"*>(",$&'*(%"_$%"*>("/.)*+,".%*)"\+//"F(")(,+_+(-".'-"-+)/.](-"+'"*>+)"-.*."F/$,H3"7",$''(,*.F/("+'&*"_$%"*>(")(*$+'*")(**+'=".'-".'"$&*&*"_$%"-+)/.]+'="*>(".,*&./"?./&("\+//"./)$"F(".--(-"*$"*>("TU Y 0C7aY T"Z#G;["_&',*+$'"F/$,H3""MP�����b����!������ �c(%("]$&")(("*>("*(,>'$/$=]"-+.=%.6"_$%"*>("*.)H3"" "#+=&%("Jd"Y(,>'$/$=]"-+.=%.6" "#+=&%("<d"A$'*%$/".'(/""

Page 261: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @A"5BCDCED:@;F<::"8/$G./"2.*."H/$,I)"5AF;9::D0;J:K3-$,L"MN��O�P���������Q��R>("S$//$T+'=")+='./)".%("%(U&+%(-".)"=/$G./"$V(%.'-)"S$%"*>+)"*.)I3"��� �!W�� ������P���� ������� X��XY�Z":3:" H[[\" F7;" 0(*&%'")+='./"(6(%=(',]")*$V"[ " EB"Z":3;" H[[\" F:" _.+'")T+*,>"[E" E["Z":39" H[[\" F5:" _$-(")(/(,*$%"6.'&./"a:bc".&*$6.*+,"a;b" _.'&./"d":"7&*$"d";"Z":3@" H[[\" F5;" e&)>G&**$'".&*$6.*+,")*.%*" E["Z":3f" H[[\" F59" e&)>G&**$'".&*$6.*+,")*$V" EB"Z":3J" H[[\" FH;" 5(')$%",]/+'-(%"F_f"%(*%.,*(-" E["Z";3:" H[[\" FHf" 5(')$%"V.%*".*")/+-(" E["Z";3@" H[[\" FHA" 5(')$%"V.%*".*"('-"$S",$'?(]$%" E["Zg<f" H[[\" FHK" 5(')$%".,*&./"?./&(")V((-"$S"*>("6$*$%"hcF;:i",$%%()V$'-)"*$"hcF"J:"%V6" ""�Y� �!W�� ������P���� ������� �j":39" H[[\" Fj@" B$'?(]$%"6$*$%"F_;"?.%+.G/(")V((-" "jg"<f" H[[\" Fk;" _.'+V&/.*(-"?./&(")V((-"$S"*>("6$*$%"+'"9"-+%(,*+$')"hcF";:i",$%%()V$'-)"*$"hcF"J:"%V6" "lmnonpqlrstltnrntnpunlvwxyl"""""ll "MNz���������e/.'"*>("+6V/(6('*.*+$'"$S"*>("*.)I"$'"]$&%"$T'3"2[" 2+=+*./"[&*V&*"7[" 7'./$="[&*V&*"j" [&*V&*"2Z" 2+=+*./"Z'V&*"7Z" 7'./$="Z'V&*"Z" Z'V&*"EB" E$%6.//]"B/$)(-""E[" E$%6.//]"[V('""

Page 262: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @A"5BCDCED:@;F<::"8/$G./"2.*."H/$,I)"5JF;9::D0;K:A3-$,L"MNO��P��Q��R��S��T����R��" E$3" 2(),%+U*+$'" B$6U/(*(-";" 2.*."G/$,I"V787WXECDYZ75[XB"\2H@]")&,,())&//_",%(.*(-3" "9" Y%$=%.6",>.'=()"6.-("+'"V [ 0D7a[ "\#H;]3" ""@" Y%$=%.6",>.'=()"6.-("+'"V.+'"\H;]3" "b" B$6U+/+'=")&,,())&/".'-"c+*>$&*"(%%$%"6()).=(" "K" 2$c'/$.-")&,,())&/".'-"c+*>$&*"(%%$%"6()).=(" "<" 5c+*,>"$'")*.*+$'"dFe:"f";g"B_/+'-(%"%(*%.,*(-"h"#((-G.,I".,*+?.*(-"dFH;"f";g"CVC08CEBi"##"dF7;"f";g"'$*".,*+?.*(-"7a[ V7[XB"6$-("dF5:"f";g"Y&)>G&**$'".&*$6.*+,")*$U"'$*".,*&.*(-"dF59"f";g"H%+(/_"U%())"*>(".&*$6.*+,")*.%*"U&)>G&**$'"dF5;"f";g"5(')$%"U.%*".*")/+-(".,*+?.*(-"dFHb"f";g"*>('"B$'?(_$%"6$*$%"V;"?.%+.G/(")U((-"dFj@"f";g")c+*,>()"$'".'-")*._)"$'3"[>(")U((-",$%%()U$'-)"*$"*>(")U((-")(*U$+'*"+'"*>("%.'=("khF"K:"%U6" "J" 5(')$%"U.%*".*"('-"$",$'?(_$%".,*+?.*(-"dFHJ"f";g"l"Fj@"f":"d.*(%"9")(,$'-)g" "A" H%+(/_"U%())"*>(".&*$6.*+,")*$U"U&)>G&**$'"dF59"f":g"l"Fj@"f":" "m" 7,*+?.*("CVC08CEBi"##"dF7;"f":g"l"Fj@"f":" ";:" V.'&./"6$-("dF5:"f":g"l"Fj@"f":" ";;" 5c+*,>"$")*.*+$'"dFe:"f":g"l"Fj@"f":" ";9" B_/+'-(%"'$*"%(*%.,*(-"dFH;"f":g"l"Fj@"f":" ";@" 5U((-"n"V$*$%D)U((-D6$'+*$%+'=D(%%$%D6.L"l"Fj@"f":" ";b" 5U((-"o"V$*$%D)U((-D6$'+*$%+'=D(%%$%D6+'"l"Fj@"f":" ";K" Y%$p(,*")&,,())&//_".%,>+?(-" "

Page 263: SCE-Basic Programming S7-1200 (2016)

������������������ ������������������������������������������������������ �����!��� � �"#$%"&'%()*%+,*(-"&)("+'"(-&,.*+$'./".'-"012"+')*+*&*+$')3"4"5+(6(')"78"9:;<3"7//"0+=>*)"0()(%?(-3" @A"5BCDCED:@;F<::"8/$G./"2.*."H/$,I)"5JF;9::D0;K:L3-$,M"N��������������O�� �������P$&",.'"Q+'-".--+*+$'./"+'Q$%6.*+$'".)".'"$%+('*.*+$'".+-"Q$%"+'+*+./".'-".-?.',(-"*%.+'+'=R"Q$%"(M.6S/(T"8(**+'="5*.%*(-R"?+-($)R"*&*$%+./)R".SS)R"6.'&./)R"S%$=%.66+'="=&+-(/+'()".'-"*%+./")$Q*U.%(VQ+%6U.%(R".*"*>("Q$//$U+'="/+'IT""""UUU3)+(6(')3,$6V),(V)JF;9::""""