Sie sind auf Seite 1von 46

Programmable Safety Systems

PSS-Range

PSS WIN-PRO
Programming Shortform
Item No. 20 376-07

All rights to this manual are reserved by Pilz GmbH & Co. KG
Copies may be made for internal purposes.
While every effort has been made to ensure that the
information in this manual is accurate, no responsibility can
be accepted for errors or omissions contained within it.
We reserve the right to amend specifications without notice.
We are grateful for any feedback on the contents of this
manual.
The names of products, goods and technologies used in this
manual are trademarks of the respective companies.

EB

00.00 - 08.242) Input byte (PII)


32.00 - 95.243)
132.00 - 195.246)

EW

00.00 - 08.162) Input word (PII)


32.00 - 95.163)
132.00 - 195.166)

00.00 - 08.312) Output bit (PIO)


32.00 - 95.313)
132.00 - 195.316)

00.00 - 08.242) Output byte (PIO)


32.00 - 95.243)
132.00 - 195.246)

PB

00.00 - 08.242) Periphery byte (periphery


32.00 - 95.243) access)
132.00 - 195.246)

2)

Indirect

Set

00.00 - 08.16
Output word (PIO)
32.00 - 95.163)
6)
132.00 - 195.16

Direct

Direct

00.00 - 08.312) Input bit (PII)


32.00 - 95.313)
132.00 - 195.316)

AW

Read

Read

2)

Write

AcAddrescess sing

Address range Description

Indirect

Address range Description

AB

Type

Set

Type

Write

Overview of Operands: FS

MB

064.00 - 099.24 Flag byte


114.00 - 114.244)
130.00 - 255.244)

MW

064.00 - 099.16 Flag word


114.00 - 114.164)
130.00 - 255.164)

100.00 - 104.31 Communication flag in bit


105.00 - 109.314) mode

x x1)

MB

x x1)

100.00 - 104.24 Communication flag in byte


105.00 - 109.244) mode

MW

100.00 - 104.16 Communication flag in


105.00 - 109.164) word mode

x x1)

110.00

FALSE flag (RLO-0)

110.01

TRUE flag (RLO-1)

111.00

Arithmetic carry flag

111.01

Arithmetic overflow flag

111.02

Arithmetic zero flag

111.03

Arithmetic sign flag

112.00

Status flag ST RUN/STOP


(RUN = 1)

112.01

Status flag ST no error/


error (error = 1)

AcAddrescess sing

PW

00.00 - 08.16
Periphery word (periphery
32.00 - 95.163) access)
6)
132.00 - 195.16

DB

001, 002, 003

System data block


(DB 001 and DB 002 are
read-only)

x x1)

112.02

Status flag ST STOP


command (ST halted via
STOP command = 1)

DB

010 - 255

Data block

x x1)

112.03

0000 - 1023

Data byte left


(bit 8 -15)

Warm start ST STOP >


RUN (after warm start 1,
active for one cycle only)

DL
DR

0000 - 1023

Data byte right


(bit 0 - 7)

112.04

Cold start ST OFF > RUN


(after cold start 1, active
for one cycle only)

DW

0000 - 1023

Data word (bit 0 - 15)

112.05

001 - 255

Function block

KB

0-255

Constant Byte

ST general reset performed


(after general reset 1,
active for one cycle only)

FB
KC

ASCII
character set

Constant
Character (2 characters)

113.00

Status flag FS RUN/STOP


(RUN = 1)

KF

-32768 ...
+32767

Constant
Fixed point number

113.01

Status flag FS error/no


error (error = 1)

KH

0000 - FFFF

Constant
Hexadecimal figure

Constant Bit state

KM

16 bit

KY

0 - 255 per byte Constant 2 Bytes

064.00 - 099.31 Flags


114.00 - 114.314)
130.00 - 255.314)

1)
2)

3)
4)
5)

x
6)

Only on 3rd generation PSS


Depending on PSS and hardware
Only on PSS with SafetyBUS p 0
Only on PSS with an FS operating system version 43
On PSS with an FS operating system version 43, also flags in
the range 64 - 99, 130 - 255
Only on PSS with an FS operating system version 47 and
SafetyBUS p 1

Read

Direct

Set

AcAddrescess sing

113.02

Status flag FS STOP


command (FS halted via
STOP command = 1)

113.03

Warm start FS STOP >


RUN (after warm start 1,
active for one cycle only)

113.04

Cold start FS OFF > RUN


(after cold start 1, active
for one cycle only)

113.05

Status flag SafetyBUS p 0


RUN/STOP (RUN = 1),
only on PSS with an FS
operating system version > 35

113.06

Status flag SafetyBUS p 1


RUN/STOP (RUN = 1),
only on PSS with an FS
operating system version > 47

113.08

Reset of the remanent DBs in


the FS section (after reset 1,
flag must be reset through
SB255, FUNK = 50), only on
PSS with FS operating
system version > 65

MB

114.00, 114.08, Flag byte, indirect


114.16, 114.24 addressing5)

x x4)

MW

114.00, 114.16

x x4)

115.00 - 115.31 Deactivation flag in bit


mode (selective shutdown)

MB

115.00 - 115.24 Deactivation flag in byte


mode (selective
shutdown)

MW

115.00 - 115.16 Deactivation flag in word


mode (selective
shutdown)

116.00 - 116.31 Status flag I/O-Groups in


bit mode (SafetyBUS p 0,
I/O-Group in RUN = 1)

MB

116.00 - 116.24 Status flag I/O-Groups in


byte mode (SafetyBUS p 0)

MW

116.00 - 116.16 Status flag I/O-Groups in


word mode (SafetyBUS p 0)

Flag word, indirect


addressing5)

Indirect

Address range Description

Write

Type

Continued

117.00 - 117.31 Status flag I/O-Groups in


bit mode (SafetyBUS p 1,
I/O-Group in RUN = 1)

MB

117.00 - 117.24 Status flag I/O-Groups in


byte mode (SafetyBUS p 1)

MW

117.00 - 117.16 Status flag I/O-Groups in


word mode (SafetyBUS p 1)

OB

010 - 073

OB

101, 120, 1244), Organisation block


125, 127, 128, (cannot be called up)
140 - 171

Indirect

Write

Set

AcAddrescess sing

Direct

Address range Description

Read

Type

Alarm organisation blocks


for SafetyBUS p
(cannot be called up)

OB

130, 131, 132


1336)

Organisation blocks for


SafetyBUS p (cannot be
called up)

OB

200 - 231

Organisation blocks for


selective shutdown
(cannot be called up)

PB

001 - 255

Program block

SB

001 - 255

Standard function block

064 - 127

Timer

XW

00000-00071

Word from a word module

064 - 127

Counter

ZW

064 - 127

Counter status (fixed point


number)

Table of contents
1

Introduction

IL

2.1
2.2
2.3
2.3.1
2.3.2
2.3.3
2.3.4
2.3.5
2.3.6
2.4
2.5

Bit operations
Timers and counters
Byte/word operations
Load and transfer operations
Convert operations
Compare operations
Arithmetic operations
Logic operations
Shift and rotate operations
Jump operations
Organisational operations

LD

3.1
3.2
3.3
3.3.1
3.4
3.5

Bit operations
Timers and counters
Byte/word operations
Compare operations
Jump operations
Organisational operations

FBD

4.1
4.2
4.3
4.3.1
4.3.2
4.3.3
4.3.4
4.3.5
4.3.6
4.4
4.5

Bit operations
Timers and counters
Byte/word operations
Load and transfer operations
Convert operations
Compare operations
Arithmetic operations
Logic operations
Shift and rotate operations
Jump operations
Organisational operations

Predefined SBs

60

Blocks

72

6.1
6.2
6.3
6.4
6.5

Organisation blocks (OB)


Program blocks (PB)
Function blocks (FB)
Standard function blocks (SB)
Data blocks (DB)

10
10
12
14
14
14
14
16
20
20
24
24

28
28
30
32
32
34
34

x
x
x
x

38
38
40
44
44
44
46
48
52
54
56
56

72
73
73
74
74

Addressing

7.1
7.2
7.3
7.4
7.5
7.5.1
7.5.2

Absolute addresses
Direct addressing
Indirect addressing
Set addressing
Free addressing
Free addressing in the FS section
Free addressing in the ST section

78
78
79
80
81
81
81
82

Introduction

This shortform summarises the key information required to


program a PSS. Detailed descriptions of the individual topics can
be found in the PSS WIN-PRO Programming Manual.

IL

2.1

Bit operations

IL

Description

