Вы находитесь на странице: 1из 8

Runtime control(S7-1200,S7-1500)

Page 1 of 8

Runtime control
This chapter contains the following information:

RE_TRIGR: Restart cycle monitoring time(S7-1200,S7-1500)

STP: Exit program(S7-1200,S7-1500)

GetError: Get error locally(S7-1200,S7-1500)

GetErrorID: Get error ID locally(S7-1200,S7-1500)

INIT_RD: Initialize all retain data(S7-1500)

WAIT: Configure time delay(S7-1500)

RE_TRIGR: Restart cycle monitoring time


Description
You can use the "Restart cycle monitoring time" instruction to restart the cycle time monitoring of the CPU. The maximum
cycle time then starts over again for the duration you have set in the CPU configuration.
The instruction "Restart cycle monitoring time" can be called regardless of the priority in all blocks.
If the instruction is called in a block with a higher priority, such as a hardware interrupt, diagnostic error interrupt, or cyclic
interrupt, the instruction is not executed and the ENO enable output is set to signal state "0".
The instruction "Restart cycle monitoring time" can be called a maximum of 10 times in a program cycle.
Note
Make sure that you do not create an infinite loop in the cyclical program processing, i.e. in OB1, when you use the
instruction "Restart cycle monitoring time". Otherwise the CPU will not reach the cycle control point. As a result, it may
not be possible to execute certain CPU functions (e. g. process image update).

Parameters
The "Restart cycle monitoring time" instruction has no parameters.

STP: Exit program


Description
You use the "Exit program" instruction to set the CPU to STOP mode and therefore to terminate the execution of the
program. The effects of changing from RUN to STOP depend on the CPU configuration.
When the result of logic operation (RLO) at the input of the instruction is "1", the CPU changes to STOP mode and program
execution is terminated. The signal state at the output of the instruction is not evaluated.
When the RLO is "0" at the input of the instruction, then the instruction will not be executed.
Parameters
The "Exit program" instruction has no parameters.

file://C:\Users\TOP\AppData\Local\Temp\~hh9A7D.htm

01/11/2016

Runtime control(S7-1200,S7-1500)

Page 2 of 8

GetError: Get error locally


Description
The "Get error locally" instruction is used to query the occurrence of errors within a block. If the system signals errors during
block execution, detailed information about the first error that occurred is saved in the operand at the ERROR output.
Only operands of the "ErrorStruct" system data type can be specified at the ERROR output. The "ErrorStruct" system data
type specifies the exact structure in which the information about the error is stored. Using additional instructions, you can
evaluate this structure and program an appropriate response. When the first error has been eliminated, the instruction
outputs information about the next error that occurred.
Parameters
The following table shows the parameters of the "Get error locally" instruction:
Parameters

Declaration

Data type

Memory area

Description

ERROR

Output

ErrorStruct

D, L

Error information

Data type "ErrorStuct"


The following table shows the structure of the "ErrorStruct" data type:
Structure component

Data type

Description

ERROR_ID

WORD

Error ID

FLAGS

BYTE

Shows if an error occurred during a block call.


16#01: Error during a block call.
16#00: No error during a block call.

REACTION

BYTE

Default reaction:
0: Ignore (write error),
1: Continue with substitute value "0" (read error),
2: Skip instruction (system error)

CODE_ADDRESS

CREF

Information about the address and type of block

BYTE

Type of block where the error occurred:

BLOCK_TYPE

1: OB
2: FC
3: FB

CB_NUMBER

UINT

Number of the code block

OFFSET

UDINT

Reference to the internal memory

BYTE

Access mode: Depending on the type of access, the


following information can be output:

MODE

Mode

file://C:\Users\TOP\AppData\Local\Temp\~hh9A7D.htm

(A)

(B)

(C)

(D)

(E)

01/11/2016

Runtime control(S7-1200,S7-1500)

OPERAND_NUMBER

UINT

Page 3 of 8

Offset

Area

Location

Scope

Number

Area

Offset

Area

DB no.

Offset

PtrNo./Acc

Area

DB no.

Offset

PtrNo./Acc

Slot
No. /
Scope

Area

DB no.

Offset

Operand number of the machine command

POINTER_NUMBER_LOCATION

UINT

(A) Internal pointer

SLOT_NUMBER_SCOPE

UINT

(B) Storage area in internal memory

