Sie sind auf Seite 1von 141

SIEMENS

INTRODUCTION TO PLC

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

1/1

October 14, 2016

SIMATIC S7
SIEMENS LTD EGYPT

2/1

October 14, 2016

SIEMENS

Objectives
- Know PLC History & Advantage.
- Know What Is PLC? & Why It Is Used?

SIMATIC S7
SIEMENS LTD EGYPT

3/1

October 14, 2016

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

October 14, 2016

SIEMENS

SIMATIC PRODUCT
OVERVIEW

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

5/1

October 14, 2016

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

October 14, 2016

SIEMENS

SIMATIC PRODUCT OVERVIEW

SIMATIC S7
SIEMENS LTD EGYPT

7/1

October 14, 2016

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

October 14, 2016

SIEMENS

Bus System

SIMATIC S7
SIEMENS LTD EGYPT

9/1

October 14, 2016

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

Suitable for applications where programmable


controllers would not have been economically viable
in the past.
With powerful communication options (PPI,
PROFIBUS DP, AS-Interface)
Digital inputs/outputs to supplement the onboard
I/Os of the CPUs
EM 277: For connecting S7-22x to PROFIBUS DP
and MPI
EM 253: Function modules for simple positioning
tasks (1 axis)
EM 231: For user-friendly, high precision
temperature detection

DI/DO

AI/AO

EM 277 PROFIBUS DP EM 253 positioning


module
module

SIMATIC S7
SIEMENS LTD EGYPT

10/1

EM 231 thermocouple
module

October 14, 2016

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 319-3 PN/DP

CPU 317T-2 DP

CPU 313C-2 DP

CPU 315-2 DP

October 14, 2016

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

The IM360/IM361 and IM365


make multi-tier configurations possible.

Function Module (FM)


- Counting
- Positioning
- Closed-loop control.

Communication Processors (CP)


- Point-to-Point connections
- PROFIBUS
- Industrial Ethernet.

SIMATIC S7
SIEMENS LTD EGYPT

12/1

October 14, 2016

SIEMENS

Training Unit Hardware


CPU 313C-2 DP:
The compact CPU with integrated digital I/Os
PROFIBUS DP master/slave interface
With process-related functions
For tasks with special functions
For the connection of standalone I/O devices
Note: Micro memory card required to operate the
CPU.

Signal Modules:
Digital input modules
Digital output module

CPU

Analog input modules

DI

DO

AI

AO

Analog output modules

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

October 14, 2016

SIEMENS

Training Unit Hardware


Mode Selector:
MRES =Memory reset function (Module Reset)
STOP = Stop mode, the program is not executed.
RUN = Program execution

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

October 14, 2016

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

October 14, 2016

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

UR1 (Universal Rack) with up to 18 modules


UR2 (Universal Rack) with up to 9 modules
UR2-H (Universal Rack For H-SYS)
ER1 (Expansion Rack) with up to 18 modules
ER2 (Expansion Rack) with up to 9 modules

Rack UR2-H (18 Slot)

SIMATIC S7
SIEMENS LTD EGYPT

16/1

Rack UR2 (9 Slot)

October 14, 2016

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

October 14, 2016

SIEMENS

SIMATIC Programming
Device
Field PG
Intel Pentium M processor.

Power PG

SIMATIC S7
SIEMENS LTD EGYPT

18/1

October 14, 2016

SIEMENS

TRAINING DEMO UNIT

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

19/1

October 14, 2016

SIEMENS

Training Demo Unit

SIMATIC S7
SIEMENS LTD EGYPT

20/1

October 14, 2016

SIEMENS

Configuration Of The S7 Training Unit

Rack

CPU

DI

DO

AI

AO

PS

The programmable controller is configured with the following modules:


Slot 2: CPU 313C-2 DP
Slot 4: Analog Input module
Adjustable from the simulator
Slot 5: Analog Output module

SIMATIC S7
SIEMENS LTD EGYPT

21/1

October 14, 2016

SIEMENS

SIMATIC MANAGER
SOFTWARE

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

22/1

October 14, 2016

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

October 14, 2016

SIEMENS