Load
[Operand] => [RLO]
Load NOT
[Operand negated] => [RLO]
AND operation
[Operand] AND [RLO] => [RLO]
AND NOT, operand negated
[Operand negated] AND [RLO] => [RLO]
OR operation
[Operand] OR [RLO] => [RLO]
OR NOT, operand negated
[Operand negated] OR [RLO] => [RLO]
Load open parenthesis
[Parenthesis result] => [RLO]
AND open parenthesis
[Result from parentheses] AND [RLO] => [RLO]
OR open parenthesis
[Result from parentheses] OR [RLO] => [RLO]
Close parenthesis
Set
[Operand] = 1, if RLO = 1

LN
U
UN
O
ON
L(
U(
O(
)
S

R
=
=N

10

Reset
[Operand] = 0, if RLO = 1
Store
[RLO] => [Operand]
Store NOT
[RLO negated] => [Operand]

RLO
dep.
N

Permitted operands
A, E, M, T, Z

N
N
N
N
N
N

None

None

None

N
Y

None
A, M

A, M, T, Z

A, M

11

2.2

Timers and counters

IL

Description

SE

Start timer as switch-on delay

Permitted operands

RLO
dep.
Y

Time = Time value x Time base


Time value: Any value in the range 1 ... 32767
Time base: 0 corresponds to 50 ms
1 corresponds to 100 ms
2 corresponds to 1 s
3 corresponds to 10 s
4 corresponds to 1 min
Example: The time value must be loaded into
the accumulator before the SE operation. The
time base and timer are stated as operands.
L
L

KF 100
E 0.12

// Time value 100


// Set RLO through
// start input

SE

// Start timer T064


// with time base 2

064.2

While the switch-on delay is running, the timer


status (e.g. T064) is 0. Once the time has
elapsed, the timer status is 1.
ZV

Increment counter (count forwards)

ZR

The counter status (-32768 ... +32767) is


located in the ZW counter word that
corresponds to the counter (e.g. ZW064).
If the counter status is greater than 0, the
counters status bit (e.g. Z064) will be 1.
Decrement counter (count backwards)

The counter status (-32768 ... +32767) is


located in the ZW counter word that
corresponds to the counter (e.g. ZW064).
If the counter status is greater than 0, the
counters status bit (e.g. Z064) will be 1.

12

13

2.3

Byte/word operations

2.3.1 Load and transfer operations


IL

Description

Load
[Operand] => [Accumulator]
Store
[Accumulator] => [Operand]

RLO
dep.
N
N

Permitted operands
AB/AW, EB/EW, PB/PW, DL, DR, DW, KB, KC, KF, KH, KM,
KY, MB/MW, XW, ZW
AB/AW, EB/EW, PB/PW, DL, DR, DW, MB/MW, XW, ZW

2.3.2 Convert operations


IL

Description

ST only:
DEF
ST only:
DUF

Convert BCD figure in accumulator to binary


[BCD] => [Binary]
Convert binary figure in the accumulator into
BCD [Binary] => [BCD]

RLO
dep.
N

Permitted operands

None

RLO
dep.
N

Permitted operands

None

2.3.3 Compare operations


IL

Description

>

Greater than comparison


[Accumulator] > [Operand] => RLO = 1
Equals comparison
[Accumulator] = [Operand] => RLO = 1
Less than comparison
[Accumulator] < [Operand] => RLO = 1

!=
<

14

AB/AW, EB/EW, DL, DR, DW, KB, KC, KF, KH, KM, KY, MB/
MW, ZW

N
N

15

2.3.4 Arithmetic operations


IL

Description

Increment accumulator/operands1)
No operand stated:
[Accumulator] + 1 => [Accumulator]
Operand stated:
[Operand] + 1 => [Operand]

KZW

Overflow on byte operands: 255 + 1 = 0


Overflow on word operands: +32767 + 1 =
-32768
Decrement accumulator/operands1)
No operand stated:
[Accumulator] -1 => [Accumulator]
Operand stated:
[Operand] -1 => [Operand]

RLO
dep.
N

Permitted operands
AB/AW, DW, MB/MW

Overflow on byte operands: 0 - 1 = 255


Overflow on word operands: -32768 - 1 =
+32767
Form a twos complement from the accumulator N
(negate)1)
Negate [Accumulator]
Example:
Accumulator before KZW: 10010010 10110000
Accumulator after KZW:
01101101 01010000
N
Addition1)
[Operand] + [Accumulator] => [Accumulator]

None

AB/AW, EB/EW, DL, DR, DW, KB, KF, MB/MW, ZW

The accumulator contents and word operands


are interpreted as signed 16 bit fixed point
numbers, byte operands are unsigned.
If an overflow occurs, the value FFFFH is
entered in the auxiliary accumulator. The
contents of the accumulator is then invalid!

1)

This operation may not be followed by an operation that is dependent on


the RLO.

16

17

IL

Description
Subtraction1)
[Accumulator] - [Operand] => [Accumulator]

RLO
dep.
N

Permitted operands
FS
Permitted
operands

Permitted operands ST

Type

Type

Address range

Address range

AB/AW, EB/EW, DL, DR, DW, KB, KF, MB/MW, ZW

The accumulator contents and word operands


are interpreted as signed 16 bit fixed point
numbers, byte operands are unsigned.
If an overflow occurs, the value FFFFH is
entered in the auxiliary accumulator. The
contents of the accumulator is then invalid!
Multiplication1)
[Operand] * [Accumulator] => [Accumulator],
[Auxiliary accumulator]

The accumulator contents and word operands


are interpreted as signed 16 bit fixed point
numbers, byte operands are unsigned. The
result is a signed 32 bit fixed point number. The
low word is stored in the accumulator, the
signed high word in the auxiliary accumulator.
N
Division1)
[Accumulator] : [Operand] => [Accumulator],
[Auxiliary accumulator]

The accumulator contents and word operands


are interpreted as signed 16 bit fixed point
numbers, byte operands are unsigned. The
result is also a signed 16 bit fixed point number.
The remainder from the division is stored in the
auxiliary accumulator.

1)

This operation may not be followed by an operation that is dependent on


the RLO.

18

19

2.3.5 Logic operations


IL

Description

AND

Bitwise AND operation1)


[Accumulator] AND [Operand] => [Accumulator]

OR

XOR

KEW

RLO
dep.
N

Permitted operands
AB/AW,EB/EW, DL, DR, DW, KH, KM, MB/MW

If the operand is a byte, it is linked with the


accumulators low byte. The accumulators high
byte remains unchanged.
N
Bitwise OR operation1)
[Accumulator] OR [Operand] => [Accumulator]
If the operand is a byte, it is linked with the
accumulators low byte. The accumulators high
byte remains unchanged.
N
Bitwise EXCLUSIVE OR operation1)
[Accumulator] EXCLUSIVE OR [Operand] => [Acc.]
If the operand is a byte, it is linked with the
accumulators low byte. The accumulators high
byte remains unchanged.
Form a ones complement from the accumulator N
(invert)1)
Invert [Accumulator]
Example:
Acc. before KEW:
Acc. after KEW:

10010010
01101101

None

10110000
01001111

2.3.6 Shift and rotate operations


IL

Description

RL

Rotate accumulator left1)


[Accumulator] rotate x times to the left =>
[Accumulator]

RLO
dep.
N

Permitted operands
Number of rotation cycles (0 ... 15)

Bits that drop out on the left (Bit 15) are read in
again on the right (Bit 0).
Example:
Accumulator before RL 3:
Accumulator after RL 3:
1)

10010010 10110000
10010101 10000100

This operation may not be followed by an operation that is dependent on


the RLO.

20

21

IL

Description

RLO
dep.

Permitted operands

RR

Rotate accumulator right1)


[Accumulator] rotate x times right => [Acc.]

Number of rotation cycles (0 ... 15)

Number of shift operations (0 ... 15)

Bits that drop out on the right (Bit 0) are read in


again on the left (Bit 15).
Example:
Acc. before RR 3:
Acc. after RR 3:
SLV

10010010
00010010

10110000
01010110

Shift accumulator left


[Accumulator] <-- (RLO) shift x times left
The status of the RLO is read into Bit 0.
Example:
Acc. before SLV 3: 10010010
RLO:
1
Acc. after SLV 3:
10010101

SRV

10110000
10000111

Shift accumulator right


[Accumulator] <-- (RLO) shift x times right

The status of the RLO is read into Bit 15.


Example:
Acc. before SRV 3: 10010010
RLO:
1
Acc. after SRV 3: 11110010
TA

1)

10110000
01010110

Transpose accumulator and aux. accumulator1) N


[Accumulator] <=> [Auxiliary accumulator]
Example:
Acc. before TA:
10010010
Aux. acc. before TA: 00001111

10110000
00001111

Acc. after TA:


Aux. acc. after TA:

00001111
10110000

00001111
10010010

None

