0% found this document useful (0 votes)
260 views87 pages

TIA Portal Guide for Engineers

This document is a manual for the TIA Portal that describes its basic functions and operations. It includes sections on creating a first project, basic programming with contacts and coils, bit operations, timers, counters, comparators, moves, conversions, and program control operations. The manual provides documentation on the different operations that can be used to write automation programs in the TIA Portal software.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
260 views87 pages

TIA Portal Guide for Engineers

This document is a manual for the TIA Portal that describes its basic functions and operations. It includes sections on creating a first project, basic programming with contacts and coils, bit operations, timers, counters, comparators, moves, conversions, and program control operations. The manual provides documentation on the different operations that can be used to write automation programs in the TIA Portal software.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 87

1

TIA Portal Manual – July 2013

Table of Contents
Introduction .................................................................................................................................... 8
The Videos....................................................................................................................................... 8
The Documentations....................................................................................................................... 8
Siemen’s Support ............................................................................................................................ 8
Creating your first Project .............................................................................................................. 9
Initialization ................................................................................................................................ 9
Writing a simple program:............................................................................................................. 14
Bit operations: ............................................................................................................................... 14
---| / |---: Normally closed contact ................................................................................................ 15
--|NOT|--: Invert RLO ................................................................................................................... 16
--- ( ) ---: Assignment ..................................................................................................................... 17
Declaration and data type: ......................................................................................................... 17
-- (/)--: Negate assignment ............................................................................................................ 17
---(R) ---: Reset output .................................................................................................................. 17
---(S) ---: Set output .......................................................................................................................18
SET_BF: Set bit field ..................................................................................................................... 19
Declaration: ................................................................................................................................ 19
Data types:.................................................................................................................................. 19
RESET_BF: Reset bit field............................................................................................................. 19
SR: Set/reset flip-flop ................................................................................................................... 20
RS: Reset/set flip-flop.................................................................................................................... 21
--|P|--: Scan operand for positive signal edge ............................................................................... 21
--|N|--: Scan operand for negative signal edge ............................................................................ 22
--(P)--: Set operand on positive signal edge ................................................................................. 23
-- (N)--: Set operand on negative signal edge ............................................................................... 24
Timer operations: ......................................................................................................................... 25
TP: Generate pulse: ................................................................................................................... 25
TON: Generate on-delay: .......................................................................................................... 26
TOF: Generate off-delay:........................................................................................................... 26
TONR: Time accumulator: ........................................................................................................... 27
Counter operation: ........................................................................................................................ 27
CTU: Count up: ......................................................................................................................... 27

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
2
TIA Portal Manual – July 2013

Parameters: ........................................................................................................................... 27
CTD: Countdown: ..................................................................................................................... 29
CTUD: Count up and down ....................................................................................................... 29
Comparators operations: ............................................................................................................... 31
CMP ==: Equal:.......................................................................................................................... 31
CMP <>: Not equal: .................................................................................................................. 32
CMP >=: Greater or equal............................................................................................................. 33
CMP <=: Less or equal: ............................................................................................................. 34
CMP >: Greater than: ................................................................................................................ 34
CMP <: Less than: ..................................................................................................................... 35
IN_RANGE: Value within range:.............................................................................................. 36
OUT_RANGE: Value outside range:......................................................................................... 36
----I OK I----: Check validity: .................................................................................................... 37
----I NOT_OK I----: Check invalidity:....................................................................................... 38
Move operation: ............................................................................................................................ 38
MOVE: Move value: .................................................................................................................. 38
Possible transfers: ................................................................................................................. 38
FieldRead: Read field: ............................................................................................................... 40
Field Write: Write field .............................................................................................................. 41
MOVE_BLK: Move block ........................................................................................................... 41
UMOVE_BLK: Move block uninterruptible ............................................................................. 42
FILL_BLK: Fill block: ............................................................................................................... 43
UFILL_BLK: Fill block uninterruptible:................................................................................... 44
Conversion operation: .................................................................................................................. 45
CONVERT: Convert value: ........................................................................................................ 45
ROUND: Round numerical value ............................................................................................. 46
CEIL: Generate next higher integer from floating-point number ............................................ 47
FLOOR: Generate next lower integer from floating-point number .......................................... 47
TRUNC: Truncate numerical value:.......................................................................................... 48
SCALE_X: Scale: ....................................................................................................................... 49
NORM_X: Normalize: .............................................................................................................. 50
Program control operations:.......................................................................................................... 51
--- (JMP): Jump if RLO = 1: ....................................................................................................... 51

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
3
TIA Portal Manual – July 2013

--- (JMPN): Jump if RLO = 0 ................................................................................................... 52


LABEL: Jump label: ...................................................................................................................... 54
JMP_LIST: Define jump list:........................................................................................................ 55
Word logic operations:.................................................................................................................. 55
AND: AND logic operation:....................................................................................................... 55
OR: OR logic operation: ................................................................................................................ 56
XOR: EXCLUSIVE OR logic operation: .................................................................................... 58
INV: Create ones complement: ................................................................................................. 59
DECO: Decode: ......................................................................................................................... 59
ENCO: Encode .......................................................................................................................... 60
MUX: Multiplex: ........................................................................................................................ 61
DEMUX: Demultiplex: .............................................................................................................. 62
Shift and rotate: ............................................................................................................................ 63
SHR: Shift right ......................................................................................................................... 63
SHL: Shift left:........................................................................................................................... 64
ROR: Rotate right: .................................................................................................................... 64
ROL: Rotate left: ....................................................................................................................... 65
Math operations:........................................................................................................................... 66
CALCULATE: Calculate: ........................................................................................................... 66
ADD: Add: ................................................................................................................................. 67
SUB: Subtract ............................................................................................................................ 68
MUL: Multiply: ......................................................................................................................... 69
DIV: Divide: .............................................................................................................................. 70
MOD: Return remainder of division: ........................................................................................ 70
NEG: Create twos complement: ................................................................................................. 71
Execution: .................................................................................................................................. 71
INC: Increment ......................................................................................................................... 72
DEC: Decrement: ...................................................................................................................... 72
ABS: Form absolute value: ........................................................................................................ 73
MIN: Get minimum: ................................................................................................................. 74
MAX: Get maximum: .................................................................................................................75
LIMIT: Set limit value: .............................................................................................................. 76
SQR: Form square:..................................................................................................................... 77

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
4
TIA Portal Manual – July 2013

SQRT: Form square root: .......................................................................................................... 78


LN: Form natural logarithm: .................................................................................................... 78
EXP: Form exponential value: .................................................................................................. 79
SIN: Form sine value: ............................................................................................................... 80
COS: Form cosine value: ............................................................................................................81
TAN: Form tangent value: .........................................................................................................81
ASIN: Form arcsine value: ........................................................................................................ 82
ACOS: Form arccosine value:.................................................................................................... 83
ATAN: Form arctangent value: ................................................................................................. 84
FRAC: Return fraction: ............................................................................................................. 85
EXPT: Exponentiate:................................................................................................................. 86

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
5
TIA Portal Manual – July 2013

Figure 1............................................................................................................................................ 9
Figure 2 ........................................................................................................................................... 9
Figure 3 ..........................................................................................................................................10
Figure 4 ..........................................................................................................................................10
Figure 5 .......................................................................................................................................... 11
Figure 6 .......................................................................................................................................... 11
Figure 7 .......................................................................................................................................... 11
Figure 8 ..................................................................................... Error! Bookmark not defined.
Figure 9 ..................................................................................... Error! Bookmark not defined.
Figure 10 ........................................................................................................................................ 12
Figure 11 ......................................................................................................................................... 13
Figure 12 ........................................................................................................................................ 13
Figure 13......................................................................................................................................... 13
Figure 14 ........................................................................................................................................ 14
Figure 15......................................................................................................................................... 15
Figure 16 ........................................................................................................................................ 16
Figure 17 ......................................................................................................................................... 16
Figure 18 ........................................................................................................................................ 17
Figure 19 ........................................................................................................................................18
Figure 20 ........................................................................................................................................18
Figure 21 ........................................................................................................................................ 19
Figure 22 ....................................................................................................................................... 20
Figure 23 ....................................................................................................................................... 20
Figure 24 ........................................................................................................................................ 21
Figure 25 ....................................................................................................................................... 22
Figure 26 ....................................................................................................................................... 23
Figure 27 ................................................................................... Error! Bookmark not defined.
Figure 28 ....................................................................................................................................... 25
Figure 29 ....................................................................................................................................... 25
Figure 30 ....................................................................................................................................... 26
Figure 31........................................................................................................................................ 27
Figure 32 ....................................................................................................................................... 27
Figure 33 ....................................................................................................................................... 28
Figure 34 ....................................................................................................................................... 29
Figure 35 ....................................................................................................................................... 30
Figure 36 ....................................................................................................................................... 33
Figure 37 ....................................................................................................................................... 33
Figure 38 ....................................................................................................................................... 34
Figure 39 ....................................................................................................................................... 35
Figure 40 ....................................................................................................................................... 35
Figure 41 ....................................................................................................................................... 36
Figure 42 ....................................................................................................................................... 37
Figure 43 ....................................................................................................................................... 37
Figure 44 ....................................................................................................................................... 38
Figure 45 ....................................................................................................................................... 40

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
6
TIA Portal Manual – July 2013

Figure 46 ....................................................................................................................................... 40
Figure 47 ........................................................................................................................................ 41
Figure 48 ....................................................................................................................................... 42
Figure 49 ....................................................................................................................................... 43
Figure 50 ....................................................................................................................................... 44
Figure 51........................................................................................................................................ 45
Figure 52 ....................................................................................................................................... 46
Figure 53 ....................................................................................................................................... 46
Figure 54 ....................................................................................................................................... 47
Figure 55 ....................................................................................................................................... 48
Figure 56 ....................................................................................................................................... 49
Figure 57 ....................................................................................................................................... 50
Figure 58 ........................................................................................................................................ 51
Figure 59 ....................................................................................................................................... 52
Figure 60 ....................................................................................................................................... 53
Figure 61 ....................................................................................................................................... 54
Figure 62 ....................................................................................................................................... 55
Figure 63 ....................................................................................................................................... 56
Figure 64 ........................................................................................................................................57
Figure 65 ....................................................................................................................................... 58
Figure 66 ....................................................................................................................................... 59
Figure 67 ....................................................................................................................................... 60
Figure 68 ....................................................................................................................................... 60
Figure 69 ........................................................................................................................................ 61
Figure 70 ....................................................................................................................................... 62
Figure 71 ........................................................................................................................................ 63
Figure 72 ....................................................................................................................................... 64
Figure 73 ....................................................................................................................................... 65
Figure 74 ....................................................................................................................................... 66
Figure 75 ....................................................................................................................................... 67
Figure 76 ....................................................................................................................................... 68
Figure 77 ....................................................................................................................................... 69
Figure 78 ....................................................................................................................................... 69
Figure 79 ....................................................................................................................................... 70
Figure 80........................................................................................................................................ 71
Figure 81 ....................................................................................................................................... 72
Figure 82 ....................................................................................................................................... 72
Figure 83 ....................................................................................................................................... 73
Figure 84 ....................................................................................................................................... 73
Figure 85 ....................................................................................................................................... 74
Figure 86 ........................................................................................................................................75
Figure 87 ....................................................................................................................................... 76
Figure 88 ........................................................................................................................................ 77
Figure 89 ....................................................................................................................................... 78
Figure 90 ....................................................................................................................................... 79

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
7
TIA Portal Manual – July 2013

