Beruflich Dokumente
Kultur Dokumente
INTRODUCTION TO PLC
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
1/1
SIMATIC S7
SIEMENS LTD EGYPT
2/1
SIEMENS
Objectives
- Know PLC History & Advantage.
- Know What Is PLC? & Why It Is Used?
SIMATIC S7
SIEMENS LTD EGYPT
3/1
SIEMENS
PLC HISTORY
Programmable Logic Controller (PLC),
The advent of the PLC began in the 1970s,
and has become the most common choice
for manufacturing controls.
PLC Advantage
Cost effective for controlling complex
systems.
Flexible and can be reapplied to control
other systems quickly and easily.
Computational abilities allow more
complicated control.
Trouble shooting aids make programming
easier and reduce downtime.
Reliable components make these likely to
operate for years before failure.
SIMATIC S7
SIEMENS LTD EGYPT
4/1
SIEMENS
SIMATIC PRODUCT
OVERVIEW
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
5/1
SIEMENS
Objectives
- Overview On Simatic S7 Product.
- Familiar With S7-200, S7-300 & S7-400.
- Different Between Siemens Programming Device.
SIMATIC S7
SIEMENS LTD EGYPT
6/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
7/1
SIEMENS
SIMATIC OVERVIEW
Operating Panel
PG
PC Panel
MPI
Ethernet
ProfiBus
S7-200
S7-300
S7-400
SIMATIC NET
ProfiBus
DP
Bus System
DP Slaves
SIMATIC S7
SIEMENS LTD EGYPT
DP/PA
8/1
SIEMENS
Bus System
SIMATIC S7
SIEMENS LTD EGYPT
9/1
SIEMENS
SIMATIC S7-200
The micro PLC that offers maximum automation at
minimum cost.
Extremely simple installation, programming and
operation.
Large-scale integration, space-saving, powerful.
Can be used both for simple and complex
automation tasks.
CPUs
DI/DO
AI/AO
SIMATIC S7
SIEMENS LTD EGYPT
10/1
EM 231 thermocouple
module
SIEMENS
SIMATIC S7-300
CPU 313C-2 DP
The compact CPU with integrated digital I/Os
and PROFIBUS DP master/slave interface.
CPU 315-2 DP
The CPU with medium to large program
memory, High processing performance in
binary and floating-point arithmetic,
PROFIBUS DP master/slave interface.
CPU 319-3 PN/DP
The CPU with high command processing
performance, large program memory and
quantity framework for demanding
applications, Used as central controller in
production lines with central and distributed
I/O on PROFIBUS and PROFINET.
CPU 317T-2 DP
The CPU with integrated technology/motion
control functionality, For multi-sector
automation tasks in the construction of
series machines, special machines and
plants.
SIMATIC S7
SIEMENS LTD EGYPT
11/1
CPU 317T-2 DP
CPU 313C-2 DP
CPU 315-2 DP
SIEMENS
SIMATIC S7-300
CPU S7-300
Signal Modules:
Digital input modules
Digital output module
Analog input modules
Analog output modules
Interface Modules:
CPU
IM
DI
DO
AI
AO
FM
CP
SIMATIC S7
SIEMENS LTD EGYPT
12/1
SIEMENS
Signal Modules:
Digital input modules
Digital output module
CPU
DI
DO
AI
AO
Memory Card
A slot is provided for a memory card. The memory
card saves the program contents in the event of a
power outage without the need for battery.
RAM cards are available with a capacity of:
64KByte, 256KByte, 1MByte, 2MByte.
Flash EPROM cards are available with a capacity of:
64KByte, 256KByte, 1MByte, 2MByte, 4MByte,
8MByte, 16MByte.
SIMATIC S7
SIEMENS LTD EGYPT
13/1
SIEMENS
Status Indicators.
SF = Internal CPU fault or fault in module.
BATF = Battery fault; battery empty or non-existent.
DC5V = Internal 5 VDC voltage indicator.
FRCE = FORCE; indicates that at least one input
or output is forced.
RUN = Flashes when the CPU is starting up, then
a steady light in Run mode.
STOP = Shows a steady light in Stop mode.
Flashes slowly for a memory reset request,
Flashes quickly when a memory reset is being
carried out, Flashes slowly when a memory reset is
necessary because a memory card has been
inserted.
SIMATIC S7
SIEMENS LTD EGYPT
14/1
SIEMENS
SIMATIC S7-400
CPU 416-2
High-performance CPUs in the high-end
performance range
Applicable for plants with high
requirements in
the high-end performance range
CPU 414-4H
Fault-tolerant automation system with
redundant configuration
For applications with high failure safety
requirements
Processes with high restart costs, expensive
downtimes, little supervision, and few
maintenance options
Hot standby: Automatic reaction-free
switching to the standby unit in the event of a
fault
CPU 414-4H
CPU 416-2
CPU 414-4FH
Failsafe automation system for plant with
high safety requirements
If required, also fault tolerant through
redundant configuration
CPU 414-4FH
SIMATIC S7
SIEMENS LTD EGYPT
15/1
SIEMENS
SIMATIC S7-400
The power PLC for the mid to upper
performance range
Performance-graded range of CPUs
Extensive selection of modules
Expandable design to over 300
modules
Backplane bus integrated in the
modules
Can be networked with
- (MPI)
- PROFIBUS
- Industrial Ethernet
S7-400 Rack
PS
CPU
DI
DO FM CP
IM
SIMATIC S7
SIEMENS LTD EGYPT
16/1
SIEMENS
SIMATIC S7-400
Fault LEDs
LEDs for the CPUs statuses and faults, both internal and
external
Memory Cards
Mode Selector
MRES = Memory reset function (Module RESet)
STOP = STOP mode
RUN = Program execution, read-only access possible from PG.
RUN-P= Program execution, read/write access possible from
PG.
MPI / DP Interface
DP Interface
For connecting to distributed peripherals
EXT-BATT
SIMATIC S7
SIEMENS LTD EGYPT
17/1
SIEMENS
SIMATIC Programming
Device
Field PG
Intel Pentium M processor.
Power PG
SIMATIC S7
SIEMENS LTD EGYPT
18/1
SIEMENS
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
19/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
20/1
SIEMENS
Rack
CPU
DI
DO
AI
AO
PS
SIMATIC S7
SIEMENS LTD EGYPT
21/1
SIEMENS
SIMATIC MANAGER
SOFTWARE
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
22/1
SIEMENS
Objectives
- Understand Simatic Manger.
- Understand Project Instruction.
- Be Familiar With Step7 Software.
- How To Cerate New Projects.
SIMATIC S7
SIEMENS LTD EGYPT
23/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
24/1
SIEMENS
Step 7 List
SIMATIC S7
SIEMENS LTD EGYPT
25/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
26/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
27/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
28/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
29/1
SIEMENS
Menu Bar
Tool Bar
Status Bar
SIMATIC S7
SIEMENS LTD EGYPT
30/1
SIEMENS
Menu Bar
SIMATIC S7
SIEMENS LTD EGYPT
31/1
SIEMENS
Menu Bar
SIMATIC S7
SIEMENS LTD EGYPT
32/1
SIEMENS
Menu Bar
SIMATIC S7
SIEMENS LTD EGYPT
33/1
SIEMENS
Menu Bar
SIMATIC S7
SIEMENS LTD EGYPT
34/1
SIEMENS
Tool Bar
SIMATIC S7
SIEMENS LTD EGYPT
35/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
36/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
37/1
SIEMENS
Create S7 Program
SIMATIC S7
SIEMENS LTD EGYPT
38/1
SIEMENS
Insert S7 Station
SIMATIC S7
SIEMENS LTD EGYPT
39/1
SIEMENS
HARDWARE
CONFIGURATION
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
40/1
SIEMENS
Objectives
- Know How Insert Hardware Configuration (CPU, DI-DO, AI-AO )
- How To Change The Signal Module Address.
- Know The CPU Properties.
- Know How to Save, Compile, Upload, Download Logic Software.
SIMATIC S7
SIEMENS LTD EGYPT
41/1
SIEMENS
The Catalog
SIMATIC S7
SIEMENS LTD EGYPT
42/1
SIEMENS
Insert Rack
Area-1
Area-2
SIMATIC S7
SIEMENS LTD EGYPT
43/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
44/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
45/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
46/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
47/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
48/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
49/1
SIEMENS
CPU Properties
SIMATIC S7
SIEMENS LTD EGYPT
50/1
SIEMENS
Clock Memory
Frequency
Period
SIMATIC S7
SIEMENS LTD EGYPT
51/1
1.6
2.5
10
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
52/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
53/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
54/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
55/1
SIEMENS
Click OK
SIMATIC S7
SIEMENS LTD EGYPT
56/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
57/1
SIEMENS
Exercise
Exercise-1:
Creat new project, configure the HW Config. From the first step to the last
one.
Exercise-2:
Upload Actual Configuration to the PG/PC.
Exercise-3:
Complete the missing order number.
Exercise-4:
Monitor & Modify DI,DO,AI & AO from the HW Config. window.
Exercise-5:
Assign Parameter to CPU clock memeory & test.
SIMATIC S7
SIEMENS LTD EGYPT
58/1
SIEMENS
Slot 1
AI
AO
Slot 2
Slot for the CPU.
Slot 3
Logically reserved for an interface
module (IM)
Modules
Slots 4-11
Slot 4 is the first slot that can be used
for I/O modules, communications
processors (CP) or function modules
(FM).
SIMATIC S7
SIEMENS LTD EGYPT
59/1
CPU
DI
DO
Address 0.0
Address 0.7
Address 1.0
Addresss1.7
SIEMENS
Rack
3
(361
Receive)
PS
Rack
2
IM
(361Send
Receive)
PS
Rack
1
PS
Rack
0
Slot
IM
CPU
100.0
to
103.7
104.0
to
107.7
108.0
to
111.7
112.0
to
115.7
116.0
to
119.7
120.0
to
123.7
124.0
to
127.7
64.0
to
67.7
68.0
to
70.7
72.0
to
75.7
76.0
to
79.7
80.0
to
83.7
84.0
to
87.7
88.0
to
91.7
92.0
to
95.7
56.0
to
59.7
60.0
to
63.7
32.0
(361Send to
Receive) 35.7
IM
IM
(360
Send)
96.0
to
99.7
SIMATIC S7
SIEMENS LTD EGYPT
0.0
to
3.7
36.0
to
39.7
40.0
to
43.7
44.0
to
47.7
48.0
to
51.7
52.0
to
55.7
4.0
to
7.7
8.0
to
11.7
12.0
to
15.7
16.0
to
19.7
20.0
to
23.7
60/1
24.0
to
27.7
9
10
28.0
to
31.7
11
SIEMENS
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
61/1
SIEMENS
Objectives
- What Is The Difference Between S7 Blocks
- Understand The Process Image & Cyclic Execution.
- How To Insert, Edit S7 Blocks.
- Know Different S7 Programming Language & How To Select Them.
- Know How To Download, Save, Monitor S7 Blocks.
- Know How To Call The FB & FC Blocks In OB1.
SIMATIC S7
SIEMENS LTD EGYPT
62/1
SIEMENS
BLOCKS
Organization Block (OB)
Organization blocks is the interface
between the operating system and the
user program. The entire program can be
stored in OB1 that is cyclically called by
the operating system or the program can
be divided and stored in several blocks.
OB 1
FB
FB
FB
FB
Function (FC)
A function contains a partial functionality
of the program. It is possible to program
functions so that they can be assigned
parameters.
FB
FC
Function Block FB
Function blocks offer the same
possibilites as functions. In addition,
function blocks have their own memory
area in the form of instance data blocks.
SIMATIC S7
SIEMENS LTD EGYPT
63/1
OB
FB
FC
SFB
SFC
DB
= Organization Block
= Function Block
= Function
= System Function Block
= System Function
= Data Block
SIEMENS
Process Image
PII
The Process-Image Input table is found in
the CPUs memory area. The signal state
of all inputs is stored there.
PIQ
The Process-Image Output table contains
the output values that result from the
program execution. These output values
are sent to the actual outputs at the end of
the cycle.
PII
DI Module
A I 0.0
= Q 1.0
DO Module
SIMATIC S7
SIEMENS LTD EGYPT
1
USER
PROGRAM
PIQ
64/1
SIEMENS
Inserting S7-Block
Function Name
SIMATIC S7
SIEMENS LTD EGYPT
65/1
Choose the
programming
language
SIEMENS
Declaration Table
Catalog
Programming Area
Info Area
SIMATIC S7
SIEMENS LTD EGYPT
66/1
SIEMENS
Programming Languages
-Ladder Diagram (LAD)
-Statement List (STL)
-Function Block (FBD)
FBD
LAD
-S7-GRAPH
I 0.0
I 0.1
Q8.0
I 0.0
STL
&
Q8.0
I 0.1
A I
0.0
A I
0.1
= Q 8.0
CFC
SIMATIC S7
SIEMENS LTD EGYPT
SFC
67/1
SCL
S7-GRAPH
SIEMENS
Programming In LAD
SIMATIC S7
SIEMENS LTD EGYPT
68/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
69/1
SIEMENS
Programming In STL
SIMATIC S7
SIEMENS LTD EGYPT
70/1
SIEMENS
Monitor the
Blocks
Save the
Blocks
SIMATIC S7
SIEMENS LTD EGYPT
Download the
Blocks to the PLC
71/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
72/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
73/1
SIEMENS
SYMBOL TABLE
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
74/1
SIEMENS
Objectives
- Know How To Create, Edit The Symbol Table.
- Be Familiar With The Symbol Table Functions (Sort, Filter , Import, Export)
SIMATIC S7
SIEMENS LTD EGYPT
75/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
76/1
SIEMENS
Symbol Table
SIMATIC S7
SIEMENS LTD EGYPT
77/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
78/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
79/1
SIEMENS
Sort Addresses
SIMATIC S7
SIEMENS LTD EGYPT
80/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
81/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
82/1
SIEMENS
Exercise:
1- Create in the symbol table a symbolic file with the given data.
2- Export the file.
3- Clean the symbolic table & Import the Exported file in it.
The Given Data:
SIMATIC S7
SIEMENS LTD EGYPT
83/1
SIEMENS
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
84/1
SIEMENS
Objectives
- Review On The Logic Gates & How It Is represented In LAD, STL, FBD
- Know The Set-Reset Functions.
- Know The Pulse Edge & Mid-Line Coil.
- Know The Jump Condition.
SIMATIC S7
SIEMENS LTD EGYPT
85/1
SIEMENS
OR Gate
AND Gate
S1 (I 0.0)
S3
(I 0.2)
Circuit
Diagram
S4
(I 0.3)
S2 (I 0.1)
L1
(Q 8.0)
L3 (Q 8.2)
I 0.2
Q 8.0
Q 8.1
>=1
I 0.3
O
O
=
I 0.1
LAD Diagram
I 0.3
I 0.2
I 0.0
Q 8.2
L2
(Q 8.1)
I 0.0
Q 8.2
=
FBD Diagram
I 0.1
Q 8.0
=
Q 8.1
=
I 0.2
I 0.3
Q 8.2
SIMATIC S7
SIEMENS LTD EGYPT
&
STL
86/1
A
A
=
=
I 0.0
I 0.1
Q 8.0
Q 8.1
SIEMENS
XNOR Gate
XOR Gate
S1 (I 0.6)
S1 (I 0.6)
S2 (I 0.7)
S2 (I 0.7)
Circuit
Diagram
S1 (I 0.4)
S2 (I 0.5)
S2 (I 0.5)
S1 (I 0.4)
L1 (Q 8.0)
I 0.6
I 0.7
Q 8.0
LAD Diagram
I 0.7
I 0.6
I 0.6
I 0.7
&
I 0.6
I 0.7
&
AN
AN
O
A
A
=
L1 (Q 8.0)
>=1
Q 8.0
=
FBD Diagram
I 1.0
I 1.1
STL
I 0.5
I 0.4
I 0.5
I 0.4
I 0.5
&
I 0.4
I 0.5
&
X
X
=
I 0.6
I 0.7
Q8.0
SIMATIC S7
SIEMENS LTD EGYPT
I 0.4
87/1
Q 8.0
>=1
Q 8.0
=
I 0.4
I 0.5
Q8.0
SIEMENS
Set
Reset
I 0.0
I 0.1
I 0.2
Q 0.0
(S)
I 0.0
&
I 0.3
FBD Diagram
I 0.1
(R )
LAD Diagram
I 0.2
Q 0.1
A I 0.0
A I 0.1
S Q 0.2
SIMATIC S7
SIEMENS LTD EGYPT
Q 0.0
STL
88/1
>=1
Q 0.1
R
I 0.3
O I 0.2
O I 0.3
R Q 0.2
SIEMENS
Setting/Reseting FlipFlop
Setting/Reseting FlipFlop
Dominant Set
Dominant Reset
M1.0
I 0.4
R
RS
Q 0.2
LAD Diagram
I 0.5
M1.1
I 0.4
S
R
M1.0
R
M1.1
RS
Q0.2
I 0.5
Q 0.3
I 0.5
I 0.4
SR
A
R
A
S
A
=
I 0.4
M 1.0
I 0.5
M 1.0
M 1.0
Q 0.2
I 0.4
FBD Diagram
SIMATIC S7
SIEMENS LTD EGYPT
89/1
SR
Q0.3
I 0.5
STL
S
R
A
S
A
R
A
=
I 0.4
M 1.1
I 0.5
M 1.1
M 1.1
Q 0.3
2 OR
An output is energized when
switch A or B, both normally
open, is closed.
Inputs
A
O
O
1
1
Output
B
0
1
0
1
0
1
1
1
90/1
Simple Example
Ex02Sw
PUSHBUTTON SWITCH
SIMATIC S7
SIEMENS LTD EGYPT
91/1
3 NOT
There is an output when there
is no input and no output when
there is an input. The gate is
sometimes referred to an
inverter.
Input
A
0
1
Output
1
0
92/1
Simple Example
Ex03Sw
SIMATIC S7
SIEMENS LTD EGYPT
RUN-STOP MOTOR
93/1
SIMATIC S7
SIEMENS LTD EGYPT
94/1
Ex04Motoroperation
Forward operation,
Set an interlock with
reverse operatin
(P41, P02)
Reverse operation,
Set an interlock with
forward operatin
(P44, P01)
SIMATIC S7
SIEMENS LTD EGYPT
95/1
Ex06MotorOn-OffwithLamps
Motor output
SIMATIC S7
SIEMENS LTD EGYPT
96/1
SIEMENS
SET
CLR
NOT
The SET
instruction sets
the RLO to "1"
without preconditions
The CLEAR
instruction sets the
RLO to "0" without
pre-conditions
NOt
EXIST
LAD
NOt
EXIST
LAD
I 0.0
NOT
I 0.0
NOt
EXIST
SET
= M 0.4
FBD
STL
SIMATIC S7
SIEMENS LTD EGYPT
NOt
EXIST
CLR
= M 0.5
98/1
FBD
STL
Q0.0
I 0.1
&
I 0.1
( )
Q0.0
=
A I 0.0
A I 0.1
NOT
= Q0.0
SIEMENS
I 1.0 I 1.1
M1.0
M0.2
I 0.0 I 0.1
LAD
Diagram
I 1.0
&
I 1.1
A
A
FN
=
M1.1
M0.2
I 1.0
I 1.1
M1.1
M0.2
SIMATIC S7
SIEMENS LTD EGYPT
STL
99/1
M0.1
I 1.0
FBD
Diagram
M0.0
&
I 1.1
A
A
FP
=
M1.0
M0.1
I 1.0
I 1.1
M1.0
M0.1
SIEMENS
Positive Edge
(Positive Edge Detection) detects a
signal change in the address (M0.1)
from "0" to "1", and displays it as
RLO = "1" after the instruction.
Examples 1:
OB1-Cycle
I 0.0
I 0.1
RLO
Negative Edge
M1.0
M1.1
M8.0
M8.1
Examples 2:
I 0.0
I 0.1
M1.0
M1.1
M8.0
OB1-Cycle
M8.1
SIMATIC S7
SIEMENS LTD EGYPT
100/1
SIEMENS
Network 1
Unconditional Jump
In LAD/FBD, the label (M001) is
entered as an identifier
above the coil symbol or
assignment symbol.
In STL it comes after the Jump
(JU) instruction.
An unconditional jump
instruction causes a program
jump to a label regardless of the
RLO.
M001
( JMP )
LAD
Diagram
Network 2
:
:
Network n
M001
M50.0
I 44.1
M99.7
( )
Jump Label
The label may be as many
as four characters of which
the first character must be
a letter.
Example: M001: A I 0.0
SIMATIC S7
SIEMENS LTD EGYPT
Network 1
JU M001
STL
101/1
Network 2
:
:
:
:
Network n
M001: AN M50.0
AN I 44.1
=
M99.7
SIEMENS
Network 1
Conditional Jump
The "JC" conditional jump is
only executed if the RLO is
"1".
The "JCN" conditional jump
is only executed if the RLO is
"0".
I 0.0
LAD
Diagram
I 0.1
M002
(JMP)
Network 2
:
:
Network n
M002
Note:
STL provides additional jump
operations
M50.0
STL
I 44.1
102/1
( )
Network 1
A I 0.0
A I 0.1
JC M002
Network 2
:
:
:
:
Network n
M002:
SIMATIC S7
SIEMENS LTD EGYPT
M99.7
AN M50.0
AN I 44.1
=
M99.7
SIEMENS
Exercise:
1- In FC3, Write PLC program to
control the following process:
LS1
SIMATIC S7
SIEMENS LTD EGYPT
103/1
In Flow
LS2
P1
P2
Out Flow
SIEMENS
Answer of Exercise 1:
Answer of Exercise 3:
SIMATIC S7
SIEMENS LTD EGYPT
104/1
SIEMENS
Answer of Exercise 2:
SIMATIC S7
SIEMENS LTD EGYPT
105/1
SIEMENS
TIMER
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
106/1
SIEMENS
Example:
L +5
// 16-bit constant
T MB0
L L#523123 // 32-bit constant
T MD4
L B#16#EF // byte in hexadecimal form
T MW8
L 2#0010 0110 1110 0011 //16-bit binary
T MW10
L 3.14
// 32-bit constant
T MD12
LAD Diagram
20
ENO
IN
OUT
MW10
OUT
MB10
MOVE
EN
FBD Diagram
20
STL
SIMATIC S7
SIEMENS LTD EGYPT
EN
107/1
IN
ENO
20
MB10
SIEMENS
Timers
- ON Delay Timer (SD)
- Stored ON Delay Timer (SS)
- Pulse Timer (SP)
T(No.)
S_(Type)
Q
S
I 0.0
LAD Diagram
S5T#5s
I 0.1
MW0
BCD
T(No.)
S_(Type)
I 0.0
FBD Diagram
S5T#5s
I 0.1
STL
SIMATIC S7
SIEMENS LTD EGYPT
BI
TV
Q0.0
108/1
S
TV
BI
BCD
MW0
Q0.0
=
A
I 0.0
L
S5T#5s
S(Type) T(No.)
A
I 0.1
R
T(No.)
L
T(No.)
T
MW0
A
T(No.)
=
Q0.0
SIEMENS
T0
S_ODT
I 0.0
Start
The timer starts when the Start input LAD Diagram
"S" changes from "0" to "1". The
timer starts with the time value
specified at the Time Value "TV" for
as long as the signal state at input
"S" =1.
Reset
FBD Diagram
STL
Digital Outputs
TV
BI
Q0.0
MW0
BCD
T0
S_ODT
I 0.0
S5T#5s
I 0.1
Output
S5T#5s
I 0.1
A
L
SD
A
R
L
T
A
=
S
TV
R
BI
BCD
MW0
Q0.0
=
I 0.0
S5T#5s
T
I 0.1
T0
T0
MW0
T0
Q0.0
SIMATIC S7
SIEMENS LTD EGYPT
109/1
SIEMENS
I 0.0
LAD Diagram
BI
TV
R
MW0
BCD
S_ODTS
S
I 0.0
FBD Diagram
S5T#5s
I 0.1
Output
STL
SIMATIC S7
SIEMENS LTD EGYPT
S5T#5s
I 0.1
Q0.1
T1
Reset
When the reset input "R" changes
from "0" to "1", the current time
value and the time base are
deleted and output "Q" is reset.
T1
S_ODTS
Q
S
110/1
A
L
SS
A
R
L
T
A
=
BI
TV
BCD
MW0
Q0.1
=
I 0.0
S5T#5s
T1
I 0.1
T1
T1
MW0
T1
Q0.1
SIEMENS
T2
S_PULSE
Q
S
I 0.0
LAD Diagram
S5T#5s
I 0.1
BI
TV
R
Q0.2
MW0
BCD
T2
S_PLUSE
Reset
Output "Q" is reset when the
timer has expired, or the
start "S" signal changes
from "1" to "0", or the reset
input "R" has a signal state
of "1".
FBD Diagram
S5T#5s
I 0.1
STL
SIMATIC S7
SIEMENS LTD EGYPT
I 0.0
111/1
A
L
SP
A
R
L
T
A
=
BI
TV
BCD
MW0
Q0.2
=
I 0.0
S5T#5s
T2
I 0.1
T2
T2
MW0
T2
Q0.3
SIEMENS
Start
The extended pulse timer starts
when the "S" input changes from
"0" to "1". Output "Q" is also set to
"1".
LAD Diagram
BI
TV
R
MW0
BCD
S_PEXT
S
I 0.0
FBD Diagram
S5T#5s
I 0.1
Reset
STL
SIMATIC S7
SIEMENS LTD EGYPT
S5T#5s
I 0.1
Q0.3
T3
T3
S_PEXT
Q
S
112/1
A
L
SS
A
R
L
T
A
=
BI
TV
BCD
MW0
Q0.3
=
I 0.0
S5T#5s
T3
I 0.1
T3
T3
MW0
T3
Q0.3
SIEMENS
I 0.0
LAD Diagram
S5T#5s
I 0.1
BI
TV
R
Q0.4
MW0
BCD
T4
S_OFFDT
S
I 0.0
FBD Diagram
Output
Output "Q" is activated when the "S"
input changes from "0" to "1". If input
"S" is deactivated, output "Q"
continues to have signal state of "1"
until the programmed time has expired.
SIMATIC S7
SIEMENS LTD EGYPT
T4
S_OFFDT
Q
S
113/1
S5T#5s
I 0.1
STL
A
L
SS
A
R
L
T
A
=
BI
TV
BCD
MW0
Q0.4
=
I 0.0
S5T#5s
T4
I 0.1
T4
T4
MW0
T4
Q0.4
SIEMENS
Timer
Timer
R
Timer
Timer
SIMATIC S7
SIEMENS LTD EGYPT
114/1
SIMATIC S7
SIEMENS LTD EGYPT
115/1
SIEMENS
COUNTER
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
116/1
SIEMENS
Counter
I 0.0
Count Up
I 0.1
Count Down
LAD Diagram
Set Counter
I 0.2
C#50
I 0.3
Preset Value
C0
S_CUD
CU
CD
CV
S
PV
R
C0
S_CUD
FBD Diagram
Output
STL
SIMATIC S7
SIEMENS LTD EGYPT
MW 0
CV_BCD
Reset Counter
CV/CV_BCD
Q 0.0
117/1
I 0.0
CU
I 0.1
CD
I 0.2
C#50
PV
I 0.3
CV
MW 0
CV_BCD
Q
Q
A
CU
A
CD
A
L
S
A
R
L
T
A
=
Q 0.0
=
I0.0
C0
I0.1
C0
I0.2
C#50
C0
I0.3
C0
C0
MW4
C0
Q0.0
SIEMENS
Comparison Operations
You can use comparison instructions
LAD Diagram
to compare numerical values:
I
D
R
CMP ==I
I0.0
IN1
IN2
MW0
Compare integers
Compare integers
Compare floating-point numbers
Q 0.0
MW2
CMP ==I
STL
SIMATIC S7
SIEMENS LTD EGYPT
118/1
MW0
IN1
MW2
IN2
&
I0.0
A
A(
L
L
==I
)
=
Q0.0
=
I0.0
MW0
MW2
Q0.0
SIEMENS
Exercise:
SIMATIC S7
SIEMENS LTD EGYPT
119/1
SIEMENS
Exercise:
1- Write a PLC program to control the counting between zero & 9,
9
count up
count down
SIMATIC S7
SIEMENS LTD EGYPT
0 9
9 0
120/1
SIEMENS
Answer of Exercise 1:
SIMATIC S7
SIEMENS LTD EGYPT
121/1
SIEMENS
MATH OPERATION
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
122/1
SIEMENS
Objectives
- Understand The Math Operation & How To Use It In Different Language.
SIMATIC S7
SIEMENS LTD EGYPT
123/1
SIEMENS
Mathematical Operation
EN
IN1, IN2
The value at IN1 is read in as the first address and the value at IN2 as the second.
OUT
The result of the mathematical operation is stored at the address at output OUT.
LAD Diagram
MW0
MW2
ADD_I
EN ENO
IN1 OUT
IN2
MW4
FBD Diagram
MW0
MW2
SUB_I
EN
MW6
MW8
MD12
MD14
MD22
MD26
IN1
IN2
ENO
OUT
MW10
MW6
MW8
MUL_D
EN ENO
IN1
IN2
OUT
DIV_R
EN ENO
IN1 OUT
IN2
ADD_I
EN OUT
IN1
IN2 ENO
SUB_I
EN OUT
IN1
IN2 ENO
MUL_D
EN OUT
MD18
MD12
MD14
MD30
SIMATIC S7
SIEMENS LTD EGYPT
MD22
MD26
124/1
STL
MW4
MW10
MD18
IN1
IN2 ENO
DIV_R
EN OUT
IN1
IN2 ENO
MD30
L
L
+I
T
MW0
MW2
L
L
-I
T
MW6
MW8
L
L
*D
T
MD12
MD14
L
L
/R
T
MD22
MD26
MW4
MW10
MD18
MD32
SIEMENS
DECLARATION TABLE
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
125/1
SIEMENS
Objectives
- Know How Temp. Variables Can Be Accessed & Where It Stored.
- Understand The Declaration Table & How To Use It.
SIMATIC S7
SIEMENS LTD EGYPT
126/1
SIEMENS
Types of variables
The inputs and outputs in our programs
were coded directly with their actual
address assignments.
There is two types of variables:
Global Variables
I/ O
PII / PIQ
M/T/C
DB areas
Local Variables
Temporary variables:
Variables that are stored only while the
block is being executed. They can be
declared in all blocks (OB, FC, FB).
Static variables:
Variables to be retained even after the
block is executed, can only be declared in
function blocks. The instance DB
assigned to the FB is used as the storage
location for these static variables.
SIMATIC S7
SIEMENS LTD EGYPT
127/1
SIEMENS
Temporary variables:
Temporary variables can be
used in all blocks (OB, FC,
FB). They are used to
temporarily store information
while the block is being
executed. The data are lost
when the block is exited.
The data are stored in the L
stack (local data stack). The L
stack is a separate memory
area in the CPU.
IN Parameter
OUT Parameter
Declaration Table
Before a temporary variable
can be used in a block, it must
be declared in the blocks
declaration table.
Type of Parameter:
The in declaration type
should be assigned only to
declaration types that will be
read.
The out declaration type for
paramaters that will be written
to within the function.
SIMATIC S7
SIEMENS LTD EGYPT
128/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
129/1
SIEMENS
Calling FC3
SIMATIC S7
SIEMENS LTD EGYPT
130/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
131/1
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
132/1
SIEMENS
Exercise:
1- In FC5, Write a PLC program, using declaration table to calculate the following equation:
K = 4X + 5XYZ + 2Y/3Z + 2(X+Z)
Then find the value of K at: X=1, Y=2 and Z=1
SIMATIC S7
SIEMENS LTD EGYPT
133/1
SIEMENS
Answer of Exercise 1:
IN The Declaration Table:
IN: X,Y,Z
OUT: K
Temp: ????
The value of K at: X=1, Y=2 and Z=1
K=19
SIMATIC S7
SIEMENS LTD EGYPT
134/1
SIEMENS
DATA BLOCK
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
135/1
SIEMENS
Objectives
- Know The Elementary & Complex DB.
- How To Create DB.
- Familiar With Addressing & Accessing Data Element.
SIMATIC S7
SIEMENS LTD EGYPT
136/1
SIEMENS
Function
FC10
OB1
Global data
DB20
Function
FC20
Instance DB for FB1
SIMATIC S7
SIEMENS LTD EGYPT
137/1
Function
block
FB1
Instance data
DB5
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT
138/1
SIEMENS
Declaration
View
Data View
SIMATIC S7
SIEMENS LTD EGYPT
139/1
SIEMENS
8 Bits
Data Byte 0
Data Byte 1
0
DBB 0
DBW 0
Data Byte 2
Data Byte 3
DBD 0
DBX 4.1
DBD 8188
DBW 8190
Data Byte 8191
DBB 8191
OR
OR
DB9.DBX0.0
DB9.DBB1
DB9.DBW2
OR
OPN "Values"
T DBW 2
SIMATIC S7
SIEMENS LTD EGYPT
140/1
SIEMENS
Exercise:
1- In FC6, Write a PLC program, using DB6 to calculate the following equation:
K = 4X + 18XZ + 2Z/2 + 2(2Y+3)
Then find the value of K at: X=2, Y=1 and Z=2
SIMATIC S7
SIEMENS LTD EGYPT
141/1
SIEMENS
Answer of Exercise 1:
IN The DB:
SIMATIC S7
SIEMENS LTD EGYPT
142/1