Install the software then you will find

SIMATIC S7
SIEMENS LTD EGYPT

24/1

October 14, 2016

SIEMENS

Step 7 List

SIMATIC S7
SIEMENS LTD EGYPT

25/1

October 14, 2016

SIEMENS

Start Simatic Manager

SIMATIC S7
SIEMENS LTD EGYPT

26/1

October 14, 2016

SIEMENS

Automation License Manager

Simatic License Key Disk

SIMATIC S7
SIEMENS LTD EGYPT

27/1

October 14, 2016

SIEMENS

Setting PG-PC Interface

SIMATIC S7
SIEMENS LTD EGYPT

28/1

October 14, 2016

SIEMENS

Short Cut For Simatic Manager

Double Click On The Icon

SIMATIC S7
SIEMENS LTD EGYPT

29/1

October 14, 2016

SIEMENS

Starting Simatic Manager

Menu Bar

Tool Bar

Status Bar

SIMATIC S7
SIEMENS LTD EGYPT

30/1

October 14, 2016

SIEMENS

Menu Bar

Last 4 project opened

SIMATIC S7
SIEMENS LTD EGYPT

31/1

October 14, 2016

SIEMENS

Menu Bar

Online Partners On The Existing Protocol


(MPI, Profibus, Ethernet)

SIMATIC S7
SIEMENS LTD EGYPT

32/1

October 14, 2016

SIEMENS

Menu Bar

Configure the communication between the PG/PC and the PLC

SIMATIC S7
SIEMENS LTD EGYPT

33/1

October 14, 2016

SIEMENS

Menu Bar

Simatic Manager Software Help

SIMATIC S7
SIEMENS LTD EGYPT

34/1

October 14, 2016

SIEMENS

Tool Bar

Tool Bar For a Project

SIMATIC S7
SIEMENS LTD EGYPT

35/1

October 14, 2016

SIEMENS

Open Existing Project

Select Your Project from the list

SIMATIC S7
SIEMENS LTD EGYPT

36/1

October 14, 2016

SIEMENS

Create New Project

Write The Project Name


Then OK

SIMATIC S7
SIEMENS LTD EGYPT

37/1

October 14, 2016

SIEMENS

Create S7 Program

SIMATIC S7
SIEMENS LTD EGYPT

38/1

October 14, 2016

SIEMENS

Insert S7 Station

SIMATIC S7
SIEMENS LTD EGYPT

39/1

October 14, 2016

SIEMENS

HARDWARE
CONFIGURATION

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

40/1

October 14, 2016

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

October 14, 2016

SIEMENS

Open Hardware Configuration Editor


Double Click

Click on this icon to view the catalog

The Catalog

SIMATIC S7
SIEMENS LTD EGYPT

42/1

October 14, 2016

SIEMENS

Insert Rack

From the catalog:


1- Click On The Simatic 300
2- Click On Rack 300
3- Double Click on the Rail
The Rail Will Appear In Area-1& Area-2

Area-1

Area-2

SIMATIC S7
SIEMENS LTD EGYPT

43/1

October 14, 2016

SIEMENS

Selecting The CPU

From the catalog:


1- Open CPU-300
2- Select the CPU from the list by
ORDER NUMBER then by VERSION

If any product selected from the list you will


find the order number in this area

SIMATIC S7
SIEMENS LTD EGYPT

44/1

October 14, 2016

SIEMENS

Selecting The Signal Modules

This Slot reserved for power supply


(Optional can be inserted or not)
This Slot reserved for Interface Module

From the catalog:


1- Open SM-300
2- Select the Signal Modules from
the list by ORDER NUMBER

SIMATIC S7
SIEMENS LTD EGYPT

45/1

October 14, 2016

SIEMENS

Input & output Modules Address Overview

SIMATIC S7
SIEMENS LTD EGYPT

46/1

October 14, 2016

SIEMENS

Change the Address of the Input & output Modules

SIMATIC S7
SIEMENS LTD EGYPT

47/1

October 14, 2016

SIEMENS

Edit Symbolic Name, Monitor & Modify Variable

SIMATIC S7
SIEMENS LTD EGYPT