Figure 91 ....................................................................................................................................... 80
Figure 92 ....................................................................................................................................... 80
Figure 93 ........................................................................................................................................81
Figure 94 ....................................................................................................................................... 82
Figure 95 ....................................................................................................................................... 83
Figure 96 ....................................................................................................................................... 84
Figure 97 ....................................................................................................................................... 85
Figure 98 ....................................................................................................................................... 86
Figure 99 ....................................................................................................................................... 87

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
8
TIA Portal Manual – July 2013

Introduction
TIA stands for Totally Integrated Automation and represents software that is capable of
communicating with a Programmable Logical Controller Chip, bundled with all the necessary
modules required for all the needs of a user within it. We are going to use and talk about the
version 11 of the afore mentioned software with a hardware support package you will find within
the same folder.

The Videos
The installation Tutorial is provided as a video. Check the attached files folder. Be sure to
install the hardware support package for s7-1200-1214 ac/dc/rly with Model 1BG31. Register
your program by applying the keys from EKB installer program provided here.

The process of creating your first program and going online with the PLC and simulating
it has been provided as a video. Due to some reasons, the documentation cannot be done here.
So get the basic idea and then start the tutorial from page 3.

The Documentations
The documents provided contain useful info about the PLC model you are to use in the
lab. They cover basic to advanced details on the usage of advanced modules that are specific to
the Siemen’s s7-1200 PLC. They also cover some basics about programming and intro to the TIA
GUI (Graphical User Interface).

Siemen’s Support
For any problem not covered by the documentation, you can visit the following link for
the best support technicians working day and night for providing customer queries with
fulfilling answers. Register and ask. It’s simple.

http://www.automation.siemens.com/mcms/programmable-logic-controller/en/simatic-s7-
controller/s7-1200/cpu/pages/default.aspx

Then Click on Support on right side panel.

Let’s Begin.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
9
TIA Portal Manual – July 2013

Creating your first Project


Initialization

Start TIA Portal and click on .


Write an appropriate name and click on the path to save it in a location other than where
your Operating System is installed. Give a comment so that the next time you open it,
you remember the purpose, or any other notes you have provided for you or any other
person looking at you program.

Figure 1

Click Create Button. It takes little while to create a project.

Figure 2

The following window appears after the project is created .there are few options given as
“configure a device” “, write a PLC program “,configure an HMI screen. For our project click on
“configure a device”. The other two options are discussed later.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
10
TIA Portal Manual – July 2013

Figure 3

Now click add new device


Select PLC.

Figure 4

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
11
TIA Portal Manual – July 2013

Four PLC models are given infront. We are using SIMATIC S7-1200.
Click on the SIMATIC S7-1200.
In drop down list CPU folder appears.

Figure 5

Click on CPU and again in drop down list a number of CPU model no. are given

Figure 6

Click on CPU 1214C AC/DC/Rly

Figure 7

Now double click on the number which is is the order number for S7-1200.the following
windows appears in which order number and version box is filled automatically.A short

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
12
TIA Portal Manual – July 2013

description of important charateristics of the device is also given.

Figure 8

From the project tree window click on PLC_1 which is a default name given to the device.

Figure 9

From the PLC_1 drop down list click on program blocks.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
13
TIA Portal Manual – July 2013

Figure 10

Double click on main so that the program .

Figure 11

A block editor open where you can write your program.

Figure 12

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
14
TIA Portal Manual – July 2013

Writing a simple program:


Select Network_1 and the instruction from the favorites list like contacts for instance can
be used in program through drag and drop or by double click.
Give appropriate names to the instruction like “Start”,”stop”,’’device’’ etc.
Now give address to each variable in the network by drag and drop directly from the PLC
window.

Figure 13

Save the project.


You can start simulation by selecting “simulation” and then start from the “online”
menu. You can simulate the program as long as PLC is connected to your PC.
For testing your program in the PLC you have to connect the PLC to your PC through an
Ethernet cable and click “Download to device ” then “go online”.
Useful information:
In many online dialogs you can perform an LED flash test, if the
device connected online supports this feature. When you click on the "LED flashing"
button, an LED flashes at the currently selected station. This feature is useful, for
example, when you are not sure which device in the hardware configuration corresponds
to the station currently selected in the software

Bit operations:
TIA has a no. of bit instructions to operate on bits. Each of them is briefly explained below.

|---: Normally open contact


 Normally open switch is activated when the if the signal state of the associated
operand is “1”. The normally closed contact is closed and the signal state at the
output of the instruction is set to "1".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
15
TIA Portal Manual – July 2013

 If the signal state of the operand is "0", the normally open contact is not activated
and the signal state at the output of the instruction is set to "0".

Figure 14

Operand "switch_4" is set when one of the following conditions is fulfilled:

 The operands "switch_1" and "switch_2" have the signal state "1".

 The operand "switch_3" has the signal state "1".

Table 1

Bit address state N.O instruction


1 true
0 false
---| / |---: Normally closed contact

The activation of the normally closed contact depends on the signal state of the associated
operand:

 If the signal state of the operand is "1", the normally closed contact is opened and the
signal state at the output of the instruction is set to "0".

 If the signal state of the operand is "0", the normally closed contact is not activated and
the signal state at the output of the instruction is set to "1".

Table 2

Bit address state N.C instruction


0 true
1 false

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
16
TIA Portal Manual – July 2013

Figure 15

Operand "switch_4" is set when one of the following conditions is fulfilled:

 The operands "switch_1" and "switch_2" have the signal state "1".

 The operand "switch_3" has the signal state "0".

--|NOT|--: Invert RLO


Invert RLO instruction can be used to invert the result of a logic operation(RLO):

 If the signal state is "1" at the input of the instruction, the output of the instruction has
signal state "0".
 If the signal state is "0" at the input of the instruction, the output has the signal state "1".

Table 3

Bit address state Inv. instruction


1 0
0 1

Figure 16

Operand "switch" is reset when one of the following conditions is fulfilled:

 The "switch_1" has the signal state "1".


 The signal state of the operands "switch_2" and "switch_3" is "1".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
17
TIA Portal Manual – July 2013

--- ( ) ---: Assignment


Assignment instruction can be used to set the bit of a specified operand.

 If the result of logic operation (RLO) at the box input has the signal state "1", the
specified operand is set to signal state "1".
 If the signal state at the box input is "0", the bit of the specified operand is reset to "0".

Declaration and data type:


Assignment operator is always used as an output.

Data type of assignment operator is “bool”.

-- (/)--: Negate assignment


Negate assignment can be used to to invert the result of a logic operation and assigns it to
specified operand.

 When the RLO at the input of the coil is "1", the operand is reset.
 When the RLO at the input of the coil is "0", the operand is set to signal state "1".

Figure 17

Operand "switch_4" is reset when one of the following conditions is fulfilled:

 The operands "switch_4" and "switch_6" have the signal state "1".
 The signal state of the operand "switch_3" is "0".

---(R) ---: Reset output


Reset output instruction can be used to reset the signal state of a specified operand to "0".

 The instruction is only executed if the result of logic operation (RLO) at the input is "1".
If RLO = "1", the specified operand is reset to "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
18
TIA Portal Manual – July 2013

 If the RLO at the input of the is "0" (no signal flow to the coil), the signal state of the
specified operand remains unchanged.

Figure 18

Operand "switch_4 (2)" is reset when one of the following conditions is fulfilled:

 The operands "switch_1" and "switch_2" have signal state "1".


 The signal state of the operand "switch_3" is "0".

---(S) ---: Set output


Set output instruction can be used set the signal state of a specified
operand to "1".

 The instruction is only executed if the result of logic operation (RLO) at the input
of the is "1". If RLO = "1", the specified operand is set to "1".
 If the RLO at the input is "0" (no signal flow to the coil), the signal state of the
specified operand remains unchanged.

Figure 19

The "switch_4 (2)" operand is set when one of the following conditions is fulfilled:

 The operands "switch_1" and "switch_2" have signal state "1".


 The signal state of the operand "switch_3" is "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
19
TIA Portal Manual – July 2013

SET_BF: Set bit field


Set bit field instruction is used to set several bits starting at a certain address.

Consider two operands,”operand 1” and “operand 2”.

 Operand 1 constitutes the number of bits to be set.(at input)


 Operand 2 constitute the address of the first bit to be set.(at output)
 If the value of “Operand 1” is greater than the number of bits in a selected byte, then the
bits of the next byte will be set.
 The bits remain set until they are explicitly reset, for example, by another instruction.
 The instruction is only executed if the result of logic operation (RLO) at the input
of the coil is "1".
 If the RLO at the input of the coil is "0", the instruction does not execute.

Declaration:
The "Set bit field" instruction can also be placed without preceding logic operation at the start or
end of the current path.

Data types:
 Data type of operand 1 is UINT and is stored in memory.
 Data type of operand 2 is bool.

Figure 20

If the operands "switch_1" and "switch_2" have the signal state "1", 5 bits are set starting at the
address of the operand "mydata 4.

RESET_BF: Reset bit field


Reset bit field instruction is used to reset several bits starting at a certain address.

Like set bit field instruction there are two operands. Operand 1 is used to store the number of
bits to be reset and the operand 2 is used to store the address of the first bit of the field to be
reset.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
20
TIA Portal Manual – July 2013

 The bits remained reset until they are explicitly set by another instruction

Figure 21

If the operands "switch_1" and "switch_2" have the signal state "1", 5 bits are reset starting at
the address of the operand "mydata4”.

SR: Set/reset flip-flop


The SR instruction is used to set or reset a bit of a specific operand based on the signal state of
inputs S and R1.

 If the signal state is "1" at input S and "0" at input R1, the specified operand is set to "1".
 If the signal state is "0" at input S and "1" at input R1, the specified operand will be reset
to "0".

 When the signal state is "1" at both inputs S and R1, the signal state of the specified
operand is reset to "0".
 The instruction is not executed if the signal state at the two inputs S and R1 is "0". The
signal state of the operand then remains unchanged.

Figure 22

The operands "mytag" and "Tag_1" are set when the following conditions are fulfilled:

 The operand "switch_1" has the signal state "1".


 The operand "switch_2" has the signal state "0".

The operands "mytag" and "Tag_1" are reset when one of the following conditions is fulfilled:

 The operand "switch_1" has signal state "0" and the operand "switch_2" has signal state
"1".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
21
TIA Portal Manual – July 2013

 The operands "switch_1" and "switch_2" have signal state "1".

RS: Reset/set flip-flop


The RS instruction is used to reset or set a bit of a specific operand based on the signal state of
S1 and R.

 If the signal state is "1" at input R and "0" at input S1, the specified operand will be reset
to "0".
 If the signal state is "0" at input R and "1" at input S1, the specified operand is set to "1".
 When the signal state is "1" at both inputs R and S1, the signal state of the specified
operand is set to "1".

 The instruction is not executed if the signal state at the two inputs R and S1 is "0". The
signal state of the operand then remains unchanged.

Figure 23

The operands "mytag" and "Tag_1" are reset when the following conditions are fulfilled:

 The operand "switch_1" has the signal state "1".


 The operand "switch_2" has the signal state "0".

The operands "mytag" and "Tag_1" are set when one of the following conditions is fulfilled:

 The operand "switch_1" has signal state "0" and the operand "switch_2" has signal state
"1".
 The operands "switch_1" and "switch_2" have signal state "1".

--|P|--: Scan operand for positive signal edge


 Scan operand for positive signal edge instruction is used to determine whether there is a
"0" to "1" change in the signal state of a specified operand “Operand_1”.
 The instruction compares the current signal state of “Operand_1” with the signal state of
the previous scan stored in an edge memory bit “operand_2”.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
22
TIA Portal Manual – July 2013

 If the instruction detects a change in the result of logic operation from "0" to "1", there is
