Está en la página 1de 16

Organization Blocks

FC

FB

OB1
Operating
system
FB

FC

SFC

SFB

Other

OBs

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

26.10.2008
PRO1_12E.1

SITRAIN Training for


Automation and Drives

Objectives

Upon completion of this chapter the participant will ...


...

g
blocks that are available
know the organization

...

understand the difference between "Complete restart", "(Warm)


Restart" and "Cold restart"

...

p
the p
principle
p of interrupt
p p
processing
g
be able to explain

...

know the "Time-of-Day Interrupt", "Cyclic Interrupt", "Hardware


Interrupt", "Time-Delay Interrupt", "Diagnostic Interrupt"

...

y
and asynchronous
y
errors and
know the error OBs for synchronous
will be able to implement them to influence the CPU response when
errors occur

...

be able to interpret the OB start information and will be able to


evaluate it in the program

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

26.10.2008
PRO1_12E.2

SITRAIN Training for


Automation and Drives

Overview of the Organization Blocks


Startup
OB 100
OB 101
OB 102
C li
Cyclic
program
execution
OB 1

P i di
Periodic
program
execution

E
Event-driven
tdi
program
execution

OB 10 to 17
(Time-of-day
interrupts)

OB 30 to 38
(Cyclic interrupts)

OB 20 to
t 23
(Time-delay interrupts)

OB 80 to
t 87

OB 40 to 47
(Hardware interrupts)

OB 121, 122

Interrupt OBs

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

26.10.2008
PRO1_12E.3

(Asynchronous errors)

(Synchronous errors)

Error OBs

SITRAIN Training for


Automation and Drives

Startup OBs
CPU in the STOP state
(Peripheral modules have switched all outputs to the safe state)
Restart (manual)
Completer Restart
automatic

only for S7-400


(according to setting in HW-Config):
STOP -> RUN + WRST

manual

S7-300/400 S7-300
Power ON STOP->RUN

S7-400
Execute OB 101

STOP->RUN
+ CRST

Process residual scan cycle

Delete the p
process images,
g ,
non-retentive M, T, C

Delete PIQ (parameter-assignable)


Execute OB 100
Monitoring time
for restart
exceeded?
d d?

Output
O
t t PIQ
Enable outputs

C
Y
C
L
E

Output PIQ
Enable outputs

Execute OB1

C
Y
C
L
E

Output PIQ

Siemens AG 2002. All rights reserved.

STOP

no

Read in PII

SIMATIC S7

yes

Date:
File:

26.10.2008
PRO1_12E.4

Read in PII
Execute OB1
Output PIQ

SITRAIN Training for


Automation and Drives

Interrupting the Cyclic Program

Such as OB82
(Prio.26) = Error
h dli
handling.
E
Executed
t d iin
event of wire break at
a analog input PIW 352

Such as OB20 (Prio.3)


(Prio 3)
= Time-delay interrupt.
Execution starts 3.25s
after a part is
detected.

SIMATIC S7
Siemens AG 2002. All rights reserved.

OB1
is
executed
continuously .....

Such as OB10
(Prio.2) = Time-ofday interrupt.
Executed once a
minute from 9:30

...... until it is interrupted


by another OB
OB No.
OB 1
OB 10
OB 20
OB 35
OB 40
OB 82

Date:
File:

26.10.2008
PRO1_12E.5

OB Type
Cyclic program
Time-of-day interrupt
Time-delay interrupt
Cyclic interrupt
Hardware interrupt
Error handling

Priority
1
2
3
12
16
26 / 28

SITRAIN Training for


Automation and Drives

Time-of-Day Interrupt (OB10)

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

26.10.2008
PRO1_12E.6

SITRAIN Training for


Automation and Drives

Cyclic Interrupt (OB35)

RUN

OB35
Interval

OB1

SIMATIC S7
Siemens AG 2002. All rights reserved.

OB1

OB35
Interval

B1

OB1

Date:
File:

OB35
Interval

OB1

26.10.2008
PRO1_12E.7

OB1

Prio 12
OB1

B1

Prio 1

SITRAIN Training for


Automation and Drives

Hardware Interrupt (OB40)

HW Config:

Analog input
module properties

CPU
properties

Analog input module

+27648

Upper limit
value
Lower limit
value

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

26.10.2008
PRO1_12E.8

SITRAIN Training for


Automation and Drives

Time-Delay Interrupt (OB20)

I 0.0

M0.1

(P)

SIMATIC S7
Siemens AG 2002. All rights reserved.

SFC 32
(SRT_DINT)

EN

20

OB_NR

T#500ms

DTIME

W#16#01

SIGN

Date:
File:

M2.0

RET VAL
RET_VAL

26.10.2008
PRO1_12E.9

( )

ENO
MW10

SITRAIN Training for


Automation and Drives

The Diagnostic Interrupt and Asynchronous Error Interrupt


