Condition Code Generation - Siemens S5-100U User Manual

Simatic s5 programmable controller
Hide thumbs Also See for S5-100U:
Table of Contents

Advertisement

S5-100U
8.4

Condition Code Generation

The processor of the programmable controller has the following three condition codes:
CC 0
CC 1
OV (overflow)
The following operations affect the condition codes.
Comparison operations
Arithmetic operations
Shift operations
Some conversion operations
The state of the condition codes represents a condition for the various jump operations.
Condition Code Generation for Comparison Operations
Execution of comparison operations sets condition codes CC 0 and CC 1 (see Table 8-31). The
overflow condition code is not affected. Comparison operations do affect the RLO. When a
comparison is satisfied, the RLO is 1. This allows you to use the "JC" conditional jump operation
after a comparison operation.
Table 8-31. Condition Code Settings for Comparison Operations
Contents of ACCU 2 as
Compared to Contents
of ACCU 1
Equal to
Less than
Greater than
Condition Code Generation for Arithmetic Operations
Execution of arithmetic operations sets all condition codes according to the result of the arithmetic
operation (see Table 8-32).
Table 8-32. Condition Code Settings for Fixed-Point Arithmetic Operations
Result after
Arithmetic Operation
is Executed
< - 32768
- 32768 to - 1
0
+1 to +32767
> +32767
(-) 65536*
*
This number is the result of the calculation -32768 - 32768
EWA 4NEB 812 6120-02
Condition Codes
CC 1
CC 0
0
0
0
1
1
0
Condition Codes
CC 1
CC 0
1
0
0
1
0
0
1
0
0
1
0
0
STEP 5 Operations
Possible
Jump Operations
OV
JZ
JN, JM
JN, JP
Possible
Jump Operations
OV
1
JN, JP, JO
0
JN, JM
0
JZ
0
JN, JP
1
JN, JM, JO
1
JZ, JO
8-69

Advertisement

Table of Contents
loading

Table of Contents