This operation may not be followed by an operation that is dependent on


the RLO.

22

23

2.4

Jump operations

IL

Description
Unconditional jump

RLO
dep.
N

SPA
SPB

Permitted operands
Label preceded by =, example =xxx

Conditional jump

Label preceded by =, example =xxx

Permitted operands

A jump to the stated label is only carried out if


the status of the RLO equals 1.
If the status of the RLO equals 0, the jump
command is not performed and the RLO is set
to 1.

2.5

Organisational operations

IL

Description

Select a data block

RLO
dep.
N

CAL

Unconditional block call1)

FB, PB, SB

CALC

Conditional block call1)

FB, PB, SB

BE

The block call is only carried out if the status of


the RLO equals 1.
Block end
N

None

SEG

Final operation within a block.


Start of segment

Segment number

DB

This operation marks the start of a segment.


A label (max. 14 characters) can be positioned
before the segment operation.
There is no need to enter SEG plus the
number when programming; you only need to
enter SEG or ***. This will automatically be
replaced by SEG and the correct number.
Example:
Label
xxx:
1)

Segment operation
SEG 13

This operation may not be followed by an operation that is dependent on


the RLO.

24

25

RLO
dep.
N

Permitted operands

Enable alarms

None

BAS

Re-enables the alarms that were disabled


through the AS operation. Stored alarms will
be triggered.
Shut down outputs

None

STP

FS section: All the digital outputs in the FS


section receive the status 0. When this
command has been issued, it is possible to
continue working in the user program until the
next cycle. At the next cycle change the self
check will detect an error, because the process
image of outputs will no longer match the
outputs. For this reason you should program a
STOP operation (STP) before the cycle
change.
ST section: All the digital outputs in the ST
section receive the status 0.
N
Stop program

None

IL

Description

FS only:
AS

Disable alarms

None

The AS operation disables the alarms on


modules with alarm capabilities. Alarms are
detected and stored but are not triggered. A
max. of 32 alarms can be stored. If this limit is
exceeded, the PSS will switch to a STOP
condition.
The alarms must be re-enabled before the next
cycle change (AF operation).
FS only:
AF

The STP operation stops the program running


in the FS / ST section. Organisation block
OB128 (FS) or OB028 (ST) will be run. The
user program can only be restarted by a PSS
cold start.

1)

This operation may not be followed by an operation that is dependent on


the RLO.

26

27

LD

3.1

Bit operations

Graphic element

Description

Permitted operands

Op.

N/O contact
[Operand] AND [RLO] => [RLO]

Op.

A, E, M, T, Z

Op.

N/C contact
[Operand negated] AND [RLO] => [RLO]

Op.

Set
[Operand] = 1, if RLO = 1

Op.

A, M

Reset
[Operand] = 0, if RLO = 1

Op.

A, M, T, Z

Op.

Store
[RLO] => [Operand]

Op.

A, M

Op.

Store NOT
[RLO negated] => [Operand]

S
Op.
R

28

29

3.2

Timers and counters

Graphic element

Op.
SD
Start
Range

Description

Permitted operands

Start timer

Op.

T plus time base (0, 1, 2, 3 or 4)

Time = Time value x Time base


Time value: Any value in the range 1 ...
32767
Time base: 0 corresponds to 50 ms
1 corresponds to 100 ms
2 corresponds to 1 s
3 corresponds to 10 s
4 corresponds to 1 min

Start

A, E, M, T, Z

Range

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

Increment counter (count forwards)

Op.

The counter status (-32768 ... +32767) is


located in the ZW counter word that
corresponds to the counter (e.g. ZW064).
If the counter status is greater than 0, the
counters status bit (e.g. Z064) will be 1.
Decrement counter (count backwards)

Op.

Op.: Details of timer and time base


Example: T064.3
Start: Start timer
Start = 0 -> 1: Timer is started,
timer status is set
Start = 1 -> 0: Timer status is reset
Range: Time value
Value range: 1 ... 32767
While the switch-on delay is running, the
timer status (e.g. T064) is 0. Once the
time has elapsed, the timer status is 1.

Op.
CU

Op.
CD

30

The counter status (-32768 ... +32767) is


located in the ZW counter word that
corresponds to the counter (e.g. ZW064).
If the counter status is greater than 0,
the counters status bit (e.g. Z064) will
be 1.

31

3.3

Byte/word operations

3.3.1 Compare operations


Graphic element
GT_B
OUT

Description

Permitted operands

Greater than comparison (8 bit,


unsigned)
[IN1] > [IN2] => [OUT] = 1

IN1

AB, EB, PB, DL, DR, KB, MB

IN2

AB, EB, DL, DR, KB, MB

OUT

Current path

IN1

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN2

AW, EW, DW, KC, KF, KH, KM, KY, MW, ZW

OUT
IN1

Current path
AB, EB, PB, DL, DR, KB, MB

IN2

AB, EB, DL, DR, KB, MB

OUT

Current path

IN1

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN2

AW, EW, DW, KC, KF, KH, KM, KY, MW, ZW

OUT
IN1

Current path
AB, EB, PB, DL, DR, KB, MB

IN2

AB, EB, DL, DR, KB, MB

OUT

Current path

IN1

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN2

AW, EW, DW, KC, KF, KH, KM, KY, MW, ZW

OUT

Current path

IN1
IN2
GT_I
OUT

Greater than comparison (16 bit,


signed)
[IN1] > [IN2] => [OUT] = 1

IN1
IN2

EQ_B
OUT

Equals comparison (8 bit, unsigned)


[IN1] = [IN2] => [OUT] = 1

IN1
IN2
EQ_I
OUT

Equals comparison (16 bit, signed)


[IN1] = [IN2] => [OUT] = 1

IN1
IN2
LT_B
OUT

Less than comparison (8 bit, unsigned)


[IN1] < [IN2] => [OUT] = 1

IN1
IN2
LT_I
OUT
IN1
IN2

32

Less than comparison (16 bit, signed)


[IN1] < [IN2] => [OUT] = 1

33

3.4

Jump operations

Graphic element
Op.

Description

Permitted operands

Unconditional jump

Op.

Label preceded by =, example =xxx

Conditional jump

Op.

Label preceded by =, example =xxx

JMP

Op.
JMPC

3.5

The jump to the stated label will only be


carried out if there is a 1 to the left of
the coil symbol.

Organisational operations

Graphic element
Op.

Description

Permitted operands

Select a data block

Op.

DB

Unconditional block call

Op.

FB, PB, SB

Conditional block call

Op.

FB, PB, SB

OPEN

Op.
CAL
Op.
CALC

FS only:
ID

34

The block call will only be carried out if


there is a 1 to the left of the coil
symbol.
Disable alarms

None

ID disables the alarms on modules with


alarm capabilities. Alarms are detected
and stored but are not triggered. A max.
of 32 alarms can be stored. If this limit is
exceeded, the PSS will switch to a
STOP condition.
The alarms must be re-enabled before
the next cycle change (IE operation).

35

Graphic element

Description

FS only:

Enable alarms

None

Re-enables the alarms that were


disabled via ID. Stored alarms will be
triggered.
Shut down outputs

None

FS section: All the digital outputs in the


FS section receive the status 0. When
this command has been issued, it is
possible to continue working in the user
program until the next cycle. At the next
cycle change the self check will detect
an error, because the process image of
outputs will no longer match the outputs.
For this reason you should program a
STOP operation (STOP) before the
cycle change.
ST section: All the digital outputs in the
ST section receive the status 0.
Stop program

None

IE

OFF

STOP

Permitted operands

STOP halts the program running in the


FS / ST section. Organisation block
OB128 (FS) or OB028 (ST) will be run.
The user program can only be restarted
by a PSS cold start.

36

37

FBD

4.1

Bit operations

Graphic element

Description

Permitted operands

Input

Op.

A, E, M, T, Z

Op.

A, M

Reset
[Operand] = 0, if RLO = 1

Op.

A, M, T, Z

Store
[RLO] => [Operand]

Op.

A, M

Input of an element. The status of the


input is passed to the element
unchanged.
Inverted input
The status of the input is inverted.
AND operation

&

>1

Op.
S
Op.
R

Op.
ST
Op.
STN

38

The operands at the inputs are ANDlinked.


The operands can be negated before
they are linked. Such inputs are
identified by the negation symbol
.
OR operation
The operands at the inputs are ORlinked.
The operands can be negated before
they are linked. Such inputs are
identified by the negation symbol
.
Set
[Operand] = 1, if RLO = 1

Store NOT
[RLO negated] => [Operand]

39

Graphic element
Op.

Description

Permitted operands

SR Flip-Flop

Q (Op.)

A, M, T, Z

A, E, M, T, Z

A, E, M, T, Z

