11 Contact comparison

Last modified by Jim(Forgotten) on 2025/04/11 09:15

Signed 16-bit contact comparison instruction

LD , AND , OR 

The BIN 16-bit data of the device specified in (s1) and the BIN 16-bit data of the device specified in (s2) are compared by normal open contact processing.

LD◻: Normally open contact comparison instruction

AND◻: Normally open contact series connection comparison instruction

OR◻: Normally open contact parallel connection comparison instruction

Ladder diagram

07-5 Basic instructions_html_63210db6b7e1512f.png

(You can enter "=", "<>", ">", "<", ">=", "<=" in ◻)

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)Comparison data or device storing comparison data-32768 to 32767Signed BIN 16 bitANY16_S
(s2)Comparison data or device storing comparison data-32768 to 32767Signed BIN 16 bitANY16_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
LD=s1, s2 
LD>s1, s2 
LD<s1, s2 
LD>=s1, s2 
LD<=s1, s2 
LD<>s1, s2 
AND=s1, s2 
AND>s1, s2 
AND<s1, s2 
AND>=s1, s2 
AND<=s1, s2 
AND<>s1, s2 
OR=s1, s2 
OR>s1, s2 
OR<s1, s2 
OR>=s1, s2 
OR<=s1, s2 
OR<>s1, s2 

Features

The BIN 16-bit data of the device specified in (s1) and the BIN 16-bit data of the device specified in (s2) are compared by normal open contact processing.

The comparison operation result of each instruction is shown below.

Instruction SignConditionComparison operation resultInstruction SignConditionComparison operation result
=(s1)=(s2)On state=(s1)≠(s2)Non-conduction state
<>(s1)≠(s2)<>(s1)=(s2)
>(s1)>(s2)>(s1)≤(s2)
<(s1)<(s2)<(s1)≥(s2)
>=(s1)≥(s2)>=(s1)<(s2)
<=(s1)≤(s2)<=(s1)>(s2)

Error code

Error codeContent
4085H(s) read address exceeds the device range

Example

(1) LD◻ instruction:

07-5 Basic instructions_html_1309199eccc7134.png

When the current value of counter C10 is 200, Y10 is set

When the content of D200 is above -29, and X1 is ON, Y11 is set

(2) AND◻ instruction:

07-5 Basic instructions_html_1c966f74b0bd808e.png

When X0 is ON, or when the current value of counter C10 is 200, Y10 is set

When X1 is OFF, and the content of data counter D0 is not -10, Y11 is set

 

(3) OR◻ instruction:

07-5 Basic instructions_html_8b000809015ea436.png

When X1 is ON, or when the current value of counter C10 is 200, Y0 is set

When X2 and M30 are ON, or the content of register D100 is K10000 and above, M60 is set

Signed 32-bit contact comparison instruction

LDD , ANDD , ORD 

The BIN 32-bit data of the device specified in (s1) and the BIN 32-bit data of the device specified in (s2) are compared by normal open contact processing.

LDD◻: Normally open contact comparison command

ANDD◻: Normally open contact series link comparison instruction

ORD◻: Normally open contact parallel link comparison instruction

Ladder diagram

07-5 Basic instructions_html_63210db6b7e1512f.png

“=”, “<>”, “>”, “<”, “>=”, “<=” can be input in “◻”

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)Comparison data or device storing comparison data-2147483648 to 2147483647Signed BIN 32 bitANY32_S
(s2)Comparison data or device storing comparison data-2147483648 to 2147483647Signed BIN 32 bitANY32_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
LDD=s1, s2 
LDD>s1, s2 
LDD<s1, s2 
LDD>=s1, s2 
LDD<=s1, s2 
LDD<>s1, s2 
ANDD=s1, s2 
ANDD>s1, s2 
ANDD<s1, s2 
ANDD>=s1, s2 
ANDD<=s1, s2 
ANDD<>s1, s2 
ORD=s1, s2 
ORD>s1, s2 
ORD<s1, s2 
ORD>=s1, s2 
ORD<=s1, s2 
ORD<>s1, s2 

Features

The BIN 32-bit data of the device specified in (s1) and the BIN 32-bit data of the device specified in (s2) are compared by normal open contact processing.

The comparison operation result of each instruction is shown below.

Instruction SignConditionComparison operation resultInstruction SignConditionComparison operation result
=(s1)=(s2)On state=(s1)≠(s2)Non-conduction state
<>(s1)≠(s2)<>(s1)=(s2)
>(s1)>(s2)>(s1)≤(s2)
<(s1)<(s2)<(s1)≥(s2)
>=(s1)≥(s2)>=(s1)<(s2)
<=(s1)≤(s2)<=(s1)>(s2)

Error code

Error codeContent
4085H(S) read address exceeds the device range

Example

(1) LDD◻ instruction:

07-5 Basic instructions_html_8acf0d489297c561.png

When the data of LC10 is 200000, Y10 is set, otherwise Y10 is reset.

When the 32-bit data composed of D201 and D200 exceeds -5000, and X1 is ON, Y11 is turned ON.

(2) ANDD◻ instruction:

07-5 Basic instructions_html_38be93eec0ced6c.png

When X0 is ON and the value of LC10 is 200000, Y10 is set, otherwise it is reset.

When X1 is OFF and the 32-bit data composed of D1 and D0 is not equal to K-50000, Y11 is set.