DATA_ADDRESS

NREF

Information about the address of an operand

BYTE

(C) Memory area:

AREA

L: 16#40 4E, 86, 87, 8E, 8F, C0 CE


E: 16#81
A: 16#82
M: 16#83
DB: 16#84, 85, 8A, 8B

DB_NUMBER

UINT

(D) Number of the data block

OFFSET

UDINT

(E) Relative address of the operand

Structure component "ERROR_ID"


The following table shows the values that can be output on the structure component "ERROR_ID":
ID*
(hexadecimal)

ID*
(decimal)

Description

No error

2503

9475

Invalid pointer

2505

9477

Calling the instruction "Stop" (SFC46) in the user program

2520

9504

Invalid STRING

file://C:\Users\TOP\AppData\Local\Temp\~hh9A7D.htm

01/11/2016

Runtime control(S7-1200,S7-1500)

2522

9506

Read error: Operand outside the valid range

2523

9507

Write error: Operand outside the valid range

2524

9508

Read error: Invalid operand

2525

9509

Write error: Invalid operand

2528

9512

Read error: Data alignment

2529

9513

Write error: Data alignment

252C

9516

Invalid pointer

2530

9520

Write error: Data block

2533

9523

Invalid pointer used

2534

9524

Block number error FC

2535

9525

Block number error FB

2538

9528

Access error: DB does not exist

2539

9529

Access error: Wrong DB used

253A

9530

Global data block does not exist

253C

9532

Faulty information or the function does not exist

253D

9533

System function does not exist

253E

9534

Faulty information or the function block does not exist

253F

9535

System block does not exist

2550

9552

Access error: DB does not exist

2551

9553

Access error: Wrong DB used

2575

9589

Error in the program nesting depth

2576

9590

Error in the local data distribution

2942

10562

Read error: Input

2943

10563

Write error: Output

Page 4 of 8

*The error codes can be displayed as integer or hexadecimal value in the program editor. For additional information on
toggling display formats, refer to "See also".
The ENO enable output of the "Get error locally" instruction is only set if the EN enable input has the signal state "1" and
error information is present. If one of these conditions is not fulfilled, the remaining program execution is not affected by the
"Get error locally" instruction.
The "Get error locally" instruction can also be used to forward an alarm about the error status to the calling block. To do this,
the instruction must be positioned in the last network of the called block.

file://C:\Users\TOP\AppData\Local\Temp\~hh9A7D.htm

01/11/2016

Runtime control(S7-1200,S7-1500)

Page 5 of 8

Note
The "Get error locally" instruction enables local error handling within a block. If "Get error locally" is inserted in the
program code of a block, any predefined system responses are ignored when an error occurs.

Example
The following example shows how the instruction works:

When an error occurs, the "Get error locally" instruction returns the error information to the locally created "#error" structure
at the ERROR output. The error information is converted and evaluated using the "Equal" comparison instruction.
Information about the type of error is the first comparison value assigned to the instruction. The value "1" is specified in
operand "substitute" as the second comparison value. If the error is a read error, the condition of the comparison instruction
is fulfilled. The "#out" and "OK" outputs are reset in this case.

GetErrorID: Get error ID locally


Description
The "Get error ID locally" instruction is used to query the occurrence of errors within a block. If the system signals errors
during block execution, the error ID of the first error that occurred is saved in the tag at output ID. Only operands of the
WORD data type can be specified at the ID output. When the first error has been eliminated, the instruction outputs the error
ID of the next error that occurred.
The output of the "Get error ID locally" instruction is only set if the input of the instruction has the signal state "1" and error
information is present. If one of these conditions is not fulfilled, the remaining program execution is not affected by the "Get
error ID locally" instruction.
The "Get error ID locally" instruction can also be used to forward an alarm about the error status to the calling block. To do
this, the instruction must be positioned in the last network of the called block.
Note
The "Get error ID locally" instruction enables local error handling within a block. If the "Get error ID locally" instruction is
inserted in the program code of a block, any predefined system responses are ignored when an error occurs.

Parameters
The following table shows the parameters of the "Get error ID locally" instruction:

file://C:\Users\TOP\AppData\Local\Temp\~hh9A7D.htm

01/11/2016

Runtime control(S7-1200,S7-1500)

Page 6 of 8

Parameters

Declaration

Data type

Memory area