SR
Q

S
R
Op.

RS Flip-Flop

RS
Q

R
S

4.2

Timers and counters

Graphic element
Op.
SD
Start
Range

Description

Permitted operands

Start timer

Op.

T plus time base (0, 1, 2, 3 or 4)

Time = Time value x Time base


Time value: Any value in the range 1 ...
32767
Time base: 0 corresponds to 50 ms
1 corresponds to 100 ms
2 corresponds to 1 s
3 corresponds to 10 s
4 corresponds to 1 min

Start

A, E, M, T, Z

Range

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

Op.: Details of timer and time base


Example: T064.3
Start: Start timer
Start = 0 -> 1: Timer is started,
timer status is set
Start = 1 -> 0: Timer status is reset
Range: Time value
Value range: 1 ... 32767
While the switch-on delay is running, the
timer status (e.g. T064) is 0. Once the
time has elapsed, the timer status is 1.
The timer can be reset using the Reset
(R) operation.

40

41

Graphic element
Op.
CU

Op.
CD

42

Description

Permitted operands

Increment counter (count forwards)

Op.

The counter status (-32768 ... +32767) is


located in the ZW counter word that
corresponds to the counter (e.g. ZW064).
If the counter status is greater than 0, the
counters status bit (e.g. Z064) will be 1.
Decrement counter (count backwards)

Op.

The counter status (-32768 ... +32767) is


located in the ZW counter word that
corresponds to the counter (e.g. ZW064).
If the counter status is greater than 0,
the counters status bit (e.g. Z064) will
be 1.

43

4.3

Byte/word operations

4.3.1 Load and transfer operations


Graphic element
Op.

Description

Permitted operands

Store
[Current value] => [Operand]

Op.

Byte and word operands that are permitted as output


parameters for the preceding graphic element.

ST

4.3.2 Convert operations


Graphic element

B2W
OUT

IN

W2B
IN

OUT

ST only:

Description

Permitted operands

Convert byte to word


Byte => Word

IN

AB, EB, PB, DL, DR, KB, MB

OUT

AW, EW, PW, DW, MW, XW, ZW

Convert word to byte


Word => Byte

IN

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN:
Word
OUT: Byte

OUT

AB, EB, PB, DL, DR, MB

Convert BCD figure to binary


BCD => Binary

IN

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN:
BCD figure
OUT: Binary figure

OUT

AW, EW, PW, DW, MW, XW, ZW

Convert binary figure to BCD


Binary => BCD

IN

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN:
Binary figure
OUT: BCD figure

OUT

AW, EW, PW, DW, MW, XW, ZW

IN:
Byte
OUT: Word

BCD2BIN
IN

OUT

ST only:
BIN2BCD
IN

44

OUT

45

4.3.3 Compare operations


Graphic element
GT_B
IN1

OUT

Description

Permitted operands

Greater than comparison (8 bit,


unsigned)
[IN1] > [IN2] => [OUT] = 1

IN1

AB, EB, PB, DL, DR, KB, MB

IN2

AB, EB, DL, DR, KB, MB

OUT
IN1

A, M
AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN2

AW, EW, DW, KC, KF, KH, KM, KY, MW, ZW

OUT
IN1

A, M
AB, EB, PB, DL, DR, KB, MB

IN2

AB, EB, DL, DR, KB, MB

OUT
IN1

A, M
AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN2

AW, EW, DW, KC, KF, KH, KM, KY, MW, ZW

OUT
IN1

A, M
AB, EB, PB, DL, DR, KB, MB

IN2

AB, EB, DL, DR, KB, MB

OUT
IN1

A, M
AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN2

AW, EW, DW, KC, KF, KH, KM, KY, MW, ZW

OUT

A, M

IN2

GT_I
IN1

OUT

Greater than comparison (16 bit,


signed)
[IN1] > [IN2] => [OUT] = 1

IN2

EQ_B
IN1

Equals comparison (8 bit, unsigned)


[IN1] = [IN2] => [OUT] = 1

OUT

IN2

EQ_I
IN1

Equals comparison (16 bit, signed)


[IN1] = [IN2] => [OUT] = 1

OUT

IN2
LT_B
IN1

Less than comparison (8 bit, unsigned)


[IN1] < [IN2] => [OUT] = 1

OUT

IN2
LT_I
IN1
IN2

46

OUT

Less than comparison (16 bit, signed)


[IN1] < [IN2] => [OUT] = 1

47

4.3.4 Arithmetic operations


Graphic element
Op.
INC_OP

INC
OUT

IN

Op.
DEC_OP

DEC
IN

OUT

NEG
IN

OUT

Description

Permitted operands

Increment operands
[Operand] + 1 => [Operand]

Op.

AB/AW, DW, MB/MW

IN

AB/AW, EB/EW, PB/PW, DL, DR, DW, KB, KC, KF,


KH, KM, KY, MB/MW, XW, ZW

OUT

AB/AW, EB/EW, PB/PW, DL, DR, DW, MB/MW, XW,


ZW

Op.

AB/AW, DW, MB/MW

IN

AB/AW, EB/EW, PB/PW, DL, DR, DW, KB, KC, KF,


KH, KM, KY, MB/MW, XW, ZW

Overflow on byte operands:


0 -1 => OUT = 255
Overflow on word operands:
-32768 - 1 => OUT = +32767
Form a twos complement (negate)
Negate [IN] => [OUT]

OUT

AB/AW, EB/EW, PB/PW, DL, DR, DW, MB/MW, XW,


ZW

IN

AB/AW, EB/EW, PB/PW, DL, DR, DW, KB, KC, KF,


KH, KM, KY, MB/MW, XW, ZW

Example:
IN:
10010010 10110000
OUT: 01101101 01010000

OUT

AB/AW, EB/EW, PB/PW, DL, DR, DW, MB/MW, XW,


ZW

Overflow on byte operands:


255 + 1 => Op. = 0
Overflow on word operands:
+32767 + 1 => Op. = -32768
Increment
[IN] + 1 => [OUT]
Overflow on byte operands:
255 + 1 => OUT = 0
Overflow on word operands:
+32767 + 1 => OUT = -32768
Decrement operands
[Operand] -1 => [Operand]
Overflow on byte operands:
0 -1 => Op. = 255
Overflow on word operands:
-32768 -1 => Op. = +32767
Decrement
[IN] -1 => [OUT]

IN and OUT must be of the same type,


i.e. both bytes or both words.

48

49

Graphic element
ADD_I
IN1

OUT

IN2

Description

Permitted operands

Addition
[IN1] + [IN2] => [OUT]

IN1

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN1 and IN2 are interpreted as signed 16


bit fixed point numbers.

IN2

AB/AW, EB/EW, DL, DR, DW, KB, KF, MB/MW, ZW

OUT

AW, EW, PW, DW, MW, XW, ZW

Multiplication
[IN1] * [IN2] => [OUT1], [OUT2]

IN1

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

IN1 and IN2 are interpreted as signed 16


bit fixed point numbers. The result is a
signed 32 bit fixed point number.

IN2

AB/AW, EB/EW, DL, DR, DW, KB, KF, MB/MW, ZW

OUT1,
OUT2

AW, EW, PW, DW, MW, XW, ZW

If the arithmetic flag M110.01 is set, an


overflow has occurred and the result is
invalid.
SUB_I
IN1

OUT

IN2

Subtraction
[IN1] - [IN2] => [OUT]

IN1 and IN2 are interpreted as signed 16


bit fixed point numbers.
If the arithmetic flag M110.01 is set, an
overflow has occurred and the result is
invalid.

MUL_I
IN1

OUT1

IN2

OUT2

The low word is stored in OUT1, the


signed high word in OUT2.

DIV_I

50

IN1

OUT1

IN2

OUT2

Division
[IN1] : [IN2] => [OUT1], [OUT2]

IN1 and IN2 are interpreted as signed 16


bit fixed point numbers. The result OUT1
is also a signed 16 bit fixed point
number. The remainder from the division
is stored in OUT2.

51

4.3.5 Logic operations


Graphic element
AND_B
IN1

OUT

Description

Permitted operands

Bitwise AND operation (bytes)


[IN1] AND [IN2] => [OUT]

IN1

AB, EB, PB, DL, DR, KB, MB

IN2

AB, EB, DL, DR, MB

OUT
IN1
IN2

AB, EB, PB, DL, DR, MB


AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW
AW, EW, DW, KH, KM, MW

OUT
IN1

AW, EW, PW, DW, MW, XW, ZW


AB, EB, PB, DL, DR, KB, MB

IN2

AB, EB, DL, DR, MB

OUT
IN1
IN2

AB, EB, PB, DL, DR, MB


AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW
AW, EW, DW, KH, KM, MW

