Course HMI Training Siemens
Course HMI Training Siemens
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Contents Page
LG
Objectives .......................................................................................................................................... 3
PN
SITRAIN ST-PRO1
Training for Industry Page 1 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Contents Page
LG
Additional Exercise 4: Counting the Conveyor Belt Fault Conditions (FC17) ................................... 24
U
IV
SITRAIN ST-PRO1
Training for Industry Page 2 Digital Operations
SITRAIN
C PR
ur O
Page 3
23 PN
.0 D
9. @ EL
19 G C
O
KN N
D TE
riv N
el ID
in O
e
C
el
ay
a
Digital Operations
ST-PRO1
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Binary/Digital True logic control systems are recognizable in the fact that they exclusively
LG
processing, quality control areas, among others, has increased the importance of
IV
19
9.
Digital process variables can be found in all areas of open-loop control - such as in
C
connected devices for process operating and monitoring or in the control of field
LA
.0
C
devices.
23
W
A
Operating and The goal of process monitoring is to provide the operator with up-to-the-minute
ID
Monitoring information about the working machine or system quickly, concisely and clearly as
IB
well as the opportunity to intervene and control and influence the process.
2
O
H
While in the past mostly simple, that is, "dumb" input and output devices, such as 7-
PR
O
segment displays and thumbwheel buttons were used to display and enter digital
values, today "intelligent" operating and monitoring devices are frequently
PR
connected to a PLC.
A
TI
Field Devices Today as well, field devices that acquire process data or that control the process are
so
supplied directly with digital variables through field bus systems. The connection of
field devices, such as drives or weighing systems, using analog input and output
ur
Formats Depending on the type of device connected, different number formats for the coding
of data are used to transmit data between device and PLC, as well as for storing
and processing data in the PLC.
SITRAIN ST-PRO1
Training for Industry Page 4 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Integer Data Type An Integer data type value is a whole number value, that is, a value without a
LG
SIMATIC S7 stores Integer data type values with sign in 16 bit code. This results in
U
the value range shown in the slide above. As well, SIMATIC S7 provides arithmetic
IV
19
9.
C
LA
Decimal STEP7 uses the Decimal (not BCD!) display format to specify the constants of the
.0
C
Integer data type with sign and without explicit format description. The use of
23
W
constant Integer values in the Binary and Hexadecimal display formats is possible in
A
principle, but because of the poor legibility, they are more or less not suitable. For
ID
this reason, the syntax of STEP7 provides the specification of Integer values only in
IB
PR
O
Binary In a digital computer system, all values are stored in a binary-coded form. Only the
PR
digits 0 and 1 are available in the binary number system. Base 2 of this numbers
A
system results from the number of available digits. Accordingly, the value of every
TI
position of a binary number results from a power of Base 2. This is also expressed
in the format specification 2#.... .
so
representation, the most significant bit (bit no. 15 for the Integer data type) has the
C
value - 215. Since this value is greater than the sum of all residual values, this bit
also has the sign information. That is, if this bit = 0, then the value is positive; if the
bit is = 1, then the value is negative. The conversion of a binary number into a
decimal number is made by adding the values of the positions that have a 1 (see
slide).
SITRAIN ST-PRO1
Training for Industry Page 5 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Double Integer SIMATIC S7 stores Double Integer data type values with sign as 32 bit code.
LG
(32-Bit Integer) This results in the value range shown in the slide above. As well, SIMATIC S7
PN
19
Decimal STEP7 uses a decimal number (not BCD!) to specify a constant of the Double
D
Integer data type with sign and the format L# for "long" (double word, 32 bit).
9.
C
When a value smaller than -32768 or greater than 32767 is specified, the format L#
LA
.0
C
is automatically added. For negative numbers smaller than -32768, the user must
23
specify the format as L# - (for example: L# -32769). This is imperative if the value is
W
A
2
O
A to F). This results in Base 16 of this numbers system. Accordingly, the value of
PR
O
Hexadecimal numbers are specified with the format W# for the dimension
A
(W = word = 16 bit) or DW# (DW = double word = 32 bit) and 16# for identifying the
TI
The digits A to F correspond to the decimal values 10 to 15. The value 15 is the last
ur
value that can be binary-coded - without sign - with 4 bits. Out of this correlation, the
C
simple conversion of a binary number into a hexadecimal number and vice versa
can be obtained. In this way, four binary bits each can easily make up one digit of a
hexadecimal number.
SITRAIN ST-PRO1
Training for Industry Page 6 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Real The previously described INT and DINT data types are used to store whole number
LG
values with sign. Accordingly, only operations that supply a whole number value as
PN
In cases where analog process variables such as voltage, current, and temperature
IV
19
"decimal numbers"). In order to be able to represent such values, binary digits have
9.
to be defined whose value is less than 1 (power of base 2 with negative exponent).
C
LA
.0
C
23
Real Format In order to be able to form the greatest possible value range within a defined
W
A
memory capacity (for SIMATIC S7: double word, 32 bit) (see slide), you must be
ID
able to select the decimal point position. Early on, IEEE defined a format for
+
floating-point numbers. This format was laid down in IEC 61131 and was included in
IB
STEP 7. This format makes it easy to process a variable decimal point position.
O
H
In a binary coded floating-point number, a portion of the binary digits contain the
PR
O
mantissa (23 Bit) and the rest contain the exponent (8 Bit) and the sign of the
PR
floating-point number.
A
When you specify real values, you do so without specifying the format. After you
TI
enter a constant real value (for example: 0.75), the Editor automatically makes a
conversion to scientific notation (for example: 7.5000e-001).
so
ur
Application Floating-point numbers are used for "analog value processing", among others.
C
SITRAIN ST-PRO1
Training for Industry Page 7 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Origin In the past, the specification and visualization of whole numbers was done
LG
These thumbwheel buttons and digital displays were connected to the PLC‘s digital
U
19
D
9.
BCD Code Each digit of a decimal number is encoded in four bit positions (a nibble). Four bits
C
are used because the highest decimal digit, 9, requires at least four bit positions in
LA
.0
C
binary code.
23
W
A
ID
0 0000 6 0110
IB
1 0001 7 0111
O
H
2 0010 8 1000
PR
O
3 0011 9 1001
PR
Negative Numbers So that negative numbers can also be specified using a BCD thumbwheel button,
ur
STEP 7 codes the sign in the most significant bit of the most significant digit (see
slide). A sign bit = 0 indicates a positive number. A sign bit = 1 indicates a negative
C
number.
STEP 7 recognizes 16-bit-coded (sign + 3 digits) and 32-bit-coded (sign + 7 digits)
BCD numbers.
Data Formats There is no data format for specifying BCD-coded values in STEP 7. You can,
however, specify the decimal number whose BCD code is to be given, as a HEX
number. The binary code of the HEX number and that of the BCD-coded decimal
number is identical.
As you can see in the slide, the DEC data format is not suitable for specifying BCD
coded numbers!
SITRAIN ST-PRO1
Training for Industry Page 8 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
Display Formats Different display formats can be selected in both the "Monitor / Modify Variables" and
SI
PN
Every variable can be monitored with several display format options. Depending on
U
the variable‘s data type, it becomes apparent that monitoring with the appropriate
IV
19
9.
.0
23
(makes sense for variables of the BYTE, WORD, DWORD data types)
W
A
(makes sense for variables of the BYTE, WORD, DWORD data types)
IB
with sign (makes sense for variables of the INT, DINT data types)
H
PR
O
A
TI
(low byte, see slide), the memory double-word MD 80, the memory bytes MB 80, 81,
82 and 83.
ur
With absolute accesses to variables (such as, with L MD 80), you must make sure
C
that the dimension of the access (here MD...) as well as the address (always equal to
the address of the high byte, here 80) is correct. Through an inadvertent "accessing
in between", an invalid value would be loaded (such as, with L MW 83, see slide).
Such errors can be avoided with the symbolic addressing of variables (here L
"MD_DINT").
SITRAIN ST-PRO1
Training for Industry Page 9 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
MOVE (LAD/FBD) If the EN input is active, the value at input "IN" is copied to the address specified at
LG
L and T (STL) Load and transfer instructions are executed regardless of the RLO. Data is
+
19
9.
C
LA
.0
C
Standard / ACCU1 Accumulator 1 (ACCU1) is the main register in the CPU. The load instruction writes
23
W
the value from the source address right-justified into the (standard) accumulator 1
A
and pads the remaining bits (32 bits in all) with "0"s.
ID
The transfer instruction copies some or all of the contents of accumulator 1 to the
IB
specified memory address without clearing the contents of accumulator 1 (see next
O
H
page). All arithmetic and digital operations store their result in accumulator 1.
PR
O
PR
ACCU2 When a load instruction is executed, the old contents of accumulator 1 are first
A
shifted to accumulator 2 and accumulator 1 is cleared (reset to "0") before the new
TI
SITRAIN ST-PRO1
Training for Industry Page 10 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
General Accumulators are auxiliary memories in the CPU for data exchange between
LG
The S7-300 usually has two accumulators with 32 bits each and the CPU 318-2 and
U
the S7-400 each have four accumulators also with 32 bits each.
IV
19
D
Load The load instruction loads the contents of the specified byte, word or double word
9.
.0
C
23
Transfer When a transfer instruction is executed, the contents of ACCU 1 are retained.
W
A
only one byte is transferred, the eight bits farthest to the right are used (see slide).
+
IB
2
O
H
PR
O
PR
A
TI
so
ur
C
SITRAIN ST-PRO1
Training for Industry Page 11 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Counter Value A 16-bit word is reserved for each counter in the system data memory. This word is
LG
Count Up When the RLO at the "CU" input changes from "0" to "1", the counter’s current value
IV
19
9.
C
LA
.0
Count Down When the RLO at the "CD" input changes from "0" to "1", the counter’s current value
C
Set Counter When the RLO at the "S" input changes from "0" to "1", the counter is set to the
+
IB
PR
Reset Counter When the RLO at the Reset changes from "0" to "1", the counter’s value is set to
O
zero. If the reset condition is fulfilled (stays "high"), the counter cannot be set and
PR
PV The preset value (0 to 999) is specified in BCD format at the "PV" input as:
so
• as a constant (C#...)
ur
CV / CV_BCD The counter value can be loaded into the accumulator at the binary output as an
Integer value (CV) or at the decimal output as a BCD number (CV_BCD) and then
transferred from there to other addresses.
SITRAIN ST-PRO1
Training for Industry Page 12 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Notes When the counter reaches the value 999 during count up, the counter value stays at
LG
999 with subsequent count up signals. Likewise, when the counter reaches the
PN
value 0, the counter value stays at 0 with subsequent count down signals.
U
IV
19
If an up count and a down count signal occurs at the same time, the count remains
the same.
D
9.
C
LA
.0
C
23
W
A
ID
+
IB
2
O
H
PR
O
PR
A
TI
so
ur
C
SITRAIN ST-PRO1
Training for Industry Page 13 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Function Up Till Now In AUTO mode, parts are transported from Bay 1 or Bay 2 to the Light Barrier Bay
LG
until they pass through the light barrier. The transportation function starts as soon
PN
as a part is placed on Bay 1 or Bay 2 and the associated bay’s momentary contact
U
is pressed and it ends as soon as the part has passed the light barrier.
IV
19
D
Task • The parts transported in AUTO mode are to be counted as soon as they have
9.
.0
C
• The counter is to be reset when the system is switched off (Q 4.1 = "0").
+
IB
2
O
H
What to Do 1. Program the counting of the transported parts in the block "FC_Count" (FC18).
PR
O
SITRAIN ST-PRO1
Training for Industry Page 14 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
LG
PN
General In control engineering, the following traditional timer functions (S5 timer functions)
have long since established themselves:
U
19
9.
.0
C
Memory Timers have their own reserved memory area in the CPU in which each timer
IB
function occupies one word. To find out how many timer words and thus timer
O
H
functions are available in a CPU, please check the CPU‘s technical data.
PR
O
PR
Time Value The time value can be specified via a variable (such as MW50) or - as shown in the
A
slide - via a constant. The syntax for specifying a constant time value is (can be
TI
SITRAIN ST-PRO1
Training for Industry Page 15 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Start The timer starts when the RLO at the Start input "S" changes from "0" to "1". The
LG
timer starts with the time value specified at the Time Value "TV" for as long as the
PN
19
Reset When the RLO at the Reset input "R" changes from "0" to "1", the current time value
D
and the time base are deleted and the output "Q" is reset.
9.
C
LA
.0
C
Digital Outputs The current time value can be read as a binary number at the "BI" output and as a
23
The current time value is the initial value of "TV" minus the value for the time that
ID
2
O
H
Binary Output The signal at the "Q" output changes to "1" when the timer has expired without error
PR
O
If the signal state at the "S" input changes from "1" to "0" before the timer has
expired, the timer stops running and output "Q" has a signal state "0".
A
TI
Note In STEP 7, you can replace the traditional timer and counter functions with IEC –
so
conforming system function blocks (SFB). The use of system function blocks is
dealt with in an advanced programming course.
ur
C
SITRAIN ST-PRO1
Training for Industry Page 16 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Task The transport functions while in AUTO mode are to be monitored. The monitoring
LG
is to function as follows:
PN
U
• If the transport function takes longer than the 6 second monitoring time (if a
IV
part does not pass through the light barrier within 6 seconds of its start time),
+
19
then there is a fault in the system and the conveyor motor is automatically
D
9.
.0
• A fault is displayed with a 2Hz flashing light (bit no. 3 of the CPU clock memory
C
23
"T_Ackn_Fault" (I 1.0)
IB
• The indicator lights at Bays 1 and 2 only once more show a constant light (=
O
H
place a new part), when the fault has been acknowledged (lock-out in
PR
O
FC 14)
PR
- When a fault exists, set the memory bit M 17.0 in order to be able to
ur
SITRAIN ST-PRO1
Training for Industry Page 17 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Application Since there are no arithmetic operations for the direct processing of BCD-coded
LG
values, these have to be converted into arithmetic data types (I, DI or R) through
PN
format conversions.
U
IV
19
Conversion S7-300 / 400 has a series of conversion operations available– here a few
D
Operations examples:
9.
C
LA
.0
23
PR
EN The execution of the conversion operation can be determined as follows via the EN
O
input:
PR
Logic operation at EN is not fulfilled (RLO = 0): the conversion is not executed
so
SITRAIN ST-PRO1
Training for Industry Page 18 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
CMP You can use comparison instructions to compare the following pairs of numerical
LG
values:
PN
19
9.
.0
If the result of the comparison is "true", then the RLO of the operation is "1",
C
23
otherwise it is "0".
W
A
The values at inputs IN1 and IN2 are compared for conformity with the specified
ID
condition:
+
IB
2
O
H
SITRAIN ST-PRO1
Training for Industry Page 19 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Arithmetic S7-300 / 400 has a series of arithmetic operations for the processing of
LG
Operations variables of the integer (I), double integer (DI) and real (R) arithmetic data types.
PN
U
19
EN The execution of the operation can be determined as follows via the EN input:
D
9.
.0
23
Logic operation at EN is not fulfilled (RLO = 0): the operation is not executed
W
A
ID
IN1 / IN2 The arithmetic calculation is applied to the values delivered to IN1 and IN2 (in STL,
IB
the value loaded first with the value loaded second, in general: ACCU2 with
2
O
PR
O
The variable delivered to OUT is not written, that is, it keeps its original value
A
SITRAIN ST-PRO1
Training for Industry Page 20 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
Function Up Till Now • The parts transported in AUTO mode are counted (with the S5 counter C18)
SI
in FC 18 as soon as they have passed through the light barrier "LB" ("LB": 0 1)
LG
PN
digital display.
IV
19
• The counter is reset when the system is switched off (Q 4.1 = "0").
D
9.
New Function FC19 • The counting of the transported parts is no longer to be done with the counter
C
LA
.0
23
W
• The SETPOINT Quantity of how many parts are to be transported can be set
A
using the BCD thumbwheel. When the given SETPOINT Quantity is reached, it
ID
"L_Bay-LB" (Q 8.4).
2
O
• As long as the message "ACT=SET" (Q 8.4) exists, the indicator lights at Bay 1
H
and Bay 2 are dark (= no new part can be place on the conveyor lock-out in
PR
O
(MW 20). Also, when the system is switched off, the ACT Quantity (MW 20) is
reset to "0".
so
ur
What to Do 1. Program the new block "FC_Count_Add" (FC 19) with the new counter and
C
comparison functions
2. In OB1, call the new FC 19 instead of the old FC 18
3. In the blocks "FC_Signal" (FC 14) and "FC_ConvMotor" (FC 16), program the
appropriate lock-outs
Note When you set the SETPOINT Quantity, the CPU occasionally goes into the
STOP state because the BCD thumbwheel "bounces" when you change the
numbers or it delivers invalid values.
SITRAIN ST-PRO1
Training for Industry Page 21 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Counting via Counting the transported parts using a memory word for each addition has,
LG
Addition among others, the following benefits vis-à-vis counting using S5 counters:
PN
U
when you count using Integer addition you can count from -32768 to + 32767.
+
19
D
9.
Partial Functions The complete function of the FC 19 can be broken down into the following
C
LA
.0
23
W
• NW 1: Set "Counter" to 0
A
ID
means overwriting the contents of memory word MW 20, that is used as the
+
counter, with 0.
IB
PR
O
means increasing the contents of the memory word by 1 (with addition) every
time the count event occurs (not as long as the count event itself exists!). The
PR
stored as an Integer, a format conversion from Integer to BCD must take place
ur
SITRAIN ST-PRO1
Training for Industry Page 22 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Note The following pages contain either further information or are for reference to
LG
complete a topic.
PN
For more indepth study we offer advanced courses and self-learning mediums.
U
IV
19
D
9.
C
LA
.0
C
23
W
A
ID
+
IB
2
O
H
PR
O
PR
A
TI
so
ur
C
SITRAIN ST-PRO1
Training for Industry Page 23 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Function Up Till Now The transport functions in AUTO mode are monitored. If the transport function takes
LG
longer than the 6 second monitoring time (if a part does not pass through the light
PN
barrier within 6 seconds of its start time), then there is a conveyor belt fault
U
condition in the system and the conveyor motor is automatically switched off (logic
IV
19
in FC 16).
D
9.
C
LA
.0
Task: The conveyor belt fault conditions in AUTO mode are to be counted. After 3
C
conveyor belt fault conditions have occurred, the AUTO mode is to be switched off
23
W
A
for safety reasons. To start a new transport function, the fault condition must be
ID
acknowledged (as already programmed) and the AUTO mode must be switched on
+
once more.
IB
2
O
H
PR
What to Do: 1. In FC 17, in a new network, program the counting of the conveyor belt fault
O
- When the "Auto" mode is switched on, the counter is set to 3 (number of
A
TI
conveyor belt fault conditions until the AUTO mode is switched off)
- The counter counts down 1 every time a conveyor belt fault condition
so
SITRAIN ST-PRO1
Training for Industry Page 24 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
The Function JoggingIn MANUAL mode (Q8.2 / Q 4.2 = ´1´), you can jog the conveyor motor to the
LG
in FC 16 Up Till Now: RIGHT and to the LEFT using the simulator momentary contacts I 0.2 and I 0.3.
PN
U
Task: In order to avoid too great a load change, it should only be possible to jog the
IV
19
conveyor motor in the opposite direction after it has been jogged to the RIGHT or to
D
9.
the LEFT after a lock-out time of 2 seconds (see slide). If, for example, the motor
C
LA
has been jogged to the RIGHT, then it can only be jogged back to the LEFT after
.0
C
What to Do: 1. In FC 16 program the S5 timers T 15 and T 16 as the lock-out timers RIGHT and
+
LEFT as OFF Delay (SF). Start T 15 when the jog condition RIGHT is fulfilled
IB
PR
2. Interlock the timer states to the jog conditions. The jog condition RIGHT may
O
Solution Hint: By using a "branch", you can integrate the timers in the two networks Jog Conveyor
C
Editing a branch:
1. Select the connection where
the branch is to be place Jog condition
LEFT
2. click on in the Editor toolbar
T 16
(Branch) SF
S5T#2s TV
SITRAIN ST-PRO1
Training for Industry Page 25 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Bit Instructions All counter functions can also operate with simple bit instructions. The similarities
LG
and differences between this method and the counter functions discussed so far are
PN
as follows:
U
• Similarities:
IV
19
9.
.0
23
• Differences:
ID
Note IEC-compliant counters can also be implemented in STEP 7. The use of system
A
programming course.
so
ur
C
SITRAIN ST-PRO1
Training for Industry Page 26 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Start The stored-on-delay timer starts when the RLO at the "S" input changes from "0" to
LG
"1". The timer runs, starting with the time value specified at input "TV", and
PN
continues to run even if the signal at input "S" changes back to "0" during that time.
U
IV
If the signal at the start input changes from "0" to "1" again while the timer is still
+
19
9.
C
LA
.0
Reset When the RLO at reset input "R" changes from "0" to "1", the current time value and
C
23
Binary Output The signal state at output "Q" changes to "1" when the timer has expired without
IB
error, regardless of whether the signal state at input "S" is still "1".
O
H
PR
O
PR
A
TI
so
ur
C
SITRAIN ST-PRO1
Training for Industry Page 27 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Start The pulse timer starts when the RLO at the "S" input changes from "0" to "1". Output
LG
19
9.
.0
23
W
A
ID
+
IB
2
O
H
PR
O
PR
A
TI
so
ur
C
SITRAIN ST-PRO1
Training for Industry Page 28 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Start The extended pulse timer starts when the RLO at the "S" input changes from "0" to
LG
The signal state at output "Q" remains at "1" even if the signal at the "S" input
U
19
If the signal at the start input changes from "0" to "1" again while the timer is
D
9.
.0
C
23
2
O
H
PR
O
PR
A
TI
so
ur
C
SITRAIN ST-PRO1
Training for Industry Page 29 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Start The off-delay timer starts when the RLO at the "S" input changes from "1" to "0".
LG
When the timer has expired, the signal state at output "Q" changes to "0".
PN
U
If the signal state at the "S" input changes from "0" to "1" while the timer is running,
IV
the timer stops. The next time the signal state at the "S" input changes from "1" to
+
19
9.
C
LA
.0
Reset When the RLO at reset input "R" is "1", the current time value and the time base are
C
23
If both inputs (S and R) have signal states of "1", output "Q" is not set until the
ID
2
O
H
Binary Output Output "Q" is activated when the RLO at the "S" input changes from "0" to "1". If
PR
O
input "S" is deactivated, output "Q" continues to have signal state of "1" until the
PR
SITRAIN ST-PRO1
Training for Industry Page 30 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Time Specification Time values can be fixed and are specified as time constants. The permissible
LG
range in which the time values are found ranges from S5T#10ms to
PN
S5T#2h46m30s0ms.
U
Variable times can be specified using variables (such as memory words or data
IV
19
words) containing the S5TIME data type. The user must make sure that the
D
appropriate time base and the number of units of time, as shown in the slide, are
9.
.0
C
Time Base The time base defines the interval at which the number of units of time is to be
23
decremented by one unit when the timer runs. Bits 12 and 13 of the variable must
W
A
+
IB
Units of Time The number of units of time must be specified as a BCD-coded number. When the
number of units of time are multiplied by the time base, this results in the desired
so
time value. The range from 1 to 999 is possible. When there is a time specification
ur
using a constant (S5T#...), the system automatically uses the smallest possible time
base and the number of units of time.
C
L / BI At output "BI" or with the instruction "L T..." , the residual time value (number of
units of time) of the timer is queried as an integer without time base.
LC / BCD At output "BCD" or with the instruction "LC T..." , the residual time value (number
of units of time) of the timer is queried as a BCD-coded number with the time base
in Bit 12 and 13.
SITRAIN ST-PRO1
Training for Industry Page 31 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Bit Instructions All timer functions can also be started with simple bit instructions. The similarities
LG
and differences between this method and the timer functions discussed so far are
PN
as follows:
U
• Similarities:
IV
19
9.
.0
23
- It is not possible to check the current time value (there are no "BI" and
IB
"BCD" outputs).
O
H
PR
O
PR
A
TI
so
ur
C
SITRAIN ST-PRO1
Training for Industry Page 32 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
Application Basically, arithmetic operations can only process values of the same data type.
LG
Therefore, there are operations with which integer values (I or DI) can be converted
PN
19
I_DI (in STL: ITD) converts a 16-bit integer (I) into a 32-bit double integer (DI)
D
9.
C
DI_R (in STL: DTR) converts a 32-bit double integer (DI) into a floating-point number (R)
LA
.0
C
23
W
Other Conversion
A
SITRAIN ST-PRO1
Training for Industry Page 33 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
WAND_W The "AND Word" operation gates the two digital values at inputs IN1 and IN2 bit by
LG
bit in accordance with the AND truth table. The result of the AND operation is stored
PN
19
9.
.0
C
WOR_W The "OR Word" operation gates the two digital values at inputs IN1 and IN2 bit by
+
bit in accordance with the OR truth table. The result of the OR operation is stored at
IB
WXOR_W The "Exclusive OR Word" operation gates the two digital values at inputs IN1 and
ur
IN2 bit by bit in accordance with the XOR truth table. The result of the OR operation
C
is stored at the address at output OUT. The result of the XOR operation is stored at
the address at output OUT.
The instruction is executed when EN=1.
Example: detecting signal changes in IW0 :
IW0 = 0100 0100 1100 1010
MW28 = 0110 0010 1011 1001
MW24 = 0010 0110 0111 0011
SITRAIN ST-PRO1
Training for Industry Page 34 Digital Operations
O
a
ID
ay
N
el
TE
C
N
e
O
in
C
el
riv
X
EL
M
D
D
N
KN
N
AI
IÓ
G
TR
AC
@
SI
General The program example displayed in the slide implements a logic for detecting a
LG
signal change of 16 binary digits (edge detection for 16 bit) using digital word
PN
instructions.
U
IV
19
Network 1 For the detection of a positive edge detection, that is, the detection of a signal
change from 0 1, it suffices to carry out a digital AND operation of the change
D
9.
pattern (MW 220) with the new signal states (IW 0).
C
LA
.0
C
23
Network 2 If only the 1 changes are to be detected, a digital AND operation of the change
W
A
+
IB
Network 3 Save the old states so that the signal state change can be detected.
2
O
H
PR
O
PR
A
TI
so
ur
C
SITRAIN ST-PRO1
Training for Industry Page 35 Digital Operations