a positive, rising edge.
 If a rising edge is detected, the output of the instruction has the signal state "1".
 In all other cases, the signal state at the output of the instruction is "0".

Important note: The address of the edge memory bit must not be used more than once in the
program, otherwise the memory bit would be overwritten. This would influence edge evaluation
and the result would no longer be unequivocal. The memory area of the edge memory bit must
be located in a DB (static area for FB) or in the bit memory area.e.g

Figure 24

Operand "Tag_1" is set when the following conditions are fulfilled:

 Operands "switch_1", "switch_2", and "switch_3" have signal state "1".


 There is a rising edge at operand "Tag_n". The signal state of the previous scan is stored
in the edge memory bit "Tag_m".

 The signal state of the operand "switch_4" is "1".

--|N|--: Scan operand for negative signal edge


 Scan operand for negative signal edge instruction can be used to detect whether there is
a change from "1" to "0" in the signal state of a specified operand “Operand_1”.
 The instruction compares the current signal state of “Operand_1” with the signal state of
the previous scan that is saved in an edge memory bit “Operand_2”.
 If the instruction detects a change in the result of logic operation from "1" to "0", there is
a negative, falling edge.
 If a falling edge is detected, the output of the instruction has the signal state "1".
 In all other cases, signal state at the output of the instruction is "0".

Important note: The address of the edge memory bit must not be used more than once in the
program, otherwise the memory bit would be overwritten. This would influence edge evaluation
and the result would no longer be unequivocal. The memory area of the edge memory bit must
be located in a DB (static area for FB) or in the bit memory area.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
23
TIA Portal Manual – July 2013

Figure 25

Operand "Tag_1" is set when the following conditions are fulfilled:

 Operands "switch_1", "switch_2", and "switch_3" have signal state "1".


 There is a falling edge at operand "mytag_n". The signal state of the previous scan is
stored in the edge memory bit "Tag_m".
 The signal state of the operand "switch_4" is "1".

--(P)--: Set operand on positive signal edge


 The instruction set operand on positive signal edge is used to set a specified operand
“Operand_1” when there is a "0" to "1" transition in the power flow.
 The instruction compares the current result of logic operation (RLO) with the result of
logic operation from the previous query, which is saved in an edge memory bit
“Operand_2”.
 If the instruction detects a change in the power flow from "0" to "1", there is a positive,
rising edge.

 When there is a positive edge, Operand_1 is set to signal state "1" for one program cycle.
In all other cases, the operand has the signal state "0".

Important note:

 The address of the edge memory bit must not be used more than once in the program,
otherwise the memory bit is overwritten.
 This step influences the edge evaluation and the result is therefore no longer unique.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
24
TIA Portal Manual – July 2013

 The memory area of the edge memory bit has to lie in a DB (static area for FB) or in the
bit memory area.

Figure 26

 Operand "Tag_1" is set for one program cycle, when the signal state at the input of the
coil switches from "0" to "1" (positive edge).

 In all other cases, the operand "TagOut" has the signal state "0".

-- (N)--: Set operand on negative signal edge


 The instruction “Set operand on negative signal edge” can be used to set a specified
operand Operand_1 when a "1" to "0" change is detected in the power flow.
 The instruction compares the current result of logic operation (RLO) with the result of
logic operation from the previous query, which is saved in an edge memory bit
Operand_2.
 If the instruction detects a change in the power flow from "1" to "0", there is a negative,
falling edge.

Important note:

 The address of the edge memory bit must not be used more than once in the program,
otherwise the memory bit is overwritten.
 This step influences the edge evaluation and the result is therefore no longer unique.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
25
TIA Portal Manual – July 2013

 The memory area of the edge memory bit has to lie in a DB (static area for FB) or in the
bit memory area.

Figure 27

 Operand "Tag_1" is set for one program cycle, when the signal state at the input of the
coil switches from "1" to "0" (negative edge).
 In all other cases, the operand "Tag_1" has the signal state "0".

Timer operations:
TP: Generate pulse:
 When the result of a logic operation at IN changes from “0” to “1” then this instruction
activates or sets the output “Q” for “PT” time.
 The programmed time PT starts when the instruction starts.
 Output “Q” is set for duration “PT” regardless of the subsequent course of the input
signal.
 Even if a new positive signal edge is detected, the signal state at the output Q is not
affected as long as the PT time is running.
 The current time value can be queried at the ET output.
 If duration PT is reached and the signal state at input IN is "0", the ET output is reset.

Figure 28

When the signal state of “tag_in ” changes from “0” to “1” the timer starts and “tag_out” is
set till it reaches the limit set in “PT”.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
26
TIA Portal Manual – July 2013

TON: Generate on-delay:


 The instruction is started when the result of logic operation (RLO) at input IN changes
from "0" to "1" (positive signal edge).
 The programmed time PT begins when the instruction starts.
 When the duration PT expires, the output Q has the signal state "1". Output Q remains
set as long as the start input is still "1".
 When the signal state at the start input changes from "1" to "0", the Q output is reset.
 The timer function is started again when a new positive signal edge is detected at the
start input.

 The current time value can be queried at the ET output.


 The time value starts at T#0s and ends when the value of duration PT is reached. The ET
output is reset as soon as the signal state at the IN input changes to "0".

Figure 29

TOF: Generate off-delay:

 The instruction "Generate off-delay" delays resetting of the output Q by the programmed
duration PT.
 The Q output is set when the result of logic operation (RLO) at input IN changes from
"0" to "1" (positive signal edge).
 When the signal state at input IN changes back to "0", the programmed time PT starts.
Output Q remains set as long as the duration PT is running.
 When duration PT expires, the Q output is reset. If the signal state at the IN input changes
to "1" before the duration PT expires, the time is reset.
 The signal state at the output Q will continue to be "1".
 The current time value can be queried at the ET output.
 The time value starts at T#0s and ends when the value of duration PT is reached. When
the duration PT expires, the ET output remains set to the current value until input IN
changes back to "1".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
27
TIA Portal Manual – July 2013

 If input IN switches to "1" before the duration PT has expired, the ET output is reset to
the value T#0s.

Figure 30

TONR: Time accumulator:

 The "Time accumulator" instruction accumulates time values within a period set by
parameter PT.
 When the signal state at input IN changes from "0" to "1" (positive signal edge), the
instruction executes and the duration PT starts.
 While the duration PT is running, the timer values are accumulated that are recorded
when the IN input has signal state "1".
 The accumulated time is written to output ET and can be queried there.
 When the duration PT expires, the output Q has the signal state "1". The Q parameter
remains set to "1", even when the signal state at the IN parameter changes from "1" to "0"
(negative signal edge).
 The R input resets the outputs ET and Q regardless of the signal state at the start input.

Figure 31

Counter operation:
CTU: Count up:
The instruction "Count up" counts up the value at output.

Parameters:
CV:

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
28
TIA Portal Manual – July 2013

 When the signal state at the CU input changes from "0" to "1" (positive signal edge), the
instruction executes and the current count value at the CV output is incremented by one.
 When the instruction executes for the first time, the current count value at the CV output
is set to zero.
 The count value is incremented each time a positive signal edge is detected, until it
reaches the high limit for the data type specified at the CV output.
 When the high limit is reached, the signal state at the CU input no longer has an effect on
the instruction
Output status:
 The signal state at the Q output is decided by the parameter PV.
 If the current count value is greater than or equal to the value of the PV
parameter, the Q output is set to signal state "1".
 In all other cases, the Q output has signal state "0". You can also specify a
constant for the PV parameter.

Figure 32

 When the signal state of the "tag_in1" operand changes from "0" to "1", the "Count up"
instruction executes and the current count value of the "CV" operand is incremented by
one. With each additional positive signal edge, the count value is incremented until the
high limit of the specified data type (32 767) is reached.
 The value of the PV parameter is adopted as the limit for determining the "tag_out"
output.
 The "tag_out" output has signal state "1" as long as the current count value is greater than
or equal to the value of the "Tag_PV" operand.
 In all other cases, the "tag_out" output has signal state "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
29
TIA Portal Manual – July 2013

CTD: Countdown:
 The CTD instruction can be used to decrement the value at output CV.
 When the signal state at the CD input changes from "0" to "1" (positive signal edge), the
instruction executes and the current count value at the CV output is decremented by one.
 When the instruction executes the first time, the count value of the CV parameter is set
to the value of the PV parameter.
 Each time a positive signal edge is detected, the count value is decremented until it
reaches the low limit value of the specified data type.
 When the low limit is reached, the signal state at the CD input no longer has an effect on
the instruction.
 If the current count value is less than or equal to zero, the Q output is set to signal state
"1".
 In all other cases, the Q output has signal state "0".

Figure 33

 When the signal state of the "Tag_in1" operand changes from "0" to "1", the "Count
down" instruction executes and the value at the "Tag_CV" output is decremented by one.
With each additional positive signal edge, the count value is decremented until the low
limit of the specified data type (-32 768) is reached.

 The "Tag_out" output has signal state "1" as long as the current count value is less than or
equal to zero. In all other cases, the "Tag_out" output has signal state "0".

CTUD: Count up and down


 The count up and down instruction can be used to increment and decrement the
count value at the CV output.
 If the signal state at the CU input changes from "0" to "1" (positive signal edge),
the current count value is incremented by one and stored at the CV output.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
30
TIA Portal Manual – July 2013

 If the signal state at the CD input changes from "0" to "1" (positive signal edge),
the count value at the CV output is decremented by one.
 If there is a positive signal edge at the CU and CD inputs in one program cycle,
the current count value at the CV output remains unchanged.
 The count value can be incremented until it reaches the high limit of the data type
specified at the CV output.
 When the high limit value is reached, the count value is no longer incremented on
a positive signal edge.
 When the low limit of the specified data type is reached, the count value is not
decremented any further.
 The count value is set to zero when the signal state at the R input changes to "1".
 As long as the R input has signal state "1", a change in the the signal state of the
CU, CD and LD inputs has no effect on the "Count up and down" instruction.
Declaration of IEC counters:
 Each call of the "Count up and down" instruction must be assigned an IEC
counter in which the instruction data is stored.IEC counter can be
declared as follow.

 Declaration of a data block of system data type IEC_COUNTER (for


example, "MyIEC_COUNTER")
 Declaration as a local tag of the type CTUD in the "Input", "InOut" or