OUT
IN1

AW, EW, PW, DW, MW, XW, ZW


AB, EB, PB, DL, DR, KB, MB

IN2

AB, EB, DL, DR, MB

OUT
IN1

AB, EB, PB, DL, DR, MB


AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW
AW, EW, DW, KH, KM, MW

IN2

AND_W
IN1

Bitwise AND operation (words)


[IN1] AND [IN2] => [OUT]

OUT

IN2
OR_B
IN1

Bitwise OR operation (bytes)


[IN1] OR [IN2] => [OUT]

OUT

IN2
OR_W
IN1

Bitwise OR operation (words)


[IN1] OR [IN2] => [OUT]

OUT

IN2

XOR_B
IN1

OUT

Bitwise EXCLUSIVE OR operation


(bytes)
[IN1] EXCLUSIVE OR [IN2] => [OUT]

IN2
XOR_W
IN1

OUT

Bitwise EXCLUSIVE OR operation


(words)
[IN1] EXCLUSIVE OR [IN2] => [OUT]

IN2
NOT
IN

OUT

Form a ones complement (invert)


Invert [IN] => [OUT]
Example:
IN
OUT

10010010
01101101

10110000
01001111

IN2
OUT
IN

AW, EW, PW, DW, MW, XW, ZW


AB/AW, EB/EW, PB/PW, DL, DR, DW, KB, KC, KF,
KH, KM, KY, MB/MW, XW, ZW

OUT

AB/AW, EB/EW, PB/PW, DL, DR, DW, MB/MW,XW,


ZW

IN and OUT must be of the same type,


i.e. both bytes or both words.

52

53

4.3.6 Shift and rotate operations


Graphic element
ROL
OUT

IN
N

ROR
OUT

IN
N

SRL
OUT

IN
FILL

Description

Permitted operands

Rotate left1)
[IN] Rotate N times to the left => [OUT]

IN

AB/AW, EB/EW, PB/PW, DL, DR, DW, KB, KC, KF,


KH, KM, KY, MB/MW, XW, ZW

Bits that drop out on the left (Bit 15) are


read in again on the right (Bit 0). If IN is a
byte, bits will be inserted whose status is
unknown.

0 ... 15

OUT

AB/AW, EB/EW, PB/PW, DL, DR, DW, MB/MW, XW,


ZW

IN

AB/AW, EB/EW, PB/PW, DL, DR, DW, KB, KC, KF,


KH, KM, KY, MB/MW, XW, ZW

FILL

A, E, M, T, Z

0... 15

OUT

AB/AW, EB/EW, PB/PW, DL, DR, DW, MB/MW, XW,


ZW

Example: N = 3, IN is a byte
IN
xxxxxxxx 10110000
OUT xxxxx101 10000xxx
Rotate right1)
[IN] Rotate N times to the right => [OUT]
Bits that drop out on the right (Bit 0) are
read in again on the left (Bit 15). If IN is a
byte, bits will be inserted whose status is
unknown.
Example: N = 3, IN is a byte
IN
xxxxxxxx 10110000
OUT 000xxxxx xxx10110
Shift left1)
[IN] <-- [FILL] shift N times to the left

FILL is written in Bit 0.

SRR
IN
FILL
N

OUT

Shift right1)
[FILL] --> [IN] shift N times to the right

FILL is written in Bit 15. If IN is a byte,


bits will be inserted whose status is
unknown.
Example: N = 3, FILL = 1, IN is a byte
IN
xxxxxxxx 10110000
OUT 111xxxxx xxx10110

1)

IN and OUT must be of the same type, i.e. both bytes or both words.

54

55

4.4

Jump operations

Graphic element
Op.

Description

Permitted operands

Unconditional jump

Op.

Label preceded by =, example =xxx

JMP

Op.
JMPC

4.5

Conditional jump
A jump to the stated label is only carried
out if the status of the RLO equals 1.
If the status of the RLO is 0, the jump
command is not performed and the RLO
is set to 1.

Organisational operations

Graphic element
Op.

Description

Permitted operands

Select a data block

Op.

DB

Unconditional block call

Op.

FB, PB, SB

OPEN

Op.
CAL

Op.
CALC

56

Conditional block call


A block call is only carried out if the
status of the RLO equals 1.

57

Graphic element

Description

FS only:

Disable alarms

ID

FS only:
IE

Permitted operands
None

ID disables the alarms on modules with


alarm capabilities. Alarms are detected
and stored but are not triggered. A max.
of 32 alarms can be stored. If this limit is
exceeded, the PSS will switch to a STOP
condition.
The alarms must be re-enabled before
the next cycle change (IE operation).

Enable alarms

None

Re-enables the alarms that were


disabled via ID. Stored alarms will be
triggered.
Shut down outputs

None

FS section: All the digital outputs in the


FS section receive the status 0. When
this command has been issued, it is
possible to continue working in the user
program until the next cycle. At the next
cycle change the self check will detect
an error, because the process image of
outputs will no longer match the outputs.
For this reason you should program a
STOP operation (STOP) before the
cycle change.
ST section: All the digital outputs in the
ST section receive the status 0.
Stop program

None

OFF

STOP

STOP halts the program running in the


FS / ST section. Organisation block
OB128 (FS) or OB028 (ST) will be run.
The user program can only be restarted
by a PSS cold start.

58

59

Predefined SBs

FS only:
SB001

Description

Permitted operands

SSNR,
DBNR,
STRT

AB, EB, PB, DL, DR, KB, MB

CRC calculation

CNT

AW, EW, PW, DW, KC, KF, KH, KM, KY, MW, XW,
ZW

ERG,
CRC

AW, EW, PW, DW, MW, XW, ZW

SB001
CRCPOLYN
B
B
B
W

SSNR ERG
DBNR CRC
STRT
CNT

W
W

SSNR : Number of call,


Value range: 0 ... 255
DBNR: Data block number of data range over which
the CRC sum is to be calculated; only if
parameter STRT = DL or DR (if STRT = MB:
DBNR is irrelevant)
Value range: 10 ... 255
STRT : Start address of data range over which the
CRC sum is to be calculated.
Value ranges:
MB64.00 ... MB99.24,
MB100.00 ... MB109.24 (only on PSS with an
FS operating system version 49)
MB130.00 ... MB255.24 (only on PSS with an
FS operating system version 49),
DL0 ... DL1023, DR0 ... DR1023
CNT: Number of bytes over which the CRC sum is to
be calculated.
Value range: > 0
ERG: Result
ERG = 2:
CRC calculation incomplete,
another call is required.
ERG = 4:
CRC calculation is complete.
ERG = 16:
Error, because CNT = 0
CRC: CRC sum, when ERG = 4

60

61

SB003

Description

Permitted operands

Addition

Z11, Z12, EW, PW (in ST section only), DW, KF, KH, KM, MW,
Z21, Z22 XW, ZW
SB003
ADD:32
W
W
W
W

Z12
Z11
Z22
Z21

0V
Z3=0
Z32
Z31

OV, Z3=0 A, M

X
X
W
W

Z31, Z32 AW, PW (in ST section only), DW, MW, XW, ZW

Z12:
Z11:
Z22:
Z21:
OV:

Addend 1, high word (15 bit + sign)


Addend 1, low word (16 bit)
Addend 2, high word (15 bit + sign)
Addend 2, low word (16 bit)
Overflow
OV = 1: An overflow has occurred (the result
exceeds +2.147.483.647 or falls below
-2.147.483.648); the result is therefore invalid.
Z32 and Z31 are set to 0.
OV = 0: No overflow has occurred; the result is
valid.
Z3=0: Compare the sum with 0
Z3=0 = 1: The sum is 0
Z3=0 = 0: The sum does not equal 0
Z32: Sum, high word (15 bit + sign)
Z31: Sum, low word (16 bit)

62

63

SB007

Description

Permitted operands

Subtraction

Z11, Z12, EW, PW (in ST section only), DW, KF, KH, KM, MW,
Z21, Z22 XW, ZW
SB007
SUB:32
W
W
W
W

Z12
Z11
Z22
Z21

0V
Z3=0
Z32
Z31

OV, Z3=0 A, M

X
X
W
W

Z31, Z32 AW, PW (in ST section only), DW, MW, XW, ZW

Z12:
Z11:
Z22:
Z21:
OV:

Minuend, high word (15 bit + sign)


Minuend, low word (16 bit)
Subtrahend, high word (15 bit + sign)
Subtrahend, low word (16 bit)
Overflow
OV = 1: An overflow has occurred (the result
exceeds +2.147.483.647 or falls below
-2.147.483.648); the result is therefore invalid.
Z32 and Z31 are set to 0.
OV = 0: No overflow has occurred; the result is
valid.
Z3=0: Compare the difference with 0
Z3=0 = 1: The difference is 0
Z3=0 = 0: The difference does not equal 0
Z32: Difference, high word (15 bit + sign)
Z31: Difference, low word (16 bit)