(3) ORD◻ instruction:

07-5 Basic instructions_html_8ebfc7b0562cf370.png

When X1 is ON, or the data of LC10 is equal to the data of LC10 is equal to 200000, Y0 is set.

When X2 and M30 are set, or the double word data composed of D101 and D100 is greater than or equal to 100000, M60 is set.

Single precision real number contact comparison instruction

LDE , ANDE , ORE 

The single precision real number of the device specified in (s1) and the single precision real number of the device specified in (s2) are compared by normal open contact processing.

LDE◻: Normally open contact comparison command

ANDE◻: Normally open contact series link comparison instruction

ORE◻: Normally open contact parallel link comparison instruction

Ladder diagram

07-5 Basic instructions_html_6ac28f30e24ad296.png

“=”, “<>”, “>”, “<”, “>=”, “<=” can be input in “◻”

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)Comparison data or the device start number storing the comparison data0, 2-126 ≤|(s)|< 2128Single precision real numberANYREAL_32
(s2)Comparison data or the device start number storing the comparison data0, 2-126 ≤|(s)|< 2128Single precision real numberANYREAL_32

Device used

InstructionParameterDevices

Offset modification

Pulse extension

TCDRSDLCHSCE[D]XXP
LDE=s1, s2 
LDE>s1, s2 
LDE<s1, s2 
LDE>=s1, s2 
LDE<=s1, s2 
LDE<>s1, s2 
ANDE=s1, s2 
ANDE>s1, s2 
ANDE<s1, s2 
ANDE>=s1, s2 
ANDE<=s1, s2 
ANDE<>s1, s2 
ORE=s1, s2 
ORD>s1, s2 
ORE<s1, s2 
ORE>=s1, s2 
ORE<=s1, s2 
ORE<>s1, s2 

Features

The single precision real number of the device specified in (s1) and the single precision real number of the device specified in (s2) are compared by normal open contact processing.

The comparison operation result of each instruction is shown below.

Instruction SignConditionComparison operation resultInstruction SignConditionComparison operation result
E=(s1)=(s2)On stateE=(s1)≠(s2)Non-conduction state
E<>(s1)≠(s2)E<>(s1)=(s2)
E>(s1)>(s2)E>(s1)≤(s2)
E<(s1)<(s2)E<(s1)≥(s2)
E>=(s1)≥(s2)E>=(s1)<(s2)
E<=(s1)≤(s2)E<=(s1)>(s2)

Error code

Error codeContent
4084HWhen the content of the specified device by (s1) and (s2) is an irregular number, a non-number, or ±∞
4085HThe read address of (s1) and (s2exceeds the device range

Example

(1) LDE◻ instruction:

07-5 Basic instructions_html_c4c820cf59601493.png

When the real number input in D0 is equal to E1.23, Y10 is ON, otherwise Y10 is OFF.

When the real number in R0 is greater than or equal to the real number in LC0, Y11 is ON, otherwise it is OFF.

If the input in D0, R0, LC0 is not a real number, it will report H4084 error.

(2) ANDE◻ instruction:

07-5 Basic instructions_html_7cdd2117360e179b.png

Only when M0 is ON and D2 real number is not equal to E1.23 and R2 real number is less than real number LC2 , Y12 is ON, otherwise all are OFF.

(3) ORE◻ instruction:

07-5 Basic instructions_html_3eba0bd56176441d.png

When the real number of R4 is less than or equal to the real number of R15, or the real number R6 is equal to the real number R20, Y13 is ON, otherwise Y13 is OFF.

String comparison

LDS、ANDS、 ORS

Compare the string stored after the device number specified in (s1) with the string stored after the device number specified in (s2).

LDS◻: String comparison instruction

ANDS◻: String serial connection comparison instruction

ORS◻: String parallel connection comparison instruction

Ladder diagram

07-5 Basic instructions_html_5fb3b3b70645fef5.png

“=” and “<>” could be entered in “◻”

Content, range and data type

ParameterContentRangeDate typeDate type(label)
(S1)Connection data or the device start number storing the data or the string specified directly-StringANYSTRING_SINGLE
(S1)Connection data or the device start number storing the data or the string specified directly-StringANYSTRING_SINGLE

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSD[D]XXP
LDS=s1、s2 
LDS<>s1、s2 
ANDS=s1、s2 
ANDS<>s1、s2 
ORS=s1、s2 
ORS<>s1、s2 

Features

• Compare the string stored after the device number specified in (s1) with the string stored after the device number specified in (s2).

• The comparison operation result of each instruction is shown below.

Instruction signConditionComparison operation resultInstruction signConditionComparison operation result
=(s1)=(s2)On stat=(s1)≠(s2)Non-conduction state
<>(s1)≠(s2)<>(s1)=(s2)

Error code

Error codeContent
4085HThe read address of (s1) or (s2) exceeds the device range
408AHThe length of the read string of (s1) or (s2) exceeds, and the continuous length of the string exceeds 400 characters.
408BHWhen (s1) or (s2) reading the string, the maximum range of the device is read but 00H is not found as the end.

Example

(1) LDS◻ instruction:

07-5 Basic instructions_html_449a071f61ff5b58.png

(2) ANDS◻ instruction:

07-5 Basic instructions_html_dd6aa995d193bdd2.png

(3) ORS◻ instruction:

07-5 Basic instructions_html_4f8fb7c94f87c58d.png