"Static" section of a block (for example, #MyIEC_COUNTER).

Figure 34

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
31
TIA Portal Manual – July 2013

 If the signal state at the "Tag_in1" or "Tag_in2" input changes from "0" to "1" (positive
signal edge), the "Count up and down" instruction is executed.
 When there is a positive signal edge at the "Tag_in1" input, the current count value is
incremented by one and stored at the "Tag_CV" output.
 When there is a positive signal edge at the "Tag_in2" input, the count value is
decremented by one and stored at the "Tag_CV" output.
 When there is a positive signal edge at the CU input, the count value is incremented until
it reaches the high limit of 32 767.
 If input CD has a positive signal edge, the count value is decremented until it reaches the
low limit value of -32 768.
 The "Tag_out" output has signal state "1" as long as the current count value is greater
than or equal to the value at the "Tag_PV" input.
 In all other cases, the "Tag_out" output has signal state "0".
 The "Tag_outQD" output has signal state "1" as long as the current count value is less
than or equal to zero. In all other cases, the "Tag_outQD" output has signal state "0".

Comparators operations:
CMP ==: Equal:
The instruction CMP is used to determine if a first value(operand_1) is equal to second value
(operand_2).

 If the condition of the comparison is fulfilled, the instruction returns the result of logic
operation (RLO) "1".
 If the comparison condition is not fulfilled, the instruction returns RLO "0".

 The individual characters are compared by means of their ASCII code (for example, 'a' is
greater than 'A') during the comparison of the strings.
 The comparison is performed from left to right. The first character that is different
decides the result of the comparison.

Table 4

<operand_1> <operand_2> RLO


‘BB’ ‘bb’ 0
‘khan jadoon’ ‘khanjadoon’ 0
‘cc’ ‘’cc’ 1
Important note:
 When IEC Check is selected, the operands to be compared must have the same
data type.
 If IEC Check is not selected, the width (length) of the operands must be the same.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
32
TIA Portal Manual – July 2013

 When floating-point numbers are compared, the operands to be compared must


have the same data type regardless of the setting for the IEC Check

Figure 35

The "Tag_out" output is set when the following conditions are fulfilled:

 The operands "Tag_in1" and "Tag_in2" have the signal state "1".
 The condition of the comparison instruction is fulfilled ("tag_value1" = "tag_value2").

CMP <>: Not equal:


The CMP instruction is used to determine if a first comparison value (Operand_1) is unequal to
a second comparison value (Operand_2).

 If the condition of the comparison is fulfilled, the instruction returns the result of logic
operation (RLO) "1".
 If the comparison condition is not fulfilled, the instruction returns RLO "0".

 The individual characters are compared by means of their ASCII code (for example, 'a' is
greater than 'A') during the comparison of the strings.
 The comparison is performed from left to right. The first character that is different
decides the result of the comparison.

Table 5

<operand_1> <operand_2> RLO


‘BB’ ‘bb’ 1
‘khan jadoon’ ‘khanjadoon’ 1
‘cc’ ‘’cc’ 0

Important note:

 When IEC Check is selected, the operands to be compared must have the same
data type. If IEC Check is not selected, the width (length) of the operands must
be the same.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
33
TIA Portal Manual – July 2013

 When floating-point numbers are compared, the operands to be compared must


have the same data type regardless of the setting for the IEC Check

Figure 36

The "Tag_out" output is set when the following conditions are fulfilled:

 The operands "tag_in1" and "tag_in2" have the signal state "1".
 The condition of the comparison instruction is fulfilled ("tag_value1" <> "tag_value2").

CMP >=: Greater or equal


This instruction can be used to determine if a first comparison value (Operand_1) is greater
than or equal to a second comparison value (Operand_2). Both values to be compared must be
of the same data type.

 If the condition of the comparison is fulfilled, the instruction returns the result of logic
operation (RLO) "1".
 If the comparison condition is not fulfilled, the instruction returns RLO "0".

Table 6

<operand_1> <operand_2> RLO


‘AA’ ‘aa’ 0
‘khan jadoon’ ‘khanjadoon’ 0
‘cc’ ‘’cc’ 1

Figure 37

The "Tag_out" output is set when the following conditions are fulfilled:

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
34
TIA Portal Manual – July 2013

 The operands "tag_in1" and "tag_in2" have the signal state "1".
 The condition of the comparison instruction is fulfilled ("tag_value1" >= "tag_value2").

CMP <=: Less or equal:


This instruction can be used to determine if a first comparison value (Operand_1) is less than or
equal to a second comparison value (Operand_2). Both values to be compared must be of the
same data type.

 If the condition of the comparison is fulfilled, the instruction returns the result of logic
operation (RLO) "1".
 If the comparison condition is not fulfilled, the instruction returns RLO "0"

Table 7

<operand_1> <operand_2> RLO


‘AA’ ‘aa’ 1
‘khanjadoon’ ‘khan jadoon’ 0
‘cc’ ‘’cc’ 1

Figure 38

The "TagOut" output is set when the following conditions are fulfilled:

 The operands "TagIn_1" and "TagIn_2" have the signal state "1".
 The condition of the comparison instruction is fulfilled ("Tag_Value1"
<="Tag_Value2").

CMP >: Greater than:


This instruction is used to determine if a first comparison value (<Operand_1>) is greater than a
second comparison value (<Operand_2>). Both values to be compared must be of the same data
type.

 If the condition of the comparison is fulfilled, the instruction returns the result of logic
operation (RLO) "1".
 If the comparison condition is not fulfilled, the instruction returns RLO "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
35
TIA Portal Manual – July 2013

Table 8

<operand_1> <operand_2> RLO


‘AA’ ‘aa’ 0
‘AA’ ‘BB’ 1
‘cc’ ‘’cc’ 1

Figure 39

The "TagOut" output is set when the following conditions are fulfilled:

 The operands "TagIn_1" and "TagIn_2" have the signal state "1".
 The condition of the comparison instruction is fulfilled ("Tag_Value1" > "Tag_Value2").

CMP <: Less than:


This instruction is used to determine if a first comparison value (Operand_1) is less than a
second comparison value (Operand_2). Both values to be compared must be of the same data
type.

 If the condition of the comparison is fulfilled, the instruction returns the result of logic
operation (RLO) "1".
 If the comparison condition is not fulfilled, the instruction returns RLO "0"

Table 9

<operand_1> <operand_2> RLO


‘AA’ ‘aa’ 1
‘AA’ ‘BB’ 1
‘cc’ ‘’cc’ 0

Figure 40

The "TagOut" output is set when the following conditions are fulfilled:

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
36
TIA Portal Manual – July 2013

 The operands "TagIn_1" and "TagIn_2" have the signal state "1".
 The condition of the comparison instruction is fulfilled ("Tag_Value1" < "Tag_Value2").

IN_RANGE: Value within range:


This instruction is used to determine if the value at the VAL input is within a specific value
range.

 By specifying the limits of the value range with the MIN and MAX inputs, The "Value
within range" instruction compares the value at the VAL input with the values of the
MIN and MAX inputs and sends the result to the box output.
 If the value at the VAL input fulfills the MIN <= VAL or VAL <= MAX comparison, the
box output has the signal state "1".
 If the comparison is not fulfilled, the box output has the signal state "0".
 If the box input has the signal state "0", the "Value within range" instruction is not
executed.
e.g.

Figure 41

The "TagOut" output is set when the following conditions are fulfilled:

 The operands "TagIn_1" and "TagIn_2" have the signal state "1".
 The value of operand ""Tag_Value"" is within the value range, which is specified by the
current values of operands "Tag_Min" and "Tag_Max"(MIN <= VAL or VAL <= MAX).
 The operand "TagIn_3" has the signal state "1".

OUT_RANGE: Value outside range:


This instruction is used to determine if the value at the VAL input is outside a specific value
range.

 By specifying the limits for MIN and MAX inputs, the "Value outside range" instruction
compares the value at the VAL input with the values of the MIN and MAX inputs and
sends the result to the box output.
 If the value at the VAL input fulfills the MIN > VAL or VAL > MAX comparison, the box
output has the signal state "1".
 The box output also has the signal state "1" if a specified operand with the REAL data
type shows an invalid value.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
37
TIA Portal Manual – July 2013

 The box output returns the signal state "0", if the value at input VAL does not satisfy the
MIN > VAL or VAL > MAX condition.
 If the box input has the signal state "0", the "Value outside range" instruction is not
executed

Figure 42

The "tag_out" output is set when the following conditions are fulfilled:

 The operands "TagIn_1" and "TagIn_2" have the signal state "1".
 The value of operand "Tag_Value" is outside the value range, which is specified by the
current values of operands "Tag_Min" and ""Tag_Max" (MIN > VAL or VAL > MAX).
 The operand "TagIn_3" has the signal state "1".

----I OK I----: Check validity:


This instruction is used to check if the value of an operand (Operand) is a valid floating-point
number.

 The output of the instruction has signal state "1" when the value of the operand is a valid
floating-point number at the time of the query and the input of the instruction has signal
state "1".
 In all other cases, the signal state at the output of the "Check validity" instruction is
"0".e.g

Figure 43

 When the values of operands "Tag_Value1" and "Tag_Value2" are valid floating-point
numbers, the "Multiply" (MUL) instruction is activated and the ENO output is set.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
38
TIA Portal Manual – July 2013

 When the "Multiply" (MUL) instruction is executed, the value of operand "Tag_Value1"
is multiplied by the value of operand "Tag_Value2".
 The product of the multiplication is stored in operand "Tag_Result".
 If the instruction is executed without errors, the ENO and "TagOut" outputs are set to
signal state "1".

----I NOT_OK I----: Check invalidity:


This instruction is used to check if the value of an operand (<Operand>) is an invalid floating-
point number.

 The output of the instruction has signal state "1" when the value of the operand is an
invalid floating-point number at the time of the query and the input of the instruction has
signal state "1".
 In all other cases, the signal state at the output of the "Check invalidity" instruction is "0".

Figure 44

 If the value at the operand "TagIn_Value" is an invalid floating-point number, the "Move
value" (MOVE) instruction is not executed. The "TagOut" output is reset to signal state
"0".

Move operation:
MOVE: Move value:
This instruction is used to transfer the contents of the operand at the IN input to the operand at
the OUT1 output.

 The transfer is always made in the direction of the ascending address.

Possible transfers:
Destination (OUT1)
Source (IN) With IEC
Without IEC check
check
BYTE, BYTE, WORD, DWORD, SINT,
BYTE WORD, USINT, INT, UINT, DINT, UDINT,
DWORD TIME, DATE ,TOD, CHAR

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
39
TIA Portal Manual – July 2013

BYTE, WORD, DWORD, SINT,


WORD,
WORD USINT, INT, UINT, DINT, UDINT,
DWORD
TIME, DATE, TOD, CHAR
BYTE, WORD, DWORD, SINT,
DWORD DWORD USINT, INT, UINT, DINT, UDINT,
REAL, TIME, DATE, TOD, CHAR
BYTE, WORD, DWORD, SINT,
SINT SINT USINT, INT, UINT, DINT, UDINT,
TIME, DATE, TOD
BYTE, WORD, DWORD, SINT,
USINT, UINT,
USINT USINT, INT, UINT, DINT, UDINT,
UDINT
TIME, DATE, TOD
BYTE, WORD, DWORD, SINT,
INT INT USINT, INT, UINT, DINT, UDINT,
TIME, DATE, TOD
BYTE, WORD, DWORD, SINT,
UINT UINT, UDINT USINT, INT, UINT, DINT, UDINT,
TIME, DATE, TOD
BYTE, WORD, DWORD, SINT,
DINT DINT USINT, INT, UINT, DINT, UDINT,
TIME, DATE, TOD
BYTE, WORD, DWORD, SINT,
UDINT UDINT USINT, INT, UINT, DINT, UDINT,
TIME, DATE, TOD
REAL REAL DWORD, REAL
LREAL LREAL LREAL
BYTE, WORD, DWORD, SINT,
TIME TIME USINT, INT, UINT, DINT, UDINT,
TIME
BYTE, WORD, DWORD, SINT,
DATE DATE USINT, INT, UINT, DINT, UDINT,
DATE
BYTE, WORD, DWORD, SINT,
TOD TOD USINT, INT, UINT, DINT, UDINT,
TOD
DTL DTL DTL
BYTE, WORD, DWORD, characters
CHAR CHAR
of a string1)
Characters of Characters of a
CHAR, characters of a string
a string1) string
ARRAY2) ARRAY ARRAY
STRUCT STRUCT STRUCT

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
40
TIA Portal Manual – July 2013

Example:

Figure 45

 If operand "TagIn" has the signal state"1", the "Move value" instruction is executed.
 The instruction copies the contents of operand "TagIn_Value" to operand
"TagOut_Value" and sets output "TagOut" to signal state "1".

FieldRead: Read field:


This instruction is used to read out a specific component from the field specified in the
MEMBER parameter and transfer its content to the tag in the VALUE parameter.

Important: The data type of the field component in the MEMBER parameter and the data type
of the tags in the VALUE parameter must match the data type of the "Read field" instruction.