64

65

SB011

Description

Permitted operands

Multiplication

Z11, Z12, EW, PW (in ST section only), DW, KF, KH, KM, MW,
Z21, Z22 XW, ZW

SB011
MUL:32
W
W
W
W

Z12
Z11
Z22
Z21

Z3=0
Z34
Z33
Z32
Z31

OV, Z3=0 A, M

X
X
W
W
W

Z31, Z32, AW, PW (in ST section only), DW, MW, XW, ZW


Z33, Z34

Z12: Multiplicand, high word (15 bit + sign)


Z11: Multiplicand, low word (16 bit)
Z22: Multiplier, high word (15 bit + sign)
Z21: Multiplier, low word (16 bit)
Z3=0: Compare the product with 0
Z3=0 = 1: The product is 0
Z3=0 = 0: The product does not equal 0
Z34: Product, bit 48 ... 63 (15 bit + sign)
Z33: Product, bit 32 ... 47 (16 bit)
Z32: Product, bit 16 ... 31 (16 bit)
Z31: Product, bit 0 ... 15 (16 bit)

66

67

SB015

Description

Permitted operands

Division

Z11, Z12, EW, PW (in ST section only), DW, KF, KH, KM, MW,
Z21, Z22 XW, ZW
SB015
DIV:32
W
W
W
W

Z12
Z11
Z22
Z21

0V
FEH
Z3=0
Z4=0
Z32
Z31
Z42
Z41

X
X
X
X
W
W
W
W

OV, Z3=0,
Z4=0,
FEH
A, M
Z31, Z32, AW, PW (in ST section only), DW, MW, XW, ZW
Z42, Z41

Z12:
Z11:
Z22:
Z21:
OV:

Dividend, high word (15 bit + sign)


Dividend, low word (16 bit)
Divisor, high word (15 bit + sign)
Divisor, low word (16 bit)
Overflow
OV = 1: An overflow has occurred (the quotient
or the remainder exceeds +2.147.483.647); the
result is therefore invalid. Z42, Z41, Z32 and
Z31 are set to 0.
With division, an overflow can occur if 8000
0000H is divided by FFFF FFFFH or FFFF
FFFFH is divided by 8000 0000H.
OV = 0: No overflow has occurred; the result is
valid.
FEH: Error
FEH = 1: Division by 0
FEH = 0: No error
Z3=0: Compare the quotient with 0
Z3=0 = 1: The quotient is 0
Z3=0 = 0: The quotient does not equal 0
Z4=0: Compare the remainder with 0
Z4=0 = 1: Remainder is 0
Z4=0 = 0: Remainder does not equal 0
Z32: Quotient, high word (15 bit + sign)
Z31: Quotient, low word (16 bit)
Z42: Remainder, high word (15 bit + sign)
Z41: Remainder, low word (16 bit)

68

69

SB041

Description

Permitted operands

Comparison

Z11, Z12, AW, EW, PW (in ST section only), DW, KF, KH, KM,
Z21, Z22 MW, XW, ZW

SB041
CMP:32
W
W
W
W
X

Z12
Z11
Z22
Z21
VZ

ERGE

VZ

A, E, M

ERGE

AB, DL, DR, MB

Z12:
Z11:
Z22:
Z21:
VZ:

Figure 1, high word (16 bit or 15 bit + sign)


Figure 1, low word (16 bit)
Figure 2, high word (16 bit or 15 bit + sign)
Figure 2, low word (16 bit)
Sign
VZ = 1: Comparison is to be signed
VZ = 0: Comparison is to be unsigned
ERGE: Result
ERGE = 00000001: Figure 1 < Figure 2
ERGE = 00000010: Figure 1 = Figure 2
ERGE = 00000100: Figure 1 > Figure 2
ERGE = 00001000: Figure 1 < Figure 2
ERGE = 00010000: Figure 1 > Figure 2
ERGE = 00100000: Figure 1 Figure 2

70

71

Blocks

6.2

6.1

Organisation blocks (OB)

Program blocks organise function and standard function blocks


into logical sections
PB001 ... 255 in both the FS and ST section
PBs have no parameters

Organisation blocks give the user program structure.


OBs are called by the operating system. The cycle OB is called
up in each cycle; all other OBs are only called under certain
circumstances.
The functions of the different OBs are fixed.
Organisation blocks for the FS section:
OB010 ... 073 SafetyBUS p-Alarm-OBs
OB101
Cycle OB, is run through in each cycle
OB120
Start-up OB, when switching from STOP to RUN
OB124
STOP OB, each time the system switches to
STOP
OB125
Error OB, F-21 (addressing error) or F-22 (error
accessing data block)
OB127
Error OB, F-23 (error accessing read-only data
block) or F-24 (set addressing error)
OB128
STOP OB, when manually switching to STOP
OB140 ... 171 Alarm OBs
OB130
SafetyBUS p OB, when a SafetyBUS p 0
I/O-Group switches to STOP
OB131
SafetyBUS p OB, when a bus subscriber sends
a Domain without request
OB132
SafetyBUS p OB, when a bus subscriber
requests a Domain on the PSS
OB133
SafetyBUS p OB, when a SafetyBUS p 1
I/O-Group switches to STOP
OB200 ... 231 Deactivation OBs, only available on PSS with
selective shutdown

6.3

Program blocks (PB)

Function blocks (FB)

Function blocks perform specific individual tasks within a user


program.
FB001 ... 255 in both the FS and ST section
FBs can have input and output parameters
Within the FB the parameters are addressed via set addressing,
i.e. the parameter, preceded by =, is used as the operand, e.g.
=IN1
When an FB is called in another block, each of the FBs
parameters must be assigned an actual parameter. Actual
parameters are written directly to the FBs connection lines.

Parameter types
Organisation blocks for the ST section:
OB001
Cycle OB, is run through in each cycle
OB019
Error OB, S-26 (block missing)
OB020
Start-up OB, when switching from STOP to RUN
OB022
General reset OB, when switching from STOP to
RUN with a general reset
OB023
Error OB, S-05 (configuration error)
OB024
STOP OB, each time the system switches to
STOP
OB025
Error OB, S-21 (addressing error) and S-22
(error accessing data block)
OB027
Error OB, S-23 (error accessing read-only data
block) or S-24 (set addressing error)
OB028
STOP OB, when manually switching to STOP
OB029
Error OB, S-04 (battery error)

72

Type Key
X
Bit
B

Byte

Word

D
Z

Data block
Timer/counter

Actual parameters
Input, output and flag bits:
E, A, M
Input, output and flag bytes,
constants, data word range: EB, AB,
MB, KB, DL, DR
Input, output and flag words,
constants, data words: EW, AW,
MW, KF, KH, KM, KC, KY, DW
Data blocks: DB
Timers or counters: T, Z

73

6.4

Standard function blocks (SB)

Standard function blocks perform the same tasks as function


blocks.
Like FBs, SBs can have input and output parameters; for a
description please refer to the section on Function blocks.
SB001 ... 255 in both the FS and ST section, of which the
following SBs are pre-defined/reserved:
- SB001: CRC calculation (in FS section only)
- SB003: 32 bit addition
- SB007: 32 bit subtraction
- SB011: 32 bit multiplication
- SB015: 32 bit division
- SB041: 32 bit comparison
- SB200 ... SB253: Reserved
- SB254: Communication between ST section and operating
system (in ST section only)
- SB255: Communication between FS section and operating
system (in FS section only)

6.5

Data blocks (DB)

Data blocks are memory areas within the PSS.


There are three different types:
Read-only data blocks
can be read and written to by the user program. Data is nonvolatile.
Read/write-Data blocks
can be read and written to by the user program.
FS section only: To ensure that the start-up behaviour of the
programmable safety and control system always remains the
same, a copy of each read/write data block is saved in the
program memory, containing the values entered during
programming. This copy is used to automatically pre-assign the
read/write data blocks when the FS user program is started.
The values from the copy of the read/write data block are also
used if the FS section is switched to a STOP condition on
account of an error and is then restarted.
Data that is written to the DBs by the user program is nonretentive.
ST section only: When the program is started with a general
reset, all the DBs in the ST section, with the exception of
DB009, read in the values that were entered when
programming in the DB editor. DB009 retains the values that
were entered in previous program cycles. Please note that if the
general reset OB is present (OB022) or if the Operate PSS
without battery option has been selected when programming
the PSS in the system softwares PSS Configurator, a general
reset will be triggered each time the ST section is started.
74

If the ST section is started without a general reset, the values