Description

ID

Output

WORD

I, Q, M, D, L

Error ID

Parameters ID
The following table shows the values that can be output in the ID parameter:
ID*
(hexadecimal)

ID*
(decimal)

Description

No error

2503

9475

Invalid pointer

2505

9477

Calling the instruction "Stop" (SFC46) in the user program

2520

9504

Invalid STRING

2522

9506

Read error: Operand outside the valid range

2523

9507

Write error: Operand outside the valid range

2524

9508

Read error: Invalid operand

2525

9509

Write error: Invalid operand

2528

9512

Read error: Data alignment

2529

9513

Write error: Data alignment

252C

9516

Invalid pointer

2530

9520

Write error: Data block

2533

9523

Invalid pointer used

2534

9524

Block number error FC

2535

9525

Block number error FB

2538

9528

Access error: DB does not exist

2539

9529

Access error: Wrong DB used

253A

9530

Global data block does not exist

253C

9532

Faulty information or the function does not exist

253D

9533

System function does not exist

253E

9534

Faulty information or the function block does not exist

253F

9535

System block does not exist

2550

9552

Access error: DB does not exist

file://C:\Users\TOP\AppData\Local\Temp\~hh9A7D.htm

01/11/2016

Runtime control(S7-1200,S7-1500)

Page 7 of 8

2551

9553

Access error: Wrong DB used

2575

9589

Error in the program nesting depth

2576

9590

Error in the local data distribution

2942

10562

Read error: Input

2943

10563

Write error: Output

*The error codes can be displayed as integer or hexadecimal value in the program editor. For additional information on
toggling display formats, refer to "See also".

INIT_RD: Initialize all retain data


Description
You use the "Initialize all retain data" instruction to reset the retain data of all data blocks, bit memories and SIMATIC timers
and counters at the same time. The instruction can only be executed within a startup OB because the execution would
exceed the program cycle duration.
Parameter
The following table shows the parameters of the "Initialize all retain data" instruction:
Parameter

Declaration

Data type

Memory area

Description

EN

Input

BOOL

I, Q, M, D, L

Enable input

ENO

Output

BOOL

I, Q, M, D, L

Enable output

REQ

Input

BOOL

I, Q, M, D, L, T, C or
constant

If the "REQ" input


has the signal state
"1", all retain data
are reset.

RET_VAL

Output

INT

I, Q, M, D, L

Error information:
If an error occurs
during execution of
the instruction, an
error code is output
on the RET_VAL
parameter.

For additional information on valid data types, refer to "See also".


Parameters RET_VAL
The following table shows the meaning of the values of the RET_VAL parameter:
Error code*
(W#16#...)

Explanation

file://C:\Users\TOP\AppData\Local\Temp\~hh9A7D.htm

01/11/2016

Runtime control(S7-1200,S7-1500)

Page 8 of 8

0000

No error

80B5

The instruction cannot be executed because it was not programmed within a startup OB.

8xyy

For more information on errors, refer to "See also".

*The error codes can be displayed as integer or hexadecimal value in the program editor. For additional information on
toggling display formats, refer to "See also".
Example
The following example shows how the instruction works:

If the operands "TagIn_1" and "Tag_REQ" have signal state "1", the instruction is executed. The retain data of all data
blocks, bit memories and SIMATIC timers and counters are reset If the instruction is executed without errors, the ENO
enable output has the signal state "1".

WAIT: Configure time delay


Description
The "Configure time delay" instruction is used to halt the execution of the program for a set period of time. You indicate the
period of time in microseconds on the WT parameter of the instruction.
You can configure time delays of up to 32767 microseconds (s). The smallest possible delay time depends on the
respective CPU and corresponds to the execution time of the "Configure time delay" instruction.
The execution of the instruction can be interrupted by higher priority events.
The "Configure time delay" instruction supplies no error information.
Parameters
The following table shows the parameters of the "Configure time delay" instruction:
Parameter

Declaration

Data type

Memory area

Description

EN

Input

BOOL

I, Q, M, D, L

Enable input

ENO

Output

BOOL

I, Q, M, D, L

Enable output

WT

Input

INT

I, Q, M, D, L, P or
constant

Time delay in
microseconds (s)

file://C:\Users\TOP\AppData\Local\Temp\~hh9A7D.htm

01/11/2016

Вам также может понравиться