48/1

October 14, 2016

SIEMENS

CPU General Properties

SIMATIC S7
SIEMENS LTD EGYPT

49/1

October 14, 2016

SIEMENS

CPU Properties

SIMATIC S7
SIEMENS LTD EGYPT

50/1

October 14, 2016

SIEMENS

CPU Clock Memory Properties

Clock Memory
Frequency
Period

SIMATIC S7
SIEMENS LTD EGYPT

0.5 0.62 1 1.25 2


2

51/1

1.6

2.5

10

0.8 0.5 0.4 0.2 0.1

October 14, 2016

SIEMENS

CPU Retentive Memory Properties

SIMATIC S7
SIEMENS LTD EGYPT

52/1

October 14, 2016

SIEMENS

CPU Protection Properties

SIMATIC S7
SIEMENS LTD EGYPT

53/1

October 14, 2016

SIEMENS

CPU Diagnostics & Clock Properties

SIMATIC S7
SIEMENS LTD EGYPT

54/1

October 14, 2016

SIEMENS

Save & Compile Hardware Configuration

Click on this icon for


saving & compiling the
HW Config.

SIMATIC S7
SIEMENS LTD EGYPT

55/1

October 14, 2016

SIEMENS

Downloading HW Config. To the PLC


1

Click OK

SIMATIC S7
SIEMENS LTD EGYPT

56/1

October 14, 2016

SIEMENS

Uploading HW Config. From the PLC

SIMATIC S7
SIEMENS LTD EGYPT

57/1

October 14, 2016

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

October 14, 2016

SIEMENS

Slot Reservation & Addressing


Slot No.

Slot 1

AI

AO

Reserved for the Power supply.

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

October 14, 2016

SIEMENS

DI/DO Addressing in Multi-Tier Configurations


using IM 360 Send & IM 361 Receive
PS

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

October 14, 2016

SIEMENS

BLOCKS & PROGRAMING


LANGUAGE

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

61/1

October 14, 2016

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

October 14, 2016

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.

Data Blocks (DB)


Data blocks (DB) are data areas of the
user program in which user data
aremanaged in a structured manner.

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

October 14, 2016

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

October 14, 2016

SIEMENS

Inserting S7-Block

Function Name

SIMATIC S7
SIEMENS LTD EGYPT

65/1

Choose the
programming
language

October 14, 2016

SIEMENS

Editing S7-Block (FC1)

Declaration Table

Catalog

Programming Area

Info Area

SIMATIC S7
SIEMENS LTD EGYPT

66/1

October 14, 2016

SIEMENS

Programming Languages
-Ladder Diagram (LAD)
-Statement List (STL)
-Function Block (FBD)

FBD

LAD

-S7-GRAPH

I 0.0

I 0.1

-Structured Control Language (SCL)

Q8.0
I 0.0

STL

&
Q8.0

-Continuous Function Chart (CFC)

I 0.1

A I

0.0

A I

0.1

= Q 8.0

-Sequential Flow Chart (SFC)

CFC

SIMATIC S7
SIEMENS LTD EGYPT

SFC

67/1

SCL

S7-GRAPH

October 14, 2016

SIEMENS

Programming In LAD

SIMATIC S7
SIEMENS LTD EGYPT

68/1

October 14, 2016

SIEMENS

Select the Programming Language

SIMATIC S7
SIEMENS LTD EGYPT

69/1

October 14, 2016

SIEMENS

Programming In STL

SIMATIC S7
SIEMENS LTD EGYPT

70/1

October 14, 2016

SIEMENS

Saving, Downloading & Monitoring the Blocks

Monitor the
Blocks
Save the
Blocks

SIMATIC S7
SIEMENS LTD EGYPT

Download the
Blocks to the PLC

71/1

October 14, 2016

SIEMENS

Calling the Blocks in OB1

Select the block from the


catalog Drag & Drop it on the
Network

SIMATIC S7
SIEMENS LTD EGYPT

72/1

October 14, 2016

SIEMENS

Monitoring the Blocks Online

SIMATIC S7
SIEMENS LTD EGYPT

73/1

October 14, 2016