(OB81 to 87)
HW Config:
Analog input module
properties

CPU
properties

Analog input module

Wirebreak
+27648

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

26.10.2008
PRO1_12E.10

SITRAIN Training for


Automation and Drives

Asynchronous Error OBs

Type of error

Example

OB

Priority

Time error

Maximum scan cycle time exceeded

OB80

26

Power supply fault

Backup battery failure

OB81

Diagnostic interrupt

Wirebreak at input of diagnostics-capable


module

OB82

Insert / remove
interrupt

Removal of a signal module during operation


of an S7-400

OB83

CPU hardware fault

Incorrect signal level at the


MPI interface

OB84

Error in updating the process image


(module defective)

OB85

Rack fault

Failure of an expansion device or a


DP slave

OB86

Communication error

Error in reading message frame

OB87

Program execution error

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

26.10.2008
PRO1_12E.11

26 / 28

SITRAIN Training for


Automation and Drives

Synchronous Errors

Type of error

Example

OB

Programming error

A block that is not present in the


CPU is called in the program

OB121

Access error

SIMATIC S7
Siemens AG 2002. All rights reserved.

A module that is either defective


or nott presentt is
i addressed
dd
d iin th
the
program (such as direct access to a
non-existent I/O module)

Date:
File:

26.10.2008
PRO1_12E.12

OB122

Priority

Same as that
of the OB
interrupted
as a result of
th error
the

SITRAIN Training for


Automation and Drives

System Functions for Controlling Interrupt OBs

Organization block
Function

Number

Priority
in S7-300

SFCs for
controlling OBs

Remarks

HW Config alternative

Time-of-day interrupt OB 10 to 17

SFC 28 to 31

Cyclic interrupt

OB 30 to 38

12

none

Time delay interrupt


Time-delay

OB 20 to 23

SFC32 to 34

Hardware interrupt

OB 40 to 47

16

none

Diagnostic interrupt

OB 81 to 87

26

none

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

26.10.2008
PRO1_12E.13

Mandatory

SITRAIN Training for


Automation and Drives

OB Start Information
L-Byte
0/1

Start event

Consecutive number

2/3

Priority

OB No.

4/5

Data formats of L-Bytes 8, 9, 10, 11

6/7

Additional info 1

(such as start address of interrupt module)

8/9

Additional info 2

(such as interrupt status)

10 / 11

Additional info 3

(such as channel number)

12 / 13

Year

Month

14 / 15

D
Day

H
Hours

16 / 17

Minutes

Seconds

18 / 19

1/10 Second,
Second 1/100 Second

1 /1000 Second,
Second Weekday

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

26.10.2008
PRO1_12E.14

Management
information

Start
information

Start
time

SITRAIN Training for


Automation and Drives

Exercise: Displaying the Startup Type (OB100)


DO Q 8/9....
Q 4/5....
.0

DI
I 0.0

T_System_ON

I 0.1
01

T S t
T_System_OFF
OFF

I 0.2
I 0.3
I 0.4

S_M/A_ModeSelect

I 0.5
05

T M/A Accept
T_M/A_Accept

I 0.6

Qty./ Weight

L_SYSTEM

.1
1

T_Jog_RT

L_MAN

T_Jog_LT

L_AUTO

.2
.3

man.Rest.
man
Rest
auto.Rest.

I 1.0

T_Fault_Rst

.0

I 1.1

S_Fault1
S_Fault2

L_Fault2

S_Fault3

L_Fault3

I 1.5
15

.5
5

I 1.6

.6

I 1.7

.7

AO1

-15V...+15V
AO2

AI1

.2
.3
.4

AI2
AI1

.1

I 1.4

Siemens AG 2002. All rights reserved.

-15V...+15V

.6
.7

L_Fault1

QW 12 / QW 6

.5
5

Ack_Restart

SIMATIC S7

.4

I 0.7

I 1.2
I 1.3

ACTUAL number of parts

AI2

SETPOINT number of parts

0 8 1 5

AI1

AI2

AO1

AO2

IW 4 / IW 2

Date:
File:

26.10.2008
PRO1_12E.15

SITRAIN Training for


Automation and Drives

Exercise: Response to a Synchronous Error


Simulator

CPU Program

CPU Response...
with OB121
SIEMENS
CPU314
Synchronous error

BCD
thumbwheel
button

DC5V
RUN
STOP

cont.
light

RUN-P
RUN

Setpoint number of
parts

0 2 81
7

SF

flashes
for
moment

STOP

02 I 1

IW 4 / IW 2

w/o OB121
SIEMENS
CPU314

Value at
moment
of
switch-over

SF
DC5V
RUN
STOP

Synchronous error
RUN-P
RUN
STOP

SIMATIC S7
Siemens AG 2002. All rights reserved.

cont.
light

Date:
File:

26.10.2008
PRO1_12E.16

SITRAIN Training for


Automation and Drives

cont.
light

También podría gustarte