1. Compare equal instructions
1. Compare equal instructions
1.1. Instruction description
he equal instruction is used to compare whether two values are equal. If the data above is equal to the data below, the comparison result is true and the contact is connected.
In the instruction table, when 1 is at the top of the stack, the instruction performs load (LD), AND, and OR operations.
You can choose from three types: single character, double character, and floating point
| Type | Instruction | Description |
|---|---|---|
| Single character | LDW=, AW=, ORW= | Compare two single character integers to see if they are equal |
| Double word | LDD=, AD=, ORD= | Compare two double word integers to see if they are equal |
| Floating point | LDF=, AF=, ORF= | Compare two floating point numbers to see if they are equal |
1.2. The valid operands of the instruction
1.2.1. Single character type(LDW=,AW=,ORW=):
| Input/Output | Data Type | operand | Description |
|---|---|---|---|
| IN1 | 16 bit integer | D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) | Input 1 |
| IN2 | 16 bit integer | D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) | Input 2 |
1.2.2. Double character type(LDD=,AD=,ORD=):
| Input/Output | Data Type | operand | Description |
|---|---|---|---|
| IN1 | 32-bit integer | D/CV/K/H/FD, bit composite word (X/Y/M/C/T/S), local variable (LD) | Input 1 |
| IN2 | 32-bit integer | D/CV/K/H/FD, bit composite word (X/Y/M/C/T/S), local variable (LD) | Input 2 |
1.2.3. Floating point types(LDF=,AF=,ORF=):
| Input/Output | Data Type | operand | Description |
|---|---|---|---|
| IN1 | 32-bit real number | D/K/FD, local variable (LF) | Input 1 |
| IN2 | 32-bit real number | D/K/FD, local variable (LF) | Input 2 |
1.3. Example
Command table:
NETWORK 000
LDW=D0 D1//Load D0 and D1, and compare whether D0 is equal to D1
ORW=D4 H0123//Compare whether D4 and H0123 are equal, and perform an OR operation on the comparison result and the top of the stack value
AW=D2 D3//Compare whether D2 and D3 are equal, and perform an AND operation on the comparison result and the stack top value
LDD=D6 D8//Load D6D7 and D8D9, and compare whether D6D7 is equal to D8D9
ORD=D14 K888//Compare D14D15 and K888 to see if they are equal, and perform an OR operation on the comparison result and the top of the stack value
AD=D10V0 D12Z0//Compare whether (D10D11+address offset V0) and (D12D13+address offset Z0) are equal, and perform an 'AND' operation on the comparison result and the top of the stack value
LDF=D18 D20//Load floating-point number D18D19 and floating-point number D20D21, and compare whether floating-point number D18D19 is equal to floating-point number D20D21
ORF=D26 K1.234567//Compare floating-point numbers D26D27 and K1.234567 to see if they are equal, and perform an 'OR' operation on the comparison result and the top of the stack value
AF=D22 D24//Compare floating-point numbers D22D23 and D24D25 to see if they are equal, and perform an 'AND' operation on the comparison result and the top of the stack value
ORB//Perform an 'OR' operation between the top stack value and the current energy flow value
ORB//Perform an 'OR' operation between the top stack value and the current energy flow value
OUT Y000//Output Y000
图1 E1
图2 E2