Professional Documents
Culture Documents
Prezentare Curs S7-SYSTEM
Prezentare Curs S7-SYSTEM
System overview
8
Modules
• PS Power Supply
• IM Interface Module
9
CPU parameters
• The size of the work memory.
• The size of the loaded memory.
• The number or timers and counters than can be programmed.
• The number of markers.
• The speed at which the instructions can be processed.
• Special versions, such as a CPU with standard onboard inputs
and outputs, or a PROFIBUS-DP interface.
Timers & Counters
• The CPU provides internal timers, counters and “memories”
(markers) that can be used from within the user program. The
required number depends on the application.
Interfaces
Every CPU has an MPI (multi-point interface) as standard. A
number of CPUs also have a PROFIBUS-DP and/or PN, and
sometimes another optional interface.
• Standard CPU
– CPU with 1 interface: MPI-interface*
SIMATIC S7-300
13
S7-300 CPU’s
Standard CPU’s Compact CPU’s Failsafe CPU’s
CPU 312 CPU 312C CPU 315F-2DP
CPU 314 CPU 313C CPU 315F-2PN/DP
CPU 315-2 DP CPU 313C-2 PtP CPU 317F-2DP
CPU 315-2 PN/DP CPU 313C-2 DP CPU 317F-2PN/DP
CPU 317-2 DP CPU 314C-2 PtP CPU 319F-3PN/DP
CPU 317-2 PN/DP CPU 314C-2 DP
CPU 319-3 PN/DP Technology CPU’s
CPU 315T-2DP
CPU 317T-2DP
14
rack 3
rack 2
rack 1
rack 0
15
S7-300 specifications
S7-300 Compact CPU specifications
Work memory 32 64 64 64 96 96
in kilobytes (RAM)
Load memory
integrated
- EPROM - - - - - -
insertable
- MMC 4 MB 8 MB 8 MB 8 MB 8 MB 8 MB
Processing time
0.2 0.1 0.1 0.1 0.1 0.1
per bit instruction (µs)
I/O digital
- internal 10/6 24/16 16/16 16/16 24/16 24/16
- Digital Input 266 1016 1008 8064 1016 7856
- Digital Output 262 1008 1008 8064 1008 7904
Analogue I/O
- internal -/- 4/2 -/- -/- 4/2 4/2
- Analogue Input 64 253 248 503 253 494
- Analogue Output 64 250 248 503 250 495
maximum number
- Modules 8 31 31 31 31 31
- Profiles 1 4 4 4 4 4
SIMATIC S7-400
18
S7-400 CPU’s
Standard CPU’s Failsafe en PROFINET CPU’s Redundant CPU’s
CPU 412-1 DP CPU 414-3 PN/DP CPU 412-3H
CPU 412-2 DP CPU 416F-2 CPU 414-4H
CPU 414-2 DP CPU 416-3 PN/DP CPU 417-4H
CPU 414-3 DP
CPU 416-2 DP
CPU 416-3 DP
CPU 417-4 DP
20
Work memory 144 kB 256 kB 512 kB 1.4 MB 2.8 (1.4) MB 5.6 MB 15 MB 512 kB 1.4 MB 15 MB 1.4 MB 5.6 MB
Program 144 kB 256 kB 512 kB 1.4 MB 2.8 (1.4) MB 5.6 MB 15 MB 256 kB 1.4 MB 15 MB 1.4 MB 5.6 MB
Data
Load memory 512 kB 512 kB 512 kB 512 kB 1MB (256k) 1 MB 1 MB 256 kB 256 kB 256 kB 512 kB 1 MB
internal RAM 64 MB 64 MB 64 MB 64 MB 64 MB 64 MB 64 MB 64 MB 64 MB 64 MB 64 MB 64 MB
insertable
Processing time 0.075 0.075 0.045 0.045 0.03 (0.04) 0.03 0.018 0.075 0.045 0.018 0.045 0.03
per bit instruction
(µs)
Timers 2048 2048 2048 2048 2048 2048 2048 2048 2048 2048 2048 2048
Counters 2048 2048 2048 2048 2048 2048 2048 2048 2048 2048 2048 2048
Marker memories 4096 4096 8192 8192 16384 16384 16384 8192 8192 16384 8192 16384
(bytes)
Digital I/O -
maximum number 4096 4096 8192 8192 16384 16384 131072 8192 8192 16384 8192 16384
via Process Images
Digital I/O
32768 32767 65536 65536 131072 131072 131072 65536 65536 131072 65536 131072
maximum number
Analogue I/O -
2048 2048 4096 4096 8192 8192 8192 4096 4096 8192 4096 8192
maximum number
Number of
21 21 21 21 21 21 21 21 21 21 21 21
expansion racks
Interfaces:
IF1: MPI/DP MPI/DP MPI/DP MPI/DP MPI/DP MPI/DP MPI/DP MPI/DP MPI/DP MPI/DP MPI/DP MPI/DP
IF2: - DP DP DP DP DP DP DP DP DP DP DP
IF3: - - - option - option option option option option PN PN
IF4: - - - - - - option option option option - -
internal clock yes yes yes yes yes yes yes yes yes yes yes yes
21
internal structure
PII: ROM: RAM: RAM: external load
Process Image operating work load memory:
Inputs system memory memory RAM or
FEPROM or
MMC
Memories
Timers
Counters MPI/DP
interface
CPU control unit
PIQ:
Process Image Interfaces:
Outputs PROFIBUS
PROFINET
serial
Periphery:
Digital
DI DO AI AO CP FM CPU
Analogue
Communication and
Function modules
system bus
internal structure of the CPU
22
Downloading
downloading
23
Memory management
Memory cards
• Memory cards (Flash or MMC)
– Flash
• Storage of the program (backup)
• Storage of the project (not all CPU’s)
• Only retentive with battery but not on Flash (separate CPU memory)
– MMC (new 300 CPU’s)
• Storage of the program (backup)
• Storage of the project
• Storage of retentive data (T/C/M/D)
– Size of the MMC (6ES7 953-8L..0-0AA0)
• 64kB / 128kB / 512kB / 2MB / 4MB / 8 MB
Memory cards (example calculating size)
• Example of CPU 315-2 DP, 128 kByte RAM
– Backup of the program (MC7-code):
• MMC/Flash = 1,5 x RAM = 192 kByte
– Backup of the project (only in compressed format, eg. zip)
• MMC/Flash = about 15% of the project size on hard disk
• E.g.. 2 Mbyte a 15% = 300 kByte
– Retentive data T/C/M/D (only on MMC)
• E.g.. 2048 (max.) Memory Bytes = 2 kByte (negligible?)
Program cycle
CPU in stop
QB 0
CPU in QB 1
RUN DQ QB 2
QB 3
Set PIQ Etc.
IB 0
Read PII IB 1
DI IB 2
IB 3
Etc.
OB1
A I 0.0
AN M 2.4
PII = Process Image Inputs
S Q 4.7
PIQ = Process Image Outputs
27
STOP
MRES STOP
MRES
RUN RUN-Program
CPU program is executed and CPU program is executed and
writable writable
RUN
CPU is write protected
STOP STOP
Program is not executed Program is not executed
Memory Reset Memory Reset
Clearing the CPU memory Clearing the CPU memory
29
Startup behavior
CPU in stop
Yes
Error?
No
CPU in startup
OB100
OB101
OB102
CPU in RUN
30
Startup blocks
Startup methods
Type of Characteristic Startup OB S7-300 S7-400
startup
WARM New start with retained memory settings OB100 x x
(WRST) 2)
LAD
Standard within STEP 7
FBD
Standard within STEP 7
STL
Standard within STEP 7
33
Optional software
S7-SCL S7-GRAPH
VAR_INPUT // input variable S1
enable : BOOL := 0 ; // declaration T1
END_VAR S2
IF meas_value > max // Limitation T2
THEN meas_value := max;
END_IF; S3 S7
S7-PLCSIM
S7-Teleservice
SIMATIC S7
STEP 7
TS-adapter
Extra dia
1 bit Status 0 of 1
7 6 5 4 3 2 1 0
1 byte =
8 bits
15 8 7 0
1 word =
2 bytes = 7 0 7 0
16 bits
Extra dia
Addressing of bits
Q 3.5
Bit address (0 to 7)
Separator character
Byte address
Operand I/Q/M/D/L
Inputs / Q outputs / Memory’s / Data / Local data
Extra dia
Addressing
7 6 5 4 3 2 1 0 Bit address
Byte 0
address
1
2
3 X
:
Q 3.5
65535
Program structure
• STEP7 Program structure
– A program consists of the following blocks
• OB Organization Block;
• FC Function
• FB Function Block;
• DB Data Block.
– Each block consists of networks
• Up to 999 networks
– Each network consists of instructions
• Up to 2000 instructions
36
Number of blocks
Maximum number of Blocks
Types of Blocks
• Programmable Blocks (Their numbers vary by type)
Types of Blocks
Block Description
OB Organization Blocks
Block Discription
Block parameters
• overview
Block parameters
Type of Block IN OUT IN/OUT TEMP STAT
Organization Block OB - - - x -
Function FC x x x x -
Function Block FB x x x x x
FB FB SFC
CPU
Operating
system
FC
38
Organization Blocks
Examples of the commonest organization blocks
Online interface
MPI-Interface
CP5611 (pci)
SIMATIC S7
PG/PC
CP5512 (pcmcia)
PC adapter USB,
CP5711
47
PG/PC Interface
49
Language settings
53
Project structure
Project Station Blocks Blocks
Programmable
Program Symbols Symbols
modules
Project Sources Sources
name
S7-300
CPU315-
2DP
S7
Program(1)
S7-400
Blocks
S7-program
OB1
Connection
Symbols
FC0
65
STOP
STOP
MRES
MRES
• By STEP7
What happens after a reset with a CPU which contains a memory card?
Downloading
PG/PC SIMATIC S7-300/400
downloading
Download user
save program to memory MMC/internal load memory
Hard disk Open card
offline
FEPROM/external load
Save/retrieve to/from memory
memory card
Project
68
Memory cards
PG/PC SIMATIC S7-300/400
Download user
save program to MMC/internal load memory
Hard disk Open memory card
offline
FEPROM/external load
Save/retrieve to/from memory
memory card
Project
73
Reference data
• Cross References
• Assignment List
• Program structure
• Unused symbols
• Addresses without symbol
Test functions
• Debug > Monitor
– Block status in LAD/FBD/STL (OB/FC/FB/DB)
• Modify Address
– Modifying addresses during Debug (I/Q/M/D/L)
• Monitor/Modify
– Monitoring and Modifying through a VAT (VAriable Table),
• Enable Periferal Outputs
– Setting outputs in STOP mode
• Force
– Used for permanent control (forcing) of variables
104
CPU information
• Set Time of Day
• Operating Mode
• Module Information
– Scan Cycle Time
– Memory
– Performance data
– Diagnostic Buffer
115
Comparing Blocks
119
Project backup
STEP7 – Hardware Diagnostics
STEP7 – System Diagnostics
STEP7 - Diagnostic buffer
• The system diagnostics is a buffer in the CPU that contains
system messages that were caused by events within the PLC
system. Possible causes that can be diagnosed are:
– internal and external errors from a module, plus the diagnosis
– System errors
– Operating mode transitions
– Bug in the user program
– Removing and inserting modules
• Maximum size of the buffer:
– S7-300: 100 messages
– S7-400: 120 messages (adjustable up to 3200)
Overview “diagnostic information”
CPU SM/FM/CP modules
The diagnostic function of the The diagnostic function for
CPU recognizes a system error a module recognizes an
error and generates a
The diagnostic function of the diagnostic alarm (OB82)
CPU recognizes a software error
diagnostic alarm
system status list
diagnostic
buffer
SFCs
user program
CPU Error handling
CPU in RUN
Yes
Error?
Message in buffer:
No “Error in ….” E.g. “addressing error”
Error OB no
in CPU?
CPU in STOP
Yes
CPU remains in
RUN
Message in buffer :
“OB not found”
CPU in STOP
Error Organization Blocks
Examples of the commonest organization blocks
• The S7-300/400 still has what is known as default addressing. This is the
situation after resetting the CPU, without downloading the hardware
configuration.
Compact CPU’s
Compact CPU’s
rack0: Digital
0-31 external default
rack1:
32-63 Digital Digital Digital Digital Digital
rack2: external default external default external default external default external default
64-95
rack3:
96-123
digital
0-31 external
default
digital digital digital digital
32-63 external external external external digital digital digital
default default default default external external external
64-95
default 256 default 256 default 256
96-127 max. 2k* max.2k* max.2k*
analogue
Blue cells:
256-383 external
are written cyclically into the
default analogue analogue analogue analogue analogue analogue
PII and PIO. analogue
external external external external external external
384-511 external
Yellow cells: default 512 default 512 default 512 default 512 default 512 default 512
default
can only be used with 512-639 max.2k* max.2k* max.8k* max.8k* max.8k* max.8k*
peripheral instructions.
640-767
Light grey cells:
768-1023 non-default non-default
are used for other purposes,
address address
e.g. redirecting, non-default non-default
range range
adjustable digital/analogue address address
ranges and fieldbus IO. range range non-default non-default non-default non-default
1024-2047 address address address address
White cells: range range range range
cannot be addressed by the
CPU in question.
2048-8191
Failsafe en Technology CPU’s
Fail-safe and PROFINET CPUs
Bytes 315F-2DP 315F-2PN/DP 315T-2DP 317F-2DP 317F-2PN/DP 317T-2DP
6FF01 6FH10 6TG10 6FF00 2FJ10 6TJ10
0-31
32-63
96-127
128-255 non-default
address range
Blue cells:
are written cyclically into the analogue analogue analogue
analogue
256-383 external external external
PII and PIO. default
external
default: 128 default: 128
default
max. 2k* max.: 8k*
Yellow cells:
can only be used with 384-511 Analogue Analogue
peripheral instructions. digital ext. default: ext. default
analogue analogue ext. 512 digital 512
external external default max. 2k* external max. 8k*
Light grey cells: 512-639
default: 512 default: 512 1024 default
are used for other purposes, max. 2k* max: 2k* 2k*
non-default
e.g. redirecting,
adjustable digital/analogue address range non-default
640-767
ranges and fieldbus IO. address range
768-1023 non-default
White cells: non-default
non-default non-default address
cannot be addressed by the range address
address range address range
range
CPU in question. 1024-2047
non-default
non-default
2048-8192 address range
address range
S7-300 - digital addresses
Module Slot number with default addressing
carrier
2 3 4 5 6 7 8 9 10 11
2 IM 64 68 72 76 80 84 88 92
65 69 73 77 81 85 89 93
66 70 74 78 82 86 90 94
67 71 75 79 83 87 91 95
1 IM 32 36 40 44 48 52 56 60
33 37 41 45 49 53 57 61
34 38 42 46 50 54 58 62
35 39 43 47 51 55 59 63
0 C IM 0 4 8 12 16 20 24 28
P 1 5 9 13 17 21 25 29
U 2 6 10 14 18 22 26 30
3 7 11 15 19 23 27 31
S7-300: analogue addresses
Module Slot numbers with fixed byte addressing
carrier
2 3 4 5 6 7 8 9 10 11
0 digital
- default:128
127 max. 4 k * digital
default 256
128 max. 8 k * digital digital
Digital - default: 512 default 1024
255 max. 16 k * max. 16 k *
non-default
address range
256
non-default
-
address range
511(1023)
512
-
1023
analogue
Blue cells: default: 2k
1024
are written cyclically into the -
PII and PIO. 2047
analogue
default: 4k
Yellow cells: 2048 analogue analogue
can only be used with - default: 8k default: 8k
peripheral instructions. 3071
0
-
127 Process Process
Image Image
default: 256 default: 256 Process Process Process Process Process
128 max. 8k * max. 8k* Image Image Image Image Image
Digital - default:1024 default:1024 default:1024 default:1024 default:1024
255
max. 16 k * max. 16 k * max. 16 k * max. 16 k * max. 16 k *
512
-
1023
0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68
1 2 3 4 5 6 7 9 9 10 11 12 13 14 15 16 17 18
512 576 640 704 768 832 896 960 1024 1088 1152 1216 1290 1344 1408 1472 1536 1600
S7-400: Slot addressing
PS CPU DI DO
0 0
1 1
2 2
3 3
• a: number of hours
• b: number of minutes
• c: number of seconds
• d: number of milliseconds
TIMER RANGE AND RESOLUTION
Range [S5TIME] Range Resolution
[seconds] [seconds]
10MS to 9990MS 0.01 to 9.99 0.01
1S to 16M_39S 1 to 999 1
Counter settings
• The general format of the counter value looks like this :
– C#XXX
I 0.6 CD
I 0.7 S CV
I 0.4 R Q =
H6. Datatypen
• Elementary data types
• <= 32 bits (E.g. I0.3, Q5.7, C#999, MW10)
• Complex data types
• > 32 bits (bv. ARRAY, STRING)
• User Defined Data Types
• UDT
• Parameter types (TIMER, COUNTER, BLOCK_xx, Pointer, ANY) are data types too, but they can only be used when transferring
block parameters (see our course S7-PROG2: Advanced programming)
Elementary data types I
ELEMENTARY DATA TYPES
Data type Description bits Example
BIT data type Data elements of this type are 1 bit, 8, 16 or 32 bits
BOOL Bit 1 TRUE, FALSE, 1, 0
Data Blocks
SCADA station
Data exchange
PLC program
Data Blocks
• Data Blocks are mend to store data like setpoints and readings.
» E.g. S5T#3S :
– DWORD DBD6 :
» E.g. 18.25 :
Databyte 8196
Structure of a Data Block
8 Bits (byte)
Databyte 0 7 6 5 4 3 2 1 0
Databyte 1 DBW0
Databyte 2 DBD0
Databyte 3 DBW2
Databyte 4
Databyte 5 DBW4
Databyte 6
DBD4
Databyte 7 DBW6
:
0.0 STRUCT
=11.0 END_STRUCT
Opening a Data Block
FC7 FC20
______ ______
______
OPN DB 10 ______
______ DB10
______ OPN DB 11
______ DB10 ______
______ ______
______ ______ DB11
______
CALL FC 20 ______
______ ______
______ ______
______
DB10
______
______
______
______
H8 Data transfer functions:
• Data types <= 32 bits MOVE
– BLKMOV EN OUT
– FILL SFC21
• SFC21 (STEP7 Library) RET_VAL
EN BLK
BVAL ENO
MOVE function (Load/Transfer)
System memory Work memory I/O modules
Process images Timer (T) en Counter Data Periferal
inputs (PII) and (C) functions inputs
outputs (PIQ)
LOAD (L)
MOVE
TRANSFER (T)
Process images
inputs (PII) and
outputs (PIQ)
↓ ↓ ↓ 7 (n) 0 Byte n
↓ ↓ ↓ ↓
31 24 23 16 15 8 7 0 ACCU 1
↓ ↓ ↓ ↓
↓ ↓ ↓ 7 (n) 0 Byte n
OUTPUT
Extra appendix: Compare S5/S7
BOUWSTEENVERGELIJK S5/S7
FB/FX
x DB Instance Data Bouwsteen (coupled to a FB, IN/OUT parameters en de STAT variables are stored in this)
S5 S7
L KB 5 L 5
L KF 1000 L 1000
L KH 8FFE L W#16#8FFE
L KC 'OTTO' L 'OTTO'
L KT 320.2 L S5T#5M20S
L KZ 10 L C#10
L KM 10011100 L 2#10011100
L KY 100,12 L B#(100,12)
L B#(100,12,50,8)
Extra appendix: Compare S5/S7
ORGANIZATION BLOCK
Function S5 S7