Execution: The execution of the "Read field" instruction is only started when the signal state at
the EN enable input is "1". If no errors occur during execution, the ENO output also has the
signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The field component specified in the INDEX parameter is not defined in the field
specified in the MEMBER parameter.
 Errors such as an overflow occur during execution.

Example:

Figure 46

 The field component with index 4 is read from the "DB_1 of REAL" field and written to
the "a_real" tag.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
41
TIA Portal Manual – July 2013

 The field component to be read is specified by the value at the INDEX parameter

Field Write: Write field


This instruction is used to transfer the content of the tag in the VALUE parameter to a specific
component of the field in the MEMBER parameter.

Important: The data type of the field component specified in the MEMBER parameter and the
data type of the tag in the VALUE parameter must match the data type of the "Write field"
instruction.

Execution: The execution of the "Write field" instruction is only started when the signal state
at the EN enable input is "1".

 If no errors occur during execution, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The field component specified in the INDEX parameter is not defined in the field
specified in the MEMBER parameter.
 Errors such as an overflow occur during execution

Figure 47

 The value of the "a_real" tag is written to the field component with index of the "Main
Field of REAL" field.
 The index of the field component to which the content of the "a_real" tag is transferred"
is specified by the value in the INDEX parameter.

MOVE_BLK: Move block


This instruction "Move block" is used to move the contents of a memory area (source area) to
another memory area (destination area).

 The number of elements to be copied to the destination area is specified with the COUNT
parameter.
 The width of the elements to be copied is defined by the width of the element at the IN
input.
 The copy operation takes place in the direction of ascending addresses.
Execution:

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
42
TIA Portal Manual – July 2013

 The instruction is only executed if the signal state is "1" at the EN enable input.
 If the instruction is executed without errors, the ENO output also has the signal
state "1.

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 More data is copied than is made available at the IN input or OUT output.

Figure 48

 If operands "TagIn_1" and "TagIn_2" have the signal state "1", the "Move block"
instruction is executed.
 The instruction selects INT elements from the "a_array” tag and copies their contents into
the "b_array” output tag.
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

UMOVE_BLK: Move block uninterruptible


 This instruction is used to copy the contents of a memory area (source area) to another
memory area (destination area) without interruption.
 The number of elements to be copied to the destination area is specified with the COUNT
parameter.
 The width of the elements to be copied is defined by the width of the element at the IN
input.
 The content of the source area is copied to the destination area in the direction of the
ascending address.
Important note: The copy operation cannot be interrupted by other operating system
activities. This is why the alarm reaction times of the CPU increase during the execution
of the "Move block uninterruptible" instruction.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
43
TIA Portal Manual – July 2013

 The EN input has the signal state "0".


 More data is copied than is made available at the IN input or OUT output.

Figure 49

 If operands "TagIn_1" and "TagIn_2" have the signal state "1", the "Move block
uninterruptible" instruction is executed.
 The instruction selects INT elements from the "a_array" tag and copies their contents into
the "b_array" output tag.
 The copy operation cannot be interrupted by other operating system activities.
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

FILL_BLK: Fill block:


This instruction is used to fill a memory area (destination area) with the value of the IN
input.
 The destination area is filled starting from the address specified at the OUT output.
 The number of repeated copy operations is specified with the COUNT parameter.
 When the instruction is executed, the value at the IN input is selected and copied to the
destination area as often as specified by the value in the COUNT parameter.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
44
TIA Portal Manual – July 2013

 More data is copied than is made available at the IN input or OUT output.

Figure 50

 If operands "TagIn_1" and "TagIn_2" have the signal state "1", the "Fill block"
instruction is executed.
 The instruction copies the second element a_array of the "a_array" tag three
times to the "b_array" output tag b_array.
 If the instruction is executed without errors, the ENO and "TagOut" outputs are
set to signal state "1.

UFILL_BLK: Fill block uninterruptible:


This instruction is used to fill a memory area (destination area) with the value of the IN input
without interruption.

 The destination area is filled starting from the address specified at the OUT output.
 The number of repeated copy operations is specified with the COUNT parameter.
 When the instruction is executed, the value at the IN input is selected and copied to the
destination area as often as specified by the value in the COUNT parameter.
Important note:
 The copy operation cannot be interrupted by other operating system activities.
 This is why the alarm reaction times of the CPU increase during the execution of
the "Fill block uninterruptible" instruction.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
45
TIA Portal Manual – July 2013

 More data is copied than is made available at the IN input or OUT output.

Figure 51

 If operands "TagIn_1" and "TagIn_2" have the signal state "1", the "Fill block
uninterruptible" instruction is executed.
 The instruction copies the second element a_array of the "a_array" tag three times to
"b_array" output tag.
 The copy operation cannot be interrupted by other operating system activities.
 If the instruction is executed without errors, the ENO and "TagOut" outputs are set to
signal state "1".

Conversion operation:
CONVERT: Convert value:
This instruction is used to reads the content of the IN parameter and converts it according to the
data types selected in the instruction box. The converted value is sent to the OUT output.

Execution:

The execution of the "Convert value" instruction is only started when the signal state at the EN
enable input is "1". If no errors occur during execution, the ENO output also has the signal state
"1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 Errors such as an overflow occur during execution.
 An operand of data type BYTE, WORD, or DWORD is specified at the IN input. This
operand's most significant bit is set. A signed integer (SINT, INT, DINT) is specified at

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
46
TIA Portal Manual – July 2013

the OUT output. It has the same bit length as the operand at the IN input.

Figure 52

 If operand "TagIn" has the signal state "1", the content of operand "TagIn_Value" is read
and converted to an integer (32-bit).
 The result is stored in operand "TagOut_Value".
 The "TagOut" output is set to "1" if the instruction is executed without errors.

ROUND: Round numerical value


This instruction is used to round the value at the IN input to the nearest integer.

 The instruction interprets the value at input IN as a floating-point number and converts
this to an integer of data type DINT.
 If the input value is exactly between an even and odd number, the even number is
selected.
 The result of the instruction is sent to the OUT output and can be queried there.

Execution:

 The instruction is only executed if the signal state is "1" at the EN enable input.
 If the instruction is processed without errors, the ENO enable output also has the signal
state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 Enable input EN has the signal state "0".


 Errors such as an overflow occur during execution

Figure 53

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
47
TIA Portal Manual – July 2013

 If operand "TagIn_1" has the signal state "1", the "Round numerical value" instruction is
executed.
 The floating-point number at input "TagIn_Value" is rounded to the nearest even integer
and sent to output "TagOut_Value".
 If the instruction is executed without errors, the "TagOut" output is set.

CEIL: Generate next higher integer from floating-point number


This instruction is used to round the value at the IN input to the next higher integer.

 The instruction interprets the value at the IN input as a floating-point number and
converts this number to the next higher integer.
 The result of the instruction is sent to the OUT output and can be queried there.
 The output value can be greater than or equal to the input value.
Execution:

 The instruction is only executed if the signal state is "1" at the EN enable input.
 If the instruction is processed without errors, the ENO enable output also has the signal
state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 Enable input EN has the signal state "0".


 Errors such as an overflow occur during execution.

Figure 54

 If operand "TagIn" has the signal state "1", the "Generate next higher integer from
floating-point number" instruction is executed.
 The floating-point number at the "TagIn_Value" input is rounded to the next higher
integer and sent to the "TagOut_Value" output.
 If the instruction is executed without errors, the "TagOut" output is set.

FLOOR: Generate next lower integer from floating-point number


This instruction is used to round the value at the IN input to the next lower integer.

 The instruction interprets the value at input IN as a floating-point number and converts
this to the next lower integer.
 The result of the instruction is sent to the OUT output and can be queried there.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
48
TIA Portal Manual – July 2013

 The output value can be less than or equal to the input value.
Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is processed without errors, the ENO enable output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 Enable input EN has the signal state "0".


 Errors such as an overflow occur during execution

Figure 55

 If operand "TagIn" has the signal state "1", then the "Generate next lower integer from
floating-point number" instruction will be executed.
 The floating-point number at input "TagIn_Value" is rounded to the next lower integer
and sent to output "TagOut_Value". If the instruction is executed without errors, the
"TagOut" output is set.

TRUNC: Truncate numerical value:


This instruction is used to form an integer from the value at the IN input.

 The value at the IN input is interpreted as a floating-point number.


 The instruction selects only the integer part of the floating-point number and sends this
to the OUT output without decimal places.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
49
TIA Portal Manual – July 2013

 Errors such as an overflow occur during execution.

Figure 56

 If operand "TagIn" has the signal state "1", the "Truncate numerical value" instruction is
executed.
 The integer part of the floating-point number at the "TagIn_Value" input is converted to
an integer and sent to the "TagOut_Value" output.
 If the instruction is executed without errors, the "TagOut" output is set.

SCALE_X: Scale:
This instruction is used to scale the value at input VALUE by mapping it to a specified value
range.

 When the "Scale" instruction is executed, the floating-point value at the VALUE input is
scaled to the value range that was defined by the MIN and MAX parameters.
 The result of the scaling is an integer, which is stored in the OUT output.

Execution:

The "Scale" instruction can only be executed when the signal state at the EN enable input is "1".
In this case, the ENO enable output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The value at the MIN input is greater than or equal to the value at the MAX input.
 The value of a specified floating-point number is outside the range of the normalized
numbers according to IEEE-754.
 An overflow occurs.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
50
TIA Portal Manual – July 2013

 The value at the VALUE input is NaN (Not a Number = result of an invalid arithmetic
operation).

Figure 57

The following table shows how the instruction works using specific operand values.

Parameters Operand Value


MIN Tag_MIN 10
VALUE Tag_Value 0.5
MAX Tag_MAX 30
OUT Tag_Result 20

 If operand "TagIn" has the signal state "1", the "Scale" instruction is executed.
 The value at the "Tag_Value" input is scaled to the range of values defined by the values
at the "Tag_MIN" and "Tag_MAX" inputs.
 The result is stored in the "Tag_Result" output.
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

NORM_X: Normalize:
This instruction is used to normalize the value of the tag at input VALUE by mapping it to a
linear scale.

Execution:

The "Normalize" instruction can only be executed when the signal state at the EN enable input is
"1". In this case, the ENO enable output has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The value at the MIN input is greater than or equal to the value at the MAX input.
 The value of a specified floating-point number is outside the range of the normalized
numbers according to IEEE-754.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
51
TIA Portal Manual – July 2013

 The value at the VALUE input is NaN (result of an invalid arithmetic operation).

Figure 58

The following table shows how the instruction works using specific operand values.

Parameters Operand Value


MIN Tag_MIN 10
VALUE Tag_Value 20
MAX Tag_MAX 30
OUT Tag_Result 0.5

 If operand "TagIn" has the signal state "1", the "Normalize" instruction is executed.
 The value at the "Tag_Value" input is mapped to the range of values that were defined by
the values at the "Tag_MIN" and "Tag_MAX" inputs.
 The tag value at the "Tag_Value" input is normalized to the defined value range.
 The result is stored as a floating-point number in the "Tag_Result" output.
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

Program control operations:


--- (JMP): Jump if RLO = 1:
This instruction can be used to interrupt the linear execution of the program and resume it in
another network.

 The destination network must be identified by a jump label (LABEL).


 The name of this jump label is specified in the placeholder above the instruction.

The specified jump label must be in the same block in which the instruction is executed.
The name you specify can only occur once in the block.

Execution:

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
52
TIA Portal Manual – July 2013

 If the result of logic operation (RLO) at the input of the instruction is "1", the jump to the
network identified by the specified jump label is executed.
 The jump direction can be towards higher or lower network numbers.
 If the condition at the input of the instruction is not fulfilled (RLO = 0), execution of the
