32.18.1.3 Explanation of the EQ Instruction
The EQ instruction is a compare instruction. The EQ instruction
compares S1 with S2 and if the result of the comparison is S1 = S2,
the instruction passes power. Be careful when comparing real
values. For example, if the operand value is 1.99999999999, it is
not equal to 2.00000000000.
When using the EQ instruction, an error will occur if the
variables specified in operands S1 and S2 are not the same type.
Designate the same variable type in all operands S1 and S2.
Refer to the following for specifying a constant.
When operand S1 or S2 is an integer
constant
When entering hexadecimal values in operands
S1 or S2
When 0x (zero and lower case "x") is input, the following values
become hexadecimal values.
When entering float constants in operands S1
or S2
When 0f (zero and lower case "f") is input, the following values
are interpreted as float values.
When entering real constants in operands S1
or S2
When 0r (zero and lower case "r") is input, the following values
are interpreted as real values.
When Comparing Data in a Specified Array
(Integer Variable Array)
Specify the array using Data [0] or Data [N] (N indicates an
integer variable).
When operands S1 and S2 specify the entire array, an error will
occur even if the specified variables are the same type.
Program Example
EQ
Compares integer variables and outputs the result in D1.
-
Data_A and the operation result are compared to
determine whether they are equal. If the result of the EQ
instruction is S1 = S2, the EQ instruction passes power, then the
instruction to the right of the EQ instruction is executed. In the
above diagram, it's the MOV instruction.
|