SIEMENS

SYMBOL TABLE

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

74/1

October 14, 2016

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

October 14, 2016

SIEMENS

Creating, Editing Absolute Addresses In Symbol Table

SIMATIC S7
SIEMENS LTD EGYPT

76/1

October 14, 2016

SIEMENS

Symbol Table

SIMATIC S7
SIEMENS LTD EGYPT

77/1

October 14, 2016

SIEMENS

Find & Replace Aboulute Addresses

SIMATIC S7
SIEMENS LTD EGYPT

78/1

October 14, 2016

SIEMENS

Filter Symbolic Addresses

SIMATIC S7
SIEMENS LTD EGYPT

79/1

October 14, 2016

SIEMENS

Sort Addresses

SIMATIC S7
SIEMENS LTD EGYPT

80/1

October 14, 2016

SIEMENS

Export Symbol Table

SIMATIC S7
SIEMENS LTD EGYPT

81/1

October 14, 2016

SIEMENS

Import Symbol Table

This message must


appear

SIMATIC S7
SIEMENS LTD EGYPT

82/1

October 14, 2016

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

October 14, 2016

SIEMENS

BINARY & LOGIC OPERATION

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

84/1

October 14, 2016

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

October 14, 2016

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

October 14, 2016

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

October 14, 2016

SIEMENS

Set

Reset

The specified address is set to signal


state "1" and remains set until
another instruction resets the
address.

The specified address is reset to


signal state "0" and remains in
this state until another
instruction sets the address
again.

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

October 14, 2016

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

October 14, 2016

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

Example: A conveyor belt


transporting bottled products
to packaging where a
deflector plate is activated to
deflect bottles into a reject
bin if either the weight is not
within certain tolerances or
there is no cap on the bottle.
SIMATIC S7
SIEMENS LTD EGYPT

90/1

October 14, 2016

Simple Example
Ex02Sw
PUSHBUTTON SWITCH

SIMATIC S7
SIEMENS LTD EGYPT

91/1

October 14, 2016

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

Example: A light that comes on


when it becomes dark, i.e.
when there is no light input to
the light sensor there is an
output.
SIMATIC S7
SIEMENS LTD EGYPT

92/1

October 14, 2016

Simple Example
Ex03Sw

SIMATIC S7
SIEMENS LTD EGYPT

RUN-STOP MOTOR

93/1

October 14, 2016

The motor operation


(Example of LOAD, AND,
OR, OUT instructions)
When PB1 is pushed, a
motor will start to rotate with
a forward (clockwise)
direction.
When the PB2 is pushed, it
will start to rotate with a
reverse (counterclockwise)
direction
The PB0 is emergency stop
switch.

SIMATIC S7
SIEMENS LTD EGYPT

94/1

October 14, 2016

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

October 14, 2016

Ex06MotorOn-OffwithLamps

Example: a motor controlled by stop and start push


button switches and for which one signal light must be
illuminated when the power is applied to the motor and
another when it is not applied.

Motor output

Lamp for power


not applied
Lamp for power
applied

SIMATIC S7
SIEMENS LTD EGYPT

96/1

October 14, 2016

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

The NOT instruction


inverts the RLO.

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

October 14, 2016

SIEMENS

Negative Edge Detection

I 1.0 I 1.1

M1.0

Positive Edge Detection

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

October 14, 2016

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

(Negative Edge Detection) detects a


signal change in the address (M1.1)
from "1" to "0" and displays it as
RLO = "1" after the instruction
(such as at M 0.1) for one cycle.

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

October 14, 2016

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

October 14, 2016

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

October 14, 2016

SIEMENS

Exercise:
1- In FC3, Write PLC program to
control the following process:

LS1

Continues flow through the out pipe, if


the level of the tank become below LS1,
one of the two pumps start operation
(Depend on operation sequence) till the
fluid level reaches LS1, if the fluid level
become below LS2, the two pumps
operate until the level of the fluid
reaches LS1. (The two pumps stops till
the fluid level become below LS1)

SIMATIC S7
SIEMENS LTD EGYPT

103/1

In Flow
LS2
P1

P2