program continues in the next network.

For example:

CASE1

Figure 59

 If operand "TagIn_1" has the signal state "1", the "Jump if RLO = 1" instruction is
executed.
 The linear execution of the program is interrupted and continues in Network 3, which is
identified by the jump label CAS1.
 If the "TagIn_3" input has the signal state "1", the "TagOut_3" output is set.

--- (JMPN): Jump if RLO = 0


This instruction is used to interrupt the linear execution of the program and resume it in
another network, when the result of logic operation at the input of the instruction is "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
53
TIA Portal Manual – July 2013

 The destination network must be identified by a jump label (LABEL). The name of this
jump label is specified in the placeholder above the instruction.

 The specified jump label must be in the same block in which the instruction is executed.
The name you specify can only occur once in the block.

Execution:

 If the result of logic operation (RLO) at the input of the instruction is "0", the jump to the
network identified by the specified jump label is executed.
 The jump direction can be towards higher or lower network numbers.
 If the result of the logic operation at the input of the instruction is "1", execution of the
program continues in the next network.

For example:

CASE1

Figure 60

 If the operand "TagIn_1" has the signal state "0", the instruction "Jump if RLO = 0" is
executed.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
54
TIA Portal Manual – July 2013

 The linear execution of the program is interrupted and continues in Network 3, which is
identified by the jump label CAS1.
 If the "TagIn_3" input has the signal state "1", the "TagOut_3" output is set.

LABEL: Jump label:


This instruction is use to identify a destination network, in which the program execution should
resume when a jump is executed.

 The jump label and the instruction in which the jump label is specified must be located in
the same block.
 The name of a jump label can only be assigned once in a block.
 Only one jump label can be placed in a network. Each jump label can jump to several
locations.

CASE1

Figure 61

 If operand "TagIn_1" has the signal state "1", the "Jump if RLO = 1" instruction is
executed.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
55
TIA Portal Manual – July 2013

 The linear execution of the program is interrupted and continues in Network 3, which is
identified by the jump label CAS1.
 If the "TagIn_3" input has the signal state "1", the "TagOut_3" output is set.

JMP_LIST: Define jump list:


This instruction is used to define several conditional jumps and resumes the program execution
in a specific network depending on the value of the K parameter.

 The value of the K parameter specifies the number of the output and thus the jump label
where the program execution is to be resumed.
 If the value in the K parameter is greater than the number of available outputs, the
program execution is resumed in the next network of the block.
 The "Define jump list" instruction is only executed if the signal state is "1" at the EN
enable input.

For example:

Figure 62

 If operand "Tag_Input" has the signal state "1", the "Define jump list" instruction is
executed.
 The program execution is resumed according to the value of operand "Tag_Value" in the
network that is identified with the jump label "LABEL1".

Word logic operations:


AND: AND logic operation:
This instruction is to combine the value at the IN1 input and the value at the IN2 input bit-by-bit
by AND logic and query the result at the OUT output.

 When the instruction is executed, bit 0 of the value at the IN1 input and bit 0 of the value
at the IN2 input are logically ANDed. The result is stored in bit 0 of the OUT output.
 The same logic operation is executed for all other bits of the specified values.

 The number of inputs can be expanded in the instruction box.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
56
TIA Portal Manual – July 2013

 The added inputs are numbered in ascending order in the box.


 When the instruction is executed, the values of all available input parameters are
combined with AND logic (ANDed). The result is stored in the OUT output.

Execution:

 The result bit has the signal state "1" only when both of the bits in the logic operation
also have signal state "1".
 If one of the two bits of the logic operation has the signal state "0", the corresponding
result bit is reset.
 The instruction is only executed if the signal state is "1" at the EN enable input. In this
case, the ENO output also has the signal state "1".
 If the signal state at the EN enable input is "0", the ENO enable output also has the signal
state "0".e.g

Figure 63

Table 10

parameters operand value


IN1 Tag_Value1 0101010101010101
IN2 Tag_Value2 0000000000001111
OUT Tag_Result 0000000000000101

 If operand "TagIn" has the signal state "1", the "AND logic operation" instruction is
executed.

 The value of operand "Tag_Value1" and the value of operand "Tag_Value2" are
ANDed.
 The result is mapped bit-for-bit and output in operand "Tag_Result".
 The ENO output and the "TagOut" output are set to signal state "1".

OR: OR logic operation:


This instruction is used to combine the value at the IN1 input and the value at the IN2 input bit-
by-bit by OR logic and query the result at the OUT output.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
57
TIA Portal Manual – July 2013

 When the instruction is executed, bit 0 of the value at the IN1 input and bit 0 of the value
at the IN2 input are logically ORed. The result is stored in bit 0 of the OUT output.
 The same logic operation is executed for all bits of the specified tags.
 The number of inputs can be expanded in the instruction box.
 The added inputs are numbered in ascending order in the box.
 When the instruction is executed, the values of all available input parameters are
combined with OR logic (ORed). The result is stored in the OUT output.

Execution:

 The result bit has the signal state "1" when at least one of the two bits in the logic
operation has the signal state "1".
 If both of the bits of the logic operation have signal state "0", the corresponding result bit
is reset.
 The instruction is only executed if the signal state is "1" at the EN enable input. In this
case, the ENO output also has the signal state "1".
 If the signal state at the EN enable input is "0", the ENO enable output also has the signal
state "0".e.g

Figure 64

Table 11

parameters operand value


IN1 Tag_Value1 0101010101010101
IN2 Tag_Value2 0000000000001111
OUT Tag_Result 0101010101011111
 If operand "TagIn" has the signal state "1", the "OR logic operation" instruction is
executed.
 The value of operand "Tag_Value1" and the value of operation "Tag_Value2" are
ORed.
 The result is mapped bit-for-bit and output in operand "Tag_Result".
 The ENO output and the "TagOut" output are set to signal state "1".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
58
TIA Portal Manual – July 2013

XOR: EXCLUSIVE OR logic operation:


This instruction is used to combine the value at the IN1 input and the value at the IN2 input bit-
by-bit by EXCLUSIVE OR logic and query the result at the OUT output.

 When the instruction is executed, bit 0 of the value at the IN1 input and bit 0 of the value
at the IN2 input are logically EXCLUSIVELY ORed.
 The result is stored in bit 0 of the OUT output. The same logic operation is executed for
all other bits of the specified value.
 The number of inputs can be expanded in the instruction box.
 The added inputs are numbered in ascending order in the box.
 When the instruction is executed, the values of all available input parameters are
combined with EXCLUSIVE OR logic (EXCLUSIVELY ORed). The result is stored in
the OUT output

Execution:

 The result bit has the signal state "1" when one of the two bits in the logic operation has
the signal state "1".
 If both of the bits of the logic operation have signal state "1" or "0", the corresponding
result bit is reset.
 The instruction is only executed if the signal state is "1" at the EN enable input. In this
case, the ENO output also has the signal state "1".
 If the signal state at the EN enable input is "0", the ENO enable output also has the signal
state "0".

Table 12

parameters operand value


IN1 Tag_Value1 0101 0101 0101 0101
IN2 Tag_Value2 0000 0000 0000 1111
OUT Tag_Result 0101 0101 0101 1010

Figure 65

 If operand "TagIn" has the signal state "1", the "EXCLUSIVE OR logic operation"
instruction is executed.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
59
TIA Portal Manual – July 2013

 The value of operand "Tag_Value1" and the value of operand "Tag_Value2" are
EXCLUSIVELY ORed.
 The result is mapped bit-for-bit and output in operand "Tag_Result".
 The ENO output and the "TagOut" output are set to signal state "1".

INV: Create ones complement:


This instruction can be used to invert the signal state of the bits at the IN input.

 When the instruction is processed, the value at the IN input and a hexadecimal template
