Omron FQM1-MMA21 I/O Memory, Appendix B, Summary of the Condition Flags, Name, CX-Programmer

Models: FQM1-MMP21 FQM1-MMA21 FQM1-CM001

1 414
Download 414 pages 44.52 Kb
Page 331
Image 331
Summary of the Condition Flags

I/O Memory

Appendix B

The Condition Flags cannot be force-set and force-reset except for the Carry Flag, which can be manipulated with the STC(040) and CLC(041) instructions.

Summary of the Condition Flags

The following table summarizes the functions of the Condition Flags, although the functions of these flags will vary slightly from instruction to instruction. Refer to the description of the instruction for complete details on the operation of the Condition Flags for a particular instruction.

Name

CX-Programmer

Function

 

symbol

 

 

 

 

Error Flag

P_ER

Turned ON when the operand data in an instruction is incorrect (an instruction

 

 

processing error) to indicate that an instruction ended because of an error.

 

 

 

Access Error Flag

P_AER

Turned ON when an Illegal Access Error occurs. The Illegal Access Error indi-

 

 

cates that an instruction attempted to access an area of memory that should not

 

 

be accessed.

 

 

 

Carry Flag

P_CY

Turned ON when there is a carry in the result of an arithmetic operation 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 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 or 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

P_GE

Turned ON when the first operand of a Comparison Instruction is greater than or

Equals Flag

 

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

P_LE

Turned ON when the first operand of a Comparison Instruction is less than or

Equals Flag

 

equal to the second.

 

 

 

Always ON Flag

P_On

Always ON. (Always 1.)

 

 

 

Always OFF Flag

P_Off

Always OFF. (Always 0.)

 

 

 

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 immediately after the execution of instruction, preferably in a branch from the same input condition.

Instruction A

The result from instruction A is

reflected in the Equals Flag.

Condition Flag Example: =

Instruction B

CX-ProgrammerInstruction

LD

Instruction A

AND

Instruction B

Operand

=

Note (1) Since the Condition Flags are shared by all of the instructions, program operation can be changed from its expected course by interruption of a single task. Be sure to consider the effects of Condition Flags when writing the program. Refer to Condition Flags on page 281 for details.

(2)The Condition Flags are cleared when the program switches tasks, so the status of a Condition Flag cannot be passed to another task.

308

Page 331
Image 331
Omron FQM1-MMA21 I/O Memory, Appendix B, Summary of the Condition Flags, Using the Condition Flags, Name, CX-Programmer