152
Condition Flags
Section 4-14
Using the Condition Flags
The Condition Flags are shared by all of the instructions, so their status may
change often in a single cycle. Be sure to read the Condition Flags immedi-
ately after the execution of instruction, preferably in a branch from the same
execution condition.
Since the Condition Flags are shared by all of the instructions, program oper-
ation can be changed from its expected course by interruption of a single task.
Be sure to consider the effects of interrupts when writing the program. Refer
to
SECTION 2 Programming
of
CS/CJ Series Programming Manual
(W394)
for more details.
The Condition Flags are cleared when the program switches tasks, so the sta-
tus of a Condition Flag cannot be passed to another task. For example the
status of a flag in task 1 cannot be read in task 2.
Carry Flag
P_CY
Turned ON when there is a carry in the result of an arithmetic opera-
tion or a “1” is shifted to the Carry Flag by a Data Shift instruction.
The Carry Flag is part of the result of some Data Shift and Symbol
Math instructions.
Greater Than Flag
P_GT
Turned ON when the first operand of a Comparison Instruction is
greater than the second or a value exceeds a specified range.
Equals Flag
P_EQ
Turned ON when the two operands of a Comparison Instruction are
equal the result of a calculation is 0.
Less Than Flag
P_LT
Turned ON when the first operand of a Comparison Instruction is less
than the second or a value is below a specified range.
Negative Flag
P_N
Turned ON when the most significant bit (sign bit) of a result is ON.
Overflow Flag
P_OF
Turned ON when the result of calculation overflows the capacity of the
result word(s).
Underflow Flag
P_UF
Turned ON when the result of calculation underflows the capacity of
the result word(s).
Greater Than or
Equals Flag
P_GE
Turned ON when the first operand of a Comparison Instruction is
greater than or equal to the second.
Not Equal Flag
P_NE
Turned ON when the two operands of a Comparison Instruction are
not equal.
Less Than or
Equals Flag
P_LE
Turned ON when the first operand of a Comparison Instruction is less
than or equal to the second.
Always ON Flag
P_On
Always ON. (Always 1.)
Always OFF Flag
P_Off
Always OFF. (Always 0.)
Name
Symbol
Function
=
Instruction A
The result from instruction A is
reflected in the Equals Flag.
Instruction B
Instruction
LD
Instruction A
AND
Instruction B
Operand
Condition Flag,
e.g., =
Содержание CP1L - 12-2007
Страница 3: ...iv...
Страница 9: ...x...
Страница 13: ...xiv TABLE OF CONTENTS...
Страница 21: ...xxii...
Страница 33: ...xxxiv Conformance to EC Directives 6...
Страница 65: ...32 Function Blocks Section 1 5...
Страница 428: ...395 Clock Section 6 9...
Страница 429: ...396 Clock Section 6 9...
Страница 523: ...488 Troubleshooting Unit Errors Section 9 4...
Страница 531: ...496 Replacing User serviceable Parts Section 10 2...
Страница 563: ...528 Auxiliary Area Allocations by Function Appendix C...
Страница 611: ...576 Auxiliary Area Allocations by Address Appendix D...
Страница 638: ...603 Connections to Serial Communications Option Boards Appendix F Connecting to Unit...
Страница 639: ...604 Connections to Serial Communications Option Boards Appendix F...
Страница 669: ...634 Index...
Страница 671: ...636 Revision History...