Out Flow

October 14, 2016

SIEMENS

Answer of Exercise 1:

Answer of Exercise 3:

SIMATIC S7
SIEMENS LTD EGYPT

104/1

October 14, 2016

SIEMENS

Answer of Exercise 2:

SIMATIC S7
SIEMENS LTD EGYPT

105/1

October 14, 2016

SIEMENS

TIMER

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

106/1

October 14, 2016

SIEMENS

Load and Transfer


Move
MOVE

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

October 14, 2016

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

- Extended Pulse Timer (SE)

MW0

BCD

T(No.)

- OFF Delay Timer (SF)

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

October 14, 2016

SIEMENS

ON Delay Timer (SD)

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

When the Reset input "R" changes


from "0" to "1", the current time
value and the time base are deleted
and the output "Q" is reset.

STL

Digital Outputs

TV

BI

Q0.0
MW0

BCD

T0
S_ODT
I 0.0
S5T#5s
I 0.1

Output

The signal at the "Q" output changes


to "1" when the timer has expired
without error and input "S" has
signal state "1".

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

The current time value can be read


as a binary number at the "BI" output
and as a BCD number at the "BCD"
output.

SIMATIC S7
SIEMENS LTD EGYPT

109/1

October 14, 2016

SIEMENS

Stored ON Delay Timer (SS)


Start
The stored-on-delay timer starts
when the "S" input changes from
"0" to "1". The timer runs starting
with the time value specified at
input "TV" and continues to run
even if the signal at input "S"
changes back to "0" during that
time.

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

The signal state at output "Q"


changes to "1" when the timer has
expired without error, regardless
of whether the signal state at
input "S" is still "1".

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

October 14, 2016

SIEMENS

Pluse Timer (SD)


Start
The pulse timer starts when
the "S" input changes from
"0" to "1". Output "Q" is also
set to "1".

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

October 14, 2016

SIEMENS

Extended Pluse Timer (SE)


I 0.0

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

Output "Q" is reset when the timer


has expired, or
the reset input "R" has a signal
state of "1".

SIMATIC S7
SIEMENS LTD EGYPT

S5T#5s
I 0.1

Q0.3

T3

The signal state at output "Q"


remains at "1" even if the signal at
the "S" input changes back to "0".
If the signal at the start input
changes from "0" to "1" again
while the timer is running, the
timer is restarted

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

October 14, 2016

SIEMENS

Off Delay Timer (SD)


Start
The off-delay timer starts when the "S"
input changes from "1" to "0". When
the timer has expired, the signal state
at output "Q" changes to "0".
If the signal state at the "S" input
changes from "0" to "1" while the timer
is running, the timer stops. The next
time the signal state at the "S" input
changes from "1" to "0", it starts again
from the beginning.
Reset
When the reset input "R" is "1", the
current time value and the time base
are deleted and output "Q" is reset.
If both inputs (S and R) have signal
states of "1", output "Q" is not set until
the dominant reset is deactivated.

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

October 14, 2016

SIEMENS

ON Delay Timer (SD)

Extended Pluse Timer (SE)

Timer

Timer

Off Delay Timer (SF)

Stored ON Delay Timer (SS)


S

R
Timer

Timer

Pluse Timer (SP)


S
R
Timer
Q

SIMATIC S7
SIEMENS LTD EGYPT

114/1

October 14, 2016

The right timer

SIMATIC S7
SIEMENS LTD EGYPT

115/1

October 14, 2016

SIEMENS

COUNTER

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

116/1

October 14, 2016

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

QQ

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

October 14, 2016

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

The values at inputs IN1 and IN2 are


compared
FBD Diagram
== IN1 is equal to IN2
<> IN1 is not equal to IN2
> IN1 is greater than IN2
< IN1 is less than IN2
>= IN1 is greater than or equal to IN2
<= IN1 is less than or equal to IN2.

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

October 14, 2016

SIEMENS

Exercise:

Packaging line control

SIMATIC S7
SIEMENS LTD EGYPT

119/1

October 14, 2016

SIEMENS

Exercise:
1- Write a PLC program to control the counting between zero & 9,
9

