32.18.6.3 Explanation of the NE Instruction
The NE instruction is a compare instruction. The NE instruction
compares S1 with S2. 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 2.000000000001, it is not equal to 2. When using
the NE 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
NE
Compares integer variables and outputs the result in D1.
-
Data_A and the operation result are compared to
determine whether Data_A is not equal to the operation result. If
the result of the NE instruction is S1 <> S2, the NE
instruction passes power. Then the instruction to the right of the
NE instruction is executed. In the above diagram, it's the MOV
instruction.
|