entered in the DBs in previous program cycles will be retained.
DBs in the ST section can therefore be used for non-volatile
data storage.
Remanent data blocks (FS section only)
can be read and written to. In contrast to the data in the read/
write DBs, data in the remanent DBs is retained when the FS
user program is started; it is only reset in certain circumstances.
Remanent DBs can be used, for example, if the user program is
to establish certain values during commissioning and, after
commissioning, these values are to be used each time the PSS
is started.
Remanent data blocks are supported from FS operating system
version 65 and PSS WIN-PRO Version 1.8.0. They can only be
used if the PSS contains a battery.
Values are pre-assigned to the remanent data blocks during
programming. The system operates with these values once the
user program has been downloaded to the programmable
safety and control system; the values can also be overwritten
by the user program. If the user program is stopped and
restarted, it continues working with the amended values.
To ensure that the remanent data blocks can be restored to
their original status, a copy is made of every remanent data
block as soon as the user program is downloaded to the
programmable safety and control system. After a reset, the
values from this copy are pre-assigned to the remanent data
blocks.
The reset can be triggered manually by selecting Reset
remanent DBs from the PSS menu in PSS WIN-PRO or by
setting the FS selector switch from STOP to RUN with the error
stack button pressed.
After a manual reset, message F-20, error number 31 is
displayed and flag M113.08 is set.
A reset is performed automatically if an error is detected within
the remanent data blocks as the FS section switches from
STOP to RUN.
Potential error sources:
- Power failure or power switched off
- Supply interruptions
- Scan time exceeded (error F-0C)
If the error occurs at the precise moment in which the user
program is writing data to the remanent DBs, the remanent DBs
will be reset the next time the programmable safety and control
system is started. If the error occurs after the data has been
written, the data will be retained. However it is important to note
that processing of the user program will be aborted at any point
in the cycle. If there are any remaining write operations to
remanent blocks programmed between this point and the end of
the cycle, these will not be carried out. The data in the
remanent DBs will not have the status that it would have had at
75

the end of the cycle. After an automatic reset, message F-20,


error number 32 is displayed and flag M113.08 is set.
You can react to the reset in the user program by polling the
flag, e.g. in the start-up organisation block (OB120), and
programming the desired reaction.
Flag M113.08 remains set until it is reset using SB255, FUNK =
50. Provided the flag is set, the remanent DBs will be reset
each time the PSS is cold/warm started. The flag is non-volatile.
If a new user program is downloaded into the programmable
safety and control system and this program contains the same
remanent data blocks as the previous user program (quantity of
DBs, DB numbers and length of DBs must be identical, content
may vary), the current values on the old DBs are not
automatically overwritten. A prompt will appear in PSS WINPRO, asking whether the values are to be overwritten. If the
values are not overwritten, the programmable safety and control
system will start up with the old values when it is cold/warm
started.
If the remanent DBs on the new user program are not identical
to those on the old program, the remanent data blocks on the
programmable safety and control system must be reset before
downloading. PSS WIN-PRO performs the reset after approval
from the user.
If the user program is stopped via the Stop program operation
or a programming error occurs (error F-21 to F-28), processing
of the user program will be aborted within the cycle and the
PSS will switch to a STOP condition. If there are any remaining
write operations to remanent blocks programmed between this
point and the end of the cycle, these will not be carried out. The
data in the remanent DBs will not have the status that it would
have had at the end of the cycle.
The FS program may contain a maximum of 10 remanent DBs
with a maximum total of 3072 data words.
If remanent DBs are used, an ST block run time of at least 5 ms
must be set.

76

Please note:
All blocks are able to access data blocks. Read only data
blocks can only be read; it is possible to read and write to
Read/write data blocks.
Each DB may be 1024 words in length (DW0000 ... DW1023).
The two bytes within a data word can also be addressed
separately:
- DR0000 ... 1023 for the right data byte (bit 0 ... 7)
- DL0000 ... 1023 for the left data byte (bit 8 ... 15)
Data word formats:
- H: Hexadecimal display (range: 0000 ... FFFF)
- M: Bit state (16 Bit)
- F: 16 bit fixed point number (range: -32768 ... 32767)
- Y: 2 byte constant (range: 0 ... 255 per byte)
- C: 2 IBM ASCII characters
DB000 ... 255 in both the FS and ST section, of which the
following DBs are reserved for system data blocks.
System data blocks for the FS section:
- DB000: Reserved for ST section
- DB001: Result from operating system calls (read-only)
- DB002: Configuration data block (read-only)
- DB003: Call-up parameters from operating system calls
- DB004 ... DB009: Reserved
System data blocks for the ST section:
- DB000: General data (read-only)
- DB001 ... DB003: Reserved for communication with the FS
section
- DB004: General data
- DB005: Start addresses for addressable modules
- DB006: Configuration of user interface
- DB007: Send buffer for user interface
- DB008: Receive buffer for user interface
- DB009: Remanent data block, contents retained after a
general reset
Before accessing a data word, you will need to select the data
block, using the Select data block operation.
Within a block, a selected data block remains valid until a new
data block is selected.
The ST section has read-only access to data blocks in the FS
section via SB254, function 36.

77

Addressing

7.2

7.1

Absolute addresses

With direct addressing, an operands absolute address is stated


directly within the operation.
Example for IL:
L
MW088.00 // Load flag word MW088.00

On most operands (e.g. XW, DB, ...), the address is a number;


only on inputs, outputs, periphery access and flags does the
address consist of two numbers separated by a decimal point.
On flags, the number before the decimal point is the flag number;
on inputs, outputs and periphery access it is the slot number. The
number after the decimal point is the bit number.
When addressing words or bytes, the bit number indicates the
least significant bit (LSB). Bytes can only start with bit numbers 0,
8, 16 or 24 and words with bit numbers 0 and 16 (words starting
with 8 or 24 are permitted, but require more access time than
words starting with 0 or 16).
Examples
E
02.17:
EB
02.08:
AW
03.00:
MB
75.08:
Z
60:

Direct addressing

Input bit 17 on slot 2


Input byte (bit number 8 ... 15) on slot 2
Output word (bit number 0 ... 15) on slot 3
Flag byte (bit number 8 ... 15) from flag 75
Counter 60

The table on the front cover flap shows all the operands for the FS
section, with their address ranges; the table on the back cover
flap shows those of the ST section.
With inputs, outputs and periphery access please note the
following:
The addresses that can be addressed will vary from PSS to
PSS, and on modular PSS systems will depend on the
hardware configuration; details are given in the operating
manuals for the programmable safety system.
It will not be possible to access a word with the address x.24 if x
is the number of the last slot on the programmable safety
system.
On compact programmable safety systems, not all of a slots
inputs/outputs are always available on the screw terminals. An
error occurs when such an output is set. If you wish to address
an output byte/word containing such an output, you will need to
mask the output byte/word in such a way that 0 is written to
this output.
Inputs that are not available are read with 0.

78

79

7.3

Indirect addressing

With indirect addressing, a flag word is stated instead of the


operand address. This flag word contains the current address and
is called the address indicator. Indirect addressing enables an
address to be changed while the program is being processed.
Flag words MW114.00 and MW114.16 are available as address
indicators for indirect addressing. On PSS with an operating
system version 43, flags in the range 00 - 63 in the ST section
and flags in the range 64 - 99 and 130 - 255 in the FS section can
also be used as address indicators.
The configuration of the address indicator depends on the
operands that are to be addressed; see table.
Operand type
E, EB, EW
A, AB, AW
M, MB, MW
Z, ZW
T
DW, DL, DR
DB
XW

Address indicator
Bit 15 ... 8
Bit 7 0
Slot number
Bit number 0 ... 31
Slot number
Bit number 0 ... 31
Flag number
Bit number 0 ... 31
Any
Counter number
Time base
Timer number
Data word number
Data block number
Number of the word in the XW process image

7.4

Set addressing

Set addressing can only be used in function blocks and standard


function blocks that have parameters.
When programming, the parameters are simply used as
operands, with an = placed in front. Make sure that the
parameter type is permitted for that operation.
Example for IL:
An FB has the input parameter EING. This parameter is to be
loaded into the FBs instruction.
...
L =EING
...

7.5

Free addressing

Modules that can process more than 32 Bits are called word
modules. The words are addressed using free addressing.
INFORMATION
Access to word modules is not permitted in the startup OB.

7.5.1 Free addressing in the FS section


Examples:
Indirect addressing using the address indicator MW114.16.
Address
direct
E1.6
AB2.8
MW64.00
Z88
ZW88
T67.1

Address
indirect
E(114.16)
AB(114.16)
MW(114.16)
Z(114.16)
ZW(114.16)
T(114.16)