by using one input & one counter.

count up
count down

SIMATIC S7
SIEMENS LTD EGYPT

0 9
9 0

120/1

October 14, 2016

SIEMENS

Answer of Exercise 1:

SIMATIC S7
SIEMENS LTD EGYPT

121/1

October 14, 2016

SIEMENS

MATH OPERATION

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

122/1

October 14, 2016

SIEMENS

Objectives
- Understand The Math Operation & How To Use It In Different Language.

SIMATIC S7
SIEMENS LTD EGYPT

123/1

October 14, 2016

SIEMENS

Mathematical Operation
EN

The instruction is executed if RLO is =1 at Enable input 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

October 14, 2016

SIEMENS

DECLARATION TABLE

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

125/1

October 14, 2016

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

October 14, 2016

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

October 14, 2016

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

October 14, 2016

SIEMENS

Declaration Table & Program in FC3

Program for starting and


stopping a motor using the
input & output declaration
table parameter.

SIMATIC S7
SIEMENS LTD EGYPT

129/1

October 14, 2016

SIEMENS

Calling FC3

In FC4, FC3 can be called


& it can be called in any
other FC,FB or OB

SIMATIC S7
SIEMENS LTD EGYPT

130/1

October 14, 2016

SIEMENS

Intering Data for FC3

Calling For FC3 In FC4

SIMATIC S7
SIEMENS LTD EGYPT

131/1

October 14, 2016

SIEMENS

Calling In OB1 For FC4

When Calling The Motor Function


FC3, FC4 Is The Function That Will Be
Called In OB1

SIMATIC S7
SIEMENS LTD EGYPT

132/1

October 14, 2016

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

October 14, 2016

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

October 14, 2016

SIEMENS

DATA BLOCK

SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT

135/1

October 14, 2016

SIEMENS

Objectives
- Know The Elementary & Complex DB.
- How To Create DB.
- Familiar With Addressing & Accessing Data Element.

SIMATIC S7
SIEMENS LTD EGYPT

136/1

October 14, 2016

SIEMENS

Data Blocks (DBs)


Elementary data types (up to 32 bits)
Bit data types (BOOL, BYTE, WORD,
DWORD, CHAR)
Mathematical data types (INT, DINT,
REAL)
Complex data types (longer than 32
bits)
Time (DATE_AND_TIME)
Array (ARRAY)
Structure (STRUCT)
Character chain (STRING)

Function
FC10

OB1

Global data
DB20

Function
FC20
Instance DB for FB1

User-defined data types (longer than 32


bits)
Data type UDT (User Defined Type)

SIMATIC S7
SIEMENS LTD EGYPT

Accessible to all blocks

137/1

Function
block
FB1

Instance data
DB5

October 14, 2016

SIEMENS

Creating a New Data Block

SIMATIC S7
SIEMENS LTD EGYPT

138/1

October 14, 2016

SIEMENS

Entering, Saving, Downloading and Monitoring a Data Block

Declaration
View

Data View

SIMATIC S7
SIEMENS LTD EGYPT

139/1

October 14, 2016

SIEMENS

Addressing Data Elements


The number of data blocks
available depends on the CPU
you use.

8 Bits
Data Byte 0
Data Byte 1

0
DBB 0
DBW 0

Data Byte 2

The maximum block length is


8-KByte for the S7-300 and 64KByte for the
S7-400.

Data Byte 3

DBD 0
DBX 4.1

DBD 8188
DBW 8190
Data Byte 8191

DBB 8191

Accessing Data Elements


OPN DB 9
A
DBX 0.0
OPN DB 9
L
DBB 1

OR
OR

DB9.DBX0.0

DB9.DBB1

DB9.DBW2

OR

OPN "Values"
T DBW 2

SIMATIC S7
SIEMENS LTD EGYPT

140/1

October 14, 2016

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

October 14, 2016

SIEMENS

Answer of Exercise 1:
IN The DB:

The value of K at: X=2, Y=1 and Z=2


K=91

SIMATIC S7
SIEMENS LTD EGYPT

142/1

October 14, 2016

Das könnte Ihnen auch gefallen