(W#16#FFFF for 16-bit numbers or DW#16#FFFF FFFF for 32-bit numbers) are
logically EXCLUSIVELY ORed. As a result, the signal state of the individual bits is
inverted and sent to the OUT output.

 The instruction is only executed if the signal state is "1" at the EN enable input. In this
case, the ENO output also has the signal state "1".
 If the signal state at the EN enable input is "0", the ENO enable output also has the signal
state "0".

Figure 66

 If operand "TagIn" has the signal state "1", then the "Create ones complement"
instruction will be executed.
 The instruction inverts the signal state of the individual bits at the TagIn_Value" input
and writes the result to the "TagOut_Value" output.
 The ENO output and the "TagOut" output are set to signal state "1".

DECO: Decode:
This instruction is used to set a bit in the output value specified by the input value.

The "Decode" instruction reads the value at the IN input and sets the bit in the output value
whose bit position corresponds to the read value.

The other bits in the output value will be overwritten with zeroes.

When the value at the IN input is greater than 31, a modulo 32 instruction is executed.

Execution:

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
60
TIA Portal Manual – July 2013

 The "Decode" instruction is only started when the signal state at the EN enable input is
"1".
 If no errors occur during execution, the ENO output also has the signal state "1".
 If the signal state at the EN enable input is "0", the ENO enable output also has the signal
state "0".

Figure 67

 If operand "TagIn" has the signal state "1", the "Decode" instruction is executed.
 The instruction reads bit number "3" from the value at the "TagIn_Value" input and sets
the third bit in the value at the "TagOut_Value" output.
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

ENCO: Encode
This instruction is used to read the bit number of the least significant bit in the input value and
to send it to the OUT output.

 The "Encode" instruction selects the least significant bit of the value at the IN input and
writes its bit number to the tag in the OUT output.

Execution:

 The "Encode" instruction is only started when the signal state at the EN enable input is
"1". If no errors occur during execution, the ENO output also has the signal state "1".
 If the signal state at the EN enable input is "0", the ENO enable output also has the signal
state "0".

Figure 68

 If operand "TagIn" has the signal state "1", the "Encode" instruction is executed.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
61
TIA Portal Manual – July 2013

 The instruction selects the least significant bit at the "TagIn_Value" input and writes bit
position "3" to the tag in the "TagOut_Value" output.
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

MUX: Multiplex:
This instruction is used to copy the content of a selected input to the OUT output.

Execution:

The "Multiplex" instruction can only be executed, when the tags in all inputs and in the OUT
output have the same data type. The K parameter is an exception, since only integers can be
specified for it.

The instruction is only executed if the signal state is "1" at the EN enable input. If no errors
occur during execution, the ENO output also has the signal state "1".

The ENO enable output is reset if one of the following conditions is fulfilled:

 The EN enable input has the signal state "0".


 The value of the K parameter is greater than the number of available inputs.
 Errors occurred during execution of the instruction.

Figure 69

The following table shows how the instruction works using specific operand values.

Parameters Operand Value


K Tag_Number 1
IN0 Tag_Value_0 DW#16#00000000
IN1 Tag_Value_1 DW#16#3E4A7D

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
62
TIA Portal Manual – July 2013

ELSE Tag_Value_2 DW#16#FFFF0000


OUT Tag_Result DW#16#3E4A7D

 If operand "Tag_Input" has the signal state "1", the "Multiplex" instruction is executed.
Depending in the value of operand Tag_Number, the value at the "Tag_Value_1" input is
copied and assigned to the operand at the "Tag_Result" output.
 If the instruction is executed without errors, the "ENO" and Tag_Output outputs are set.

DEMUX: Demultiplex:
This instruction is used to copy the content of the IN input to a selected output.

Execution:

The "Demultiplex" instruction can only be executed if the tags in the IN input and in all outputs
have the same data type. The K parameter is an exception, since only integers can be specified
for it.

The instruction is only executed if the signal state is "1" at the EN enable input. If no errors
occur during execution, the ENO output also has the signal state "1".

The ENO enable output is reset if one of the following conditions is fulfilled:

 The EN enable input has the signal state "0".


 The value of the K parameter is greater than the number of available outputs.
 Errors occurred during execution of the instruction

Figure 70

 If the "Tag_Input" input has the signal state "1", the "Demultiplex" instruction is
executed. Depending on the value of operand "Tag_Number", the value at the IN input is
copied to the corresponding output

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
63
TIA Portal Manual – July 2013

Shift and rotate:


SHR: Shift right
This instruction is used to shift the content of the operand at the IN input bit-by-bit to the right
and query the result at the OUT output.

Execution:

 When the value at the N parameter is "0", the value at the IN input is copied to the
operand at the OUT output.
 When the value at the N parameter is greater than the number of available bit positions,
the operand value at the IN input is shifted by the available number of bit positions to the
right.
 In the case of unsigned values, the freed bit positions in the left area of the operand are
filled with zeroes when shifting occurs.
 If the specified value has a sign, the free bit positions are filled with the signal state of the
sign bit.
 The "Shift right" instruction is only executed if the signal state is "1" at the EN enable
input. In this case, the ENO enable output also has the signal state "1".
 If the signal state at the EN enable input is "0", the ENO enable output also has the signal
state "0".for example,

Figure 71

The following table shows how the instruction works using specific operand values:

Table 13

parameters operand value


IN TagIn_Value 0011 1111 1010 1111
N Tag_Number 3
OUT TagOut_Value 0000 0111 1111 0101

 If operand "TagIn" has the signal state "1", the "Shift right" instruction is executed.
 The content of operand "TagIn_Value" is shifted three bit positions to the right.
 The result is sent to the "TagOut_Value" output. If the instruction is executed without
errors, the ENO output has the signal state "1" and the "TagOut" output is set.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
64
TIA Portal Manual – July 2013

SHL: Shift left:


This instruction is used to shift the content of the operand at the IN input bit-by-bit to the left
and query the result at the OUT output.

Execution:

 When the value at the N parameter is "0", the value at the IN input is copied to the
operand at the OUT output.
 When the value at the N parameter is greater than the number of available bit positions,
the operand value at the IN input is shifted by the available number of bit positions to the
left.
 The bit positions in the right part of the operand freed by shifting are filled with zeros.

Figure 72

The following table shows how the instruction works using specific operand values:

Table 14

parameters operand value


IN TagIn_Value 0011 1111 1010 1111
N Tag_Number 4
OUT TagOut_Value 1111 1010 1111 0000

 If operand "TagIn" has the signal state "1", the "Shift left" instruction is executed.
 The content of operand "TagIn_Value" is shifted four bit positions to the left.
 The result is sent to the "TagOut_Value" output. If the instruction is executed without
errors, the ENO output has the signal state "1" and the "TagOut" output is set.

ROR: Rotate right:


This instruction is used to rotate the content of the operand at the IN input bit-by-bit to the
right and queries the result at the OUT output.

Execution:

 When the value at the N parameter is "0", the value at the IN input is copied to the
operand at the OUT output.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
65
TIA Portal Manual – July 2013

 When the value at the N parameter is greater than the number of available bit positions,
the operand value at the IN input is nevertheless rotated by the specified number of bit
positions.
 The "Rotate right" instruction is only executed if the signal state is "1" at the EN enable
input. In this case, the ENO enable output also has the signal state "1".
 If the signal state at the EN enable input is "0", the ENO enable output also has the signal
state "0".

Figure 73

The following table shows how the instruction works using specific operand values

Table 15

parameters operand value


IN TagIn_Value 0000 1111 1001 0101
N Tag_Number 5
OUT TagOut_Value 1010 1000 0111 1100

 If operand "TagIn" has the signal state "1", the "Rotate right" instruction is executed.
 The content of operand "TagIn_Value" is rotated five bit positions to the right.
 The result is sent to the "TagOut_Value" output. If the instruction is executed without
errors, the ENO output has the signal state "1" and the "TagOut" output is set.

ROL: Rotate left:


This instruction is used to rotates the content of the operand at the IN input bit-by-bit to the left
and queries the result at the OUT output.

Execution:

 When the value at the N parameter is "0", the value at the IN input is copied to the
operand at the OUT output.
 When the value at the N parameter is greater than the number of available bit positions,
the operand value at the IN input is nevertheless rotated by the specified number of bit
positions.
 The "Rotate left" instruction is only executed if the signal state is "1" at the EN enable
input. In this case, the ENO enable output also has the signal state "1".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
66
TIA Portal Manual – July 2013

 If the signal state at the EN enable input is "0", the ENO enable output also has the signal
state "0".

Figure 74

The following table shows how the instruction works using specific operand values:

Table 16

parameters operand value


IN TagIn_Value 1010 1000 1111 0110
N Tag_Number 5
OUT TagOut_Value 0001 1110 1101 0101

 If the "TagIn" input has the signal state "1", the "Rotate left" instruction is executed.
 The content of operand "TagIn_Value" is rotated five bit positions to the left.
 The result is sent to the "TagOut_Value" output. If the instruction is executed without
errors, the ENO output has the signal state "1" and the "TagOut" output is set.

Math operations:
CALCULATE: Calculate:
This instruction is used to define and execute an expression for calculating mathematical
operations or complex logic combinations, depending on the selected data type.

Execution:

The "Calculate" instruction is only executed if the signal state at the enable input EN is "1".
When all the individual instructions of the specified expression are executed without errors, the
ENO enable output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 Enable input EN has the signal state "0".


 The result of the "Calculate" instruction is outside the range permitted for the data type
specified at the OUT output.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
67
TIA Portal Manual – July 2013

 A floating-point number has an invalid value.


 An error occurred during execution of one of the instructions in the expression

Figure 75

The following table shows how the instruction works using specific operand values.

Table 17

parameters operands value


IN1 Tag_Value_1 4
IN2 Tag_Value_2 4
IN3 Tag_Value_3 3
IN4 Tag_Value_4 2
OUT Tag_Output 12

 If the "Tag_Input" input has the signal state"1", the "Calculate" instruction is executed.
 The value of operand "Tag_Value_1" is added to the value of operand "Tag_Value_2".
 The sum is multiplied with the value of operand "Tag_Value_3".
 The product is divided by the value of operand "Tag_Value_4".
 The quotient is transferred as end result to the operand "Tag_Result" at the OUT output
of the instruction.
 If the instruction is executed without errors, the ENO output and operand "Tag_Output"
are set to "1".

ADD: Add:
The add instruction is used to add the value at input IN1 and the value at input IN2 and query
the sum at output OUT (OUT = IN1+IN2).

Execution:

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
68
TIA Portal Manual – July 2013

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO enable output also returns the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 Enable input EN has the signal state "0".


 The result of the instruction is outside the range permitted for the data type specified at
the OUT output.
 A floating-point number has an invalid value.

Figure 76

 If operand "Tag_Input" has the signal state "1", the "Add" instruction is executed.
 The value of operand "Tag_Value1" is added to the value of operand "Tag_Value2".
 The result of the addition is stored in operand "Tag_Result". If the instruction is executed
without errors, the ENO enable output has the signal state "1" and the "TagOut" output is
set.

SUB: Subtract
This instruction is used to subtract the value at the IN2 input from the value at the IN1 input
and query the difference at the OUT output (OUT = IN1-IN2).

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The result of the instruction is outside the range permitted for the data type specified at
the OUT output.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
69
TIA Portal Manual – July 2013

 A floating-point number has an invalid value

Figure 77

 If operand "TagIn" has the signal state "1", the "Subtract" instruction is executed.
 The value of operand "Tag_Value2" is subtracted from the value of operand
"Tag_Value1".
 The result of the subtraction is stored in operand "Tag_Result".
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

MUL: Multiply:
This instruction is used to multiply the value at the IN1 input by the value at the IN2 input and
query the product at the OUT output (OUT = IN1*IN2).

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The result is outside the range permitted for the data type specified at the OUT output.
 A floating-point number has an invalid value.

Figure 78

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
70
TIA Portal Manual – July 2013

 If operand "TagIn" has the signal state "1", the "Multiply" instruction is executed.
 The value of operand "Tag_Value1" is multiplied by the value of operand "Tag_Value2".
 The result of the multiplication is stored in operand "Tag_Result".
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

DIV: Divide:
This instruction is used to divide the value at the IN1 input by the value at the IN2 input and
query the quotient at the OUT output (OUT = IN1/IN2).

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The result of the instruction is outside the range permitted for the data type specified at
the OUT output.
 A floating-point number has an invalid value.

Figure 79

 If operand "TagIn" has the signal state "1", the "Divide" instruction is executed.
 The value of operand "Tag_Value1" is divided by the value of operand "Tag_Value2".
 The division result is stored in operand "Tag_Result".
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set

MOD: Return remainder of division:


This instruction is used to divide the value at the IN1 input by the value at the IN2 input and
query the remainder at the OUT output.

Execution:

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
71
TIA Portal Manual – July 2013

 The instruction is only executed if the signal state is "1" at the EN input. If the instruction
is executed without errors, the ENO output also has the signal state "1".
 The instruction is not executed if the signal state at the EN input is "0". In this case, the
ENO output is reset.

Figure 80

 If operand "TagIn" has the signal state "1", the "Return remainder of division" instruction
is executed.
 The value of operand "Tag_Value1" is divided by the value of operand "Tag_Value2".
 The remainder is stored in operand "Tag_Result".
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

NEG: Create twos complement:


This instruction is used to change the sign of the value at the IN input and query the result at the
OUT output.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The result of the instruction is outside the range permitted for the data type specified at
the OUT output.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
72
TIA Portal Manual – July 2013

 A floating-point number has an invalid value.

Figure 81

 If operand "TagIn" has the signal state "1", the "Create twos complement" instruction is
executed.
 The sign of the value at the "TagIn_Value" input is changed and the result is provided at
the "TagOut_Value" output.
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

INC: Increment
This instruction is used to change the value of the operand at the IN/OUT parameter to the next
higher value and query the result.

Execution:

 The "Increment" instruction is only started when the signal state at the EN enable input
is "1".
 If no overflow error occurs during the execution, the ENO output also has the signal state
"1".
 If the signal state is "0" at the EN enable input, the instruction is not executed. In this
case, the ENO enable output is reset.

Figure 82

 If operands "TagIn_1" and "TagIn_2" have the signal state "1", the value of
operand "Tag_InOut" is incremented by one and the "TagOut" output is set.

DEC: Decrement:
This instruction is used to change the value of the operand at the IN/OUT parameter to the next
lower value and query the result.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
73
TIA Portal Manual – July 2013

Execution:

 Execution of the "Decrement" instruction is started when the signal state at the EN enable
input is "1".
 If the range of values of the selected data type is not exceeded during processing, the
ENO output also has the signal state "1".
 If the signal state is "0" at the EN enable input, the instruction is not executed. In this
case, the ENO enable output is reset.

Figure 83

 If operands "TagIn_1" and "TagIn_2" have the signal state "1", the value of operand
"Tag_InOut" is decremented by one and the "TagOut" output is set.

ABS: Form absolute value:


This instruction is used to calculate the absolute value of the value specified at the IN input.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 A floating-point number has an invalid value.

Figure 84

 If operand "TagIn" has the signal state "1", the "Form absolute value" instruction is
executed.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
74
TIA Portal Manual – July 2013

 The instruction calculates the absolute value of the value at the "TagIn_Value" input and
sends the result to the "TagOut_Value" output.
 If the instruction is executed without errors, the "TagOut" output is set.

MIN: Get minimum:


This instruction is used to compare the values of the available inputs and writes the lowest
value to the OUT output.

 A minimum of two and a maximum of 100 inputs must be specified for the execution of
the instruction

Execution:

Execution of the instruction presupposes that the tags at all inputs are of the same type and that
enable input EN has signal state "1". If the instruction is executed without errors, the ENO
enable output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 Enable input EN has the signal state "0".


 The specified tags are not of the same data type.
 A floating-point number has an invalid value.

Figure 85

The following table shows how the instruction works using specific operand values:

Table 18

parameters operands value


IN1 "TagIn_Value1" 12.222
IN2 "TagIn_Value2" 13.333
IN3 "TagIn_Value3" 14.444
Out TagOut_Value 12.222

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
75
TIA Portal Manual – July 2013

 If operands "TagIn_1" and "TagIn_2" have the signal state "1", the "Get minimum"
instruction is executed.
 The instruction compares the values of the specified operands and copies the lowest value
("TagIn_Value1") to the "TagOut_Value" output.
 If the instruction is executed without errors, the "TagOut" output is set

MAX: Get maximum:


This instruction is used to compare the values of the available inputs and writes the highest
value to the OUT output.

 A minimum of two and a maximum of 100 inputs must be specified for the execution of
the instruction.

Execution:

Execution of the instruction presupposes that the tags at all inputs are of the same type and that
enable input EN has signal state "1". If the instruction is executed without errors, the ENO
enable output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 Enable input EN has the signal state "0".


 The specified tags are not of the same data type.
 A floating-point number has an invalid value.

Figure 86

The following table shows how the instruction works using specific operand values:

Table 19

parameters operands value


IN1 "TagIn_Value1" 12.222
IN2 "TagIn_Value2" 13.333
IN3 "TagIn_Value3" 14.444
Out TagOut_Value 14.444

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
76
TIA Portal Manual – July 2013

 If operands "TagIn_1" and "TagIn_2" have the signal state "1", the "Get maximum"
instruction is executed.
 The instruction compares the values of the specified operands and copies the highest
value ("TagIn_Value2") to the "TagOut_Value" output.
 If the instruction is executed without errors, the "TagOut" output is set.

LIMIT: Set limit value:


This instruction is used to limit the value at the IN input to the values at the MN and MX inputs.

 If the value at the IN input meets the MN < IN < MX condition, it is copied to the OUT
output.
 If the condition is not fulfilled and the input value IN is below the low limit MN, the
output OUT is set to the value of the MN input.
 If the high limit is exceeded, the MX output OUT is set to the value of the MX input.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO enable output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 Enable input EN has the signal state "0".


 The specified tags are not of the same data type.
 An operand has an invalid value.
 The value at the MN input is greater than the value at the MX input.

Figure 87

The following table shows how the instruction works using specific operand values

Table 20

parameters operands value


IN1 ""Tag_MN" 12
IN2 "Tag_Value” 8

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
77
TIA Portal Manual – July 2013

IN3 ""Tag_MX" 16
Out Tag_Result 12

 If operands "TagIn_1" and "TagIn_2" have the signal state "1", the "Set limit value"
instruction is executed.
 The value of operand "Tag_Value" is compared with the values of operands "Tag_MN"
and "Tag_MX".
 Since the value of operand "Tag_Value" is less than the low limit, the value of operand
"Tag_MN" is copied to the "Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

SQR: Form square:


This instruction is used to square the value at the IN input and query the result at the OUT
output.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The value at the IN input is not a valid floating-point number

Figure 88

The following table shows how the instruction works using specific operand values:

Table 21

Parameters Operands Value


IN Tag_Value 5.0
OUT Tag_Result 25.0

 If operand "TagIn" has the signal state "1", the "Form square" instruction is executed.
 The instruction squares the value of operand "Tag_Value" and sends the result to the
"Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
78
TIA Portal Manual – July 2013

SQRT: Form square root:


This instruction is used to find the square root of the value at the IN input and query the result
at the OUT output.

 The instruction outputs a positive result if the input value is greater than zero.
 If input values are less than zero, the OUT output returns an invalid floating-point
number.
 If the value at input IN is "0", then the result is also "0".

Execution:

The instruction is only executed if the signal state is "1" at the enable input. If the instruction is
executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The value at the IN input is not a valid floating-point number.
 The value at the IN input is negative.

Figure 89

The following table shows how the instruction works using specific operand values:

Table 22

Parameters Operands Value


IN Tag_Value 25.0
OUT Tag_Result 5.0

 If operand "TagIn" has the signal state "1", the "Form square root" instruction is
executed.
 The instruction finds the square root of the value of operand "Tag_Value" and stores the
result in the "Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

LN: Form natural logarithm:


This instruction is used to calculate the natural logarithm to base e (e = 2.718282e+00) of the
value at input IN.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
79
TIA Portal Manual – July 2013

 The instruction outputs a positive result if the input value is greater than zero.
 If input values are less than zero, the OUT output returns an invalid floating-point
number.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is processed without errors, the ENO enable output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 Enable input EN has the signal state "0".


 The value at the IN input is not a valid floating-point number.
 The value at the IN input is negative.

Figure 90

 If operand "TagIn" has the signal state "1", the "Form natural logarithm" instruction is
executed.
 The instruction forms the natural logarithm of the value at the "Tag_Value" input and
stores the result in the "Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

EXP: Form exponential value:


This instruction is used to calculate the exponent from the base e (e = 2.718282e+00) and the
value specified at the IN input.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 Enable input EN has the signal state "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
80
TIA Portal Manual – July 2013

 The value at the IN input is not a valid floating-point number.

Figure 91

 If operand "TagIn" has the signal state"1", the "Form exponential value" instruction is
executed.
 The instruction calculates the exponent from base e and the value of operand
"Tag_Value" and sends the result to the "Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

SIN: Form sine value:


This instruction is used to calculate the sine of the angle.

 The size of the angle is specified in radians at the input IN.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The value at the IN input is not a valid floating-point number.

Figure 92

The following table shows how the instruction works using specific operand values:

Table 23

Parameters Operands Value


IN Tag_Value 1.575e+00

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
81
TIA Portal Manual – July 2013

OUT Tag_Result 1

 If operand "TagIn" has the signal state "1", the "Form sine value" instruction is executed.
 The instruction calculates the sine of the angle specified at the "Tag_Value" input and
stores the result in the "Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

COS: Form cosine value:


This instruction is used to calculate the cosine of an angle.

 The size of the angle is specified in radians at the IN input.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The value at the IN input is not a valid floating-point number.

Figure 93

The following table shows how the instruction works using specific operand values:

Table 24

Parameters Operands Value


IN Tag_Value 1.575e+00
OUT Tag_Result 0

 If operand "TagIn" has the signal state "1", the "Form cosine value" instruction is
executed.
 The instruction calculates the cosine of the angle specified at the "Tag_Value" input and
stores the result in the "Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

TAN: Form tangent value:


This instruction is used to calculate the tangent of an angle.

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
82
TIA Portal Manual – July 2013

 The size of the angle is specified in radians at the IN input.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The value at the IN input is not a valid floating-point number.

Figure 94

The following table shows how the instruction works using specific operand values:

Table 25

Parameters Operands Value


IN Tag_Value +3.14e+00
OUT Tag_Result 0

 If operand "TagIn" has the signal state "1", the "Form tangent value" instruction is
executed.
 The instruction calculates the tangent of the angle specified at the "Tag_Value" input and
stores the result in the "Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

ASIN: Form arcsine value:


This instruction is used to calculate the size of the angle corresponding to the sine value
specified at the IN input.

 Only valid floating-point numbers within the range -1 to +1 can be specified at the IN
input.
 The calculated angle size is output in radians at the OUT output and can range in value
from -π/2 to +π/2.

Execution:

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
83
TIA Portal Manual – July 2013

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The value at the IN input is not a valid floating-point number.
 The value at the IN input is outside the permitted value range (-1 to +1).

Figure 95

The following table shows how the instruction works using specific operand values:

Table 26

Parameters Operands Value


IN Tag_Value 1.0
OUT Tag_Result 1.5701e+00

 If operand "TagIn" has the signal state "1", the "Form arcsine value" instruction is
executed.
 The instruction calculates the size of the angle corresponding to the sine value at the
"Tag_Value" input.
 The result of the instruction is stored in the "Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

ACOS: Form arccosine value:


This instruction is used to calculate the size of the angle corresponding to the cosine value
specified at the IN input.

 Only valid floating-point numbers within the range -1 to +1 can be specified at the IN
input.
 The calculated angle size is output in radians at the OUT output and can range in value
from 0 to +π.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
84
TIA Portal Manual – July 2013

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".


 The value at the IN input is not a valid floating-point number.
 The value at the IN input is outside the permitted value range (-1 to +1).

Figure 96

The following table shows how the instruction works using specific operand values:

Table 27

Parameters Operands Value


IN Tag_Value 0
OUT Tag_Result 1.5707e+00

 If operand "TagIn" has the signal state "1", the "Form arccosine value" instruction is
executed.
 The instruction calculates the size of the angle corresponding to the cosine value at the
"Tag_Value" input.
 The result of the instruction is stored in the "Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

ATAN: Form arctangent value:


This instruction is used to calculate the size of the angle corresponding to the tangent value
specified at the IN input.

 Only valid floating-point numbers may be specified at the IN input.


 The calculated angle size is output in radians at the OUT output and can range in value
from -π/2 to +π/2.

Execution:

The instruction is only executed if the signal state is "1" at the EN enable input. If the instruction
is executed without errors, the ENO output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
85
TIA Portal Manual – July 2013

 The value at the IN input is not a valid floating-point number.

Figure 97

The following table shows how the instruction works using specific operand values:

Table 28

Parameters Operands Value


IN Tag_Value 1.00
OUT Tag_Result 0.7853e+00

 If operand "TagIn" has the signal state"1", the "Form arctangent value" instruction is
executed.
 The instruction calculates the size of the angle corresponding to the tangent value at the
"Tag_Value" input.
 The result of the instruction is stored in the "Tag_Result" output.
 If the instruction is executed without errors, the "TagOut" output is set.

FRAC: Return fraction:


This instruction is used to determine the decimal places of the value at the IN input.

 The result of the query is stored at the OUT output and can be queried there.
 If the value at the IN input is 123.4567, for example, the OUT output returns the value
0.4567.

Execution:

The instruction is started when the EN input has the signal state "1". In this case, the ENO enable
output also has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
86
TIA Portal Manual – July 2013

 Errors occur during execution of the instruction, for example, there is no valid floating-
point number at the IN input

Figure 98

The following table shows how the instruction works using specific operand values:

Parameters Operands Value


IN Tag_Value 2,555
OUT Tag_Result 0,555

 If operands "TagIn_1" and "TagIn_2" have the signal state "1", the "Return fraction"
instruction is started.
 The decimal places from the value of operand "Tag_Value" are copied to operand
"Tag_Result".
 If the instruction is executed without errors, the ENO output has the signal state "1" and
the "TagOut" output is set.

EXPT: Exponentiate:
This instruction is used to raise the value at the IN1 input to a power specified with the value at
the IN2 input.

 The result of the instruction is stored in the OUT output and can be queried there (OUT
= IN1IN2).

 The IN1 input can only be assigned valid floating-point numbers. Integers can also be
assigned to the IN2 input.

Execution:

The "Exponentiate" instruction can only be executed when the signal state at the EN enable input
is "1". In this case, the ENO enable output has the signal state "1".

The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:

 The EN input has the signal state "0".

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor
87
TIA Portal Manual – July 2013

 Errors occur during execution of the instruction, for example, an overflow occurs.

Figure 99

Provided by IME – Naeemullah – uzair khan jadoon (Batch 4)


Under supervision of Engr. Zubair Ahmad Lecturer at IME and Automation Lab Supervisor

You might also like