DL100
DB199
XW040

DL(114.16)
DB(114.16)
XW(114.16)

80

Contents of
MB114.24
MB114.16
1
6
2
8
64
0
Any
88
Any
88
1
67
Contents of MW114.16
100
199
40

An area of 8 words is reserved in the XW process image for each


slot.
Slot
0
1
2
3
4
5
6
7
8

Operand
XW0 ... XW7
XW8 ... XW15
XW16 ... XW23
XW24 ... XW31
XW32 ... XW39
XW40 ... XW47
XW48 ... XW55
XW56 ... XW63
XW64 ... XW71

81

Example:
There is a word module on slot 3. The 3rd and 4th words are to be
addressed.

Operating system call SB254, FUNK = 180 has been available


since FS operating system version 38 to enable programming to
be largely independent of the start address

Slot 3 corresponds to words XW24 XW31 (see table above).


The 3rd word is XW26 and the 4th word XW27.

7.5.2 Free addressing in the ST section


The addresses that a word module will occupy are determined in
DB005.
Contents of DB05:
Data word
DW0000
DW0001
...
DW0023

Start address for module on


Slot 0
Slot 1
...
Slot 23

Address requirements:
The start address is the address through which the first input or
output on a module is addressed. The second input or output
contains the address = start address + 1 etc.
The start address must be an integer multiple of the number of
addresses that the module requires.
Examples:
- Module with 8 inputs (8 addresses)
Permitted start addresses: 0, 8, 16, 24, 32, .... (decimal)
- Module with 8 inputs and 8 outputs (16 addresses)
Permitted start addresses: 0, 16, 32, 48, ... (decimal)
Permitted address range: 0 ... 16383 (decimal)
The modules address ranges are not permitted to overlap.

Example:
Slot 7 contains a word module with 8 inputs.
The start address must be entered in DB005 in DW0007. The
start address must be divisible by 8, for example, 4096 is possible
(decimal). The input addresses are:
XW4096
1st input
XW4097
2nd input
...
...

82

83

84

Type

Address range Description

Write

Read

Direct

Set

Indirect

AcAddrescess sing

00.00 - 23.31 2) Input bit (PII)


32.00 - 95.31 3)
132.00 - 195.316)

EB

00.00 - 23.24 2) Input byte (PII)


32.00 - 95.24 3)
132.00 - 195.246)

EW

00.00 - 23.16 2) Input word (PII)


32.00 - 95.16 3)
132.00 - 195.166)

00.00 - 23.31 2) Output bit (PIO)


32.00 - 95.31 3)
132.00 - 195.316)

AB

00.00 - 23.24 2) Output byte (PIO)


32.00 - 95.24 3)
132.00 - 195.246)

AW

00.00 - 23.16 2) Output word (PIO)


32.00 - 95.16 3)
132.00 - 195.166)

PB

00.00 - 23.24 2) Periphery byte (periphery


32.00 - 95.24 3) access)
132.00 - 195.246)

PW

00.00 - 23.16 2) Periphery word (periphery


32.00 - 95.16 3) access)
132.00 - 195.166)

DB

000, 004 - 009

System data block


(DB000 is read-only)

DB

010 - 255

Data block

DL

0000 - 1023

Data byte left


(bit 8 -15)

DR

0000 - 1023

Data byte right


(bit 0 - 7)

DW

0000 - 1023

Data word (bit 0 - 15)

FB

001 - 255

Function block

KB

0-255

Constant Byte

KC

ASCII
character set

Constant
Character (2 characters)

KF

-32768...+32767 Constant
Fixed point number

KH

0000 - FFFF

Constant
Hexadecimal figure

KM

16 Bit

Constant Bit state

KY

0 - 255 per byte Constant 2 Bytes

000.00 - 063.31 Flags


114.00 - 114.314)

064.00 - 099.31 Flags (FS)


130.00 - 255.314)

85

Overview of Operands: ST

064.00 - 099.16 Flag word (FS)


130.00 - 255.164)

100.00 - 104.31 Communication flag in bit


105.00 - 109.314) mode

113.00

Status flag FS RUN/STOP


(RUN = 1)

113.01

Status flag FS error/no


error (error = 1)

113.02

Status flag FS STOP


command (FS halted via
STOP command = 1)

113.03

x x1)

Warm start FS STOP >


RUN (after warm start 1,
active for one cycle only)

MB

100.00 - 104.24 Communication flag in byte x


105.00 - 109.244) mode

x x1)

113.04

MW

100.00 - 104.16 Communication flag in


105.00 - 109.164) word mode

x x1)

Cold start FS OFF > RUN


(after cold start 1, active
for one cycle only)

113.05

110.00

FALSE flag (RLO-0)

110.01

TRUE flag (RLO-1)

Status flag SafetyBUS p 0


RUN/STOP (RUN = 1), only
on PSS with an FS operating
system version > 35

111.00

Arithmetic carry flag

113.06

111.01

Arithmetic overflow flag

111.02

Arithmetic zero flag

Status flag SafetyBUS p 1


RUN/STOP (RUN = 1), only
on PSS with an FS operating
system version > 47

M
M

111.03

Arithmetic sign flag

113.08

112.00

Status flag ST RUN/STOP


(RUN = 1)

112.01

Status flag ST no error/


error (error = 1)

112.02

Status flag ST STOP


command (ST halted via
STOP command = 1)

Reset of the remanent DBs in


the FS section (after reset 1,
flag must be reset through
SB255, FUNK = 50), only on
PSS with FS operating
system version > 65

MB

114.00, 114.08, Flag byte, indirect


114.16, 114.24 addressing5)

x x4)

112.03

Warm start ST STOP >


RUN (after warm start 1,
active for one cycle only)

MW

114.00, 114.16

x x4)

112.04

Cold start ST OFF > RUN


(after cold start 1, active
for one cycle only)

115.00 - 115.31 Deactivation flag in bit


mode (FS, selective
shutdown)

MB

112.05

ST general reset performed


(after general reset 1, active
for one cycle only)

115.00 - 115.24 Deactivation flag in byte


mode (FS, selective
shutdown)

MW

115.00 - 115.16 Deactivation flag in word


mode (FS, selective
shutdown)

116.00 - 116.31 Status flag I/O-Groups in


bit mode (FS, SafetyBUS p
0, I/O-Group in RUN = 1)

1)
2)

3)

4)
5)

6)

Only on 3rd generation PSS


Depending on PSS and hardware (ST section has read-only
access to inputs/outputs in the FS section)
Only on PSS with SafetyBUS p 0 (read-only access from ST
section)
Only on PSS with an FS operating system version 43
On PSS with an FS operating system version 43, also flags in
the range 00 - 63
Only on PSS with FS operating system version 47 and
SafetyBUS p 1 (read-only access from ST section)

86

Write

Flag word, indirect


addressing5)

Indirect

MW

Set

000.00 - 063.16 Flag word


114.00 - 114.164)

Direct

MW

Read

064.00 - 099.24 Flag byte (FS)


130.00 - 255.244)

AcAddrescess sing

Indirect

MB

Address range Description

Set

000.00 - 063.24 Flag byte


114.00 - 114.244)

Type

Direct

MB

AcAddrescess sing

Read

Address range Description

Write

Type

Continued

87

Read

Direct

Set

AcAddrescess sing

MB

116.00 - 116.24 Status flag I/O-Groups in


byte mode (FS,
SafetyBUS p 0)

MW

116.00 - 116.16 Status flag I/O-Groups in


word mode (FS,
SafetyBUS p 0)

117.00 - 117.31 Status flag I/O-Groups in


bit mode (FS, SafetyBUS p 1,
I/O-Group in RUN = 1)

MB

117.00 - 117.24 Status flag I/O-Groups in


byte mode (FS,
SafetyBUS p 1)

MW

117.00 - 117.16 Status flag I/O-Groups in


word mode (FS,
SafetyBUS p 1)

OB

001, 019, 020, Organisation block


023, 0244), 025, (cannot be called up)
027, 028, 029

PB

001 - 255

Program block

SB

001 - 255

Standard function block

000 - 063

Timer

x x

064 - 127

Timer (FS)

x x

XW

00000-16383

Word from a word module

x x

000 - 063

Counter

x x

064 - 127

Counter (FS)

x x

ZW

000 - 063

Counter status (fixed point


number)

x x

ZW

064 - 127

Counter status (FS)

x x

88

Indirect

Address range Description

Write

Type

x
x

20 376-07, 2008-12 Impreso en Alemania

Pilz GmbH & Co.


Felix-Wankel-Strae 2, 73760 Ostfildern, Germany
Telephone +49 7 11 34 09-0, Telefax +49 7 11 34 09-1 33

Das könnte Ihnen auch gefallen