TIA Portal Guide for Engineers
TIA Portal Guide for Engineers
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
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
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
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
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
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
Let’s Begin.
Figure 1
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.
Figure 3
Figure 4
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
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
Figure 8
From the project tree window click on PLC_1 which is a default name given to the device.
Figure 9
Figure 10
Figure 11
Figure 12
Figure 13
Bit operations:
TIA has a no. of bit instructions to operate on bits. Each of them is briefly explained below.
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
The operands "switch_1" and "switch_2" have the signal state "1".
Table 1
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
Figure 15
The operands "switch_1" and "switch_2" have the signal state "1".
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
Figure 16
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".
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
The operands "switch_4" and "switch_6" have the signal state "1".
The signal state of the operand "switch_3" is "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".
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 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:
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.
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.
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”.
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 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".
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 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".
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
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.
Figure 25
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.
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".
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.
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”.
Figure 29
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".
If input IN switches to "1" before the duration PT has expired, the ET output is reset to
the value T#0s.
Figure 30
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:
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".
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".
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.
Figure 34
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
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").
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
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.
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").
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
Figure 37
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").
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
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").
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 8
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").
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
Figure 40
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").
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".
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.
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".
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.
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".
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.
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
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".
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:
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.
The field component to be read is specified by the value at the INDEX 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:
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.
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:
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:
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.
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:
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.
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:
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.
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:
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 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.
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:
Figure 53
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.
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:
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.
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.
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:
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.
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:
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 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.
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 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.
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.
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 "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.
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.
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.
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.
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.
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".
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.
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
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".
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
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
Figure 65
If operand "TagIn" has the signal state "1", the "EXCLUSIVE OR logic operation"
instruction is executed.
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".
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:
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.
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:
Figure 69
The following table shows how the instruction works using specific operand values.
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:
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
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
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.
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
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.
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 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
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.
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".
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
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:
Figure 75
The following table shows how the instruction works using specific operand values.
Table 17
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:
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:
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:
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:
Figure 78
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:
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
Execution:
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.
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:
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.
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.
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:
Figure 84
If operand "TagIn" has the signal state "1", the "Form absolute value" instruction is
executed.
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.
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:
Figure 85
The following table shows how the instruction works using specific operand values:
Table 18
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
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:
Figure 86
The following table shows how the instruction works using specific operand values:
Table 19
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.
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:
Figure 87
The following table shows how the instruction works using specific operand values
Table 20
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.
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:
Figure 88
The following table shows how the instruction works using specific operand values:
Table 21
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.
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:
Figure 89
The following table shows how the instruction works using specific operand values:
Table 22
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.
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:
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.
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:
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.
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:
Figure 92
The following table shows how the instruction works using specific operand values:
Table 23
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.
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:
Figure 93
The following table shows how the instruction works using specific operand values:
Table 24
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.
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:
Figure 94
The following table shows how the instruction works using specific operand values:
Table 25
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.
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:
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:
Figure 95
The following table shows how the instruction works using specific operand values:
Table 26
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.
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".
The ENO enable output has the signal state "0" if one of the following conditions is fulfilled:
Figure 96
The following table shows how the instruction works using specific operand values:
Table 27
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.
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:
Figure 97
The following table shows how the instruction works using specific operand values:
Table 28
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.
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:
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:
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:
Errors occur during execution of the instruction, for example, an overflow occurs.
Figure 99