1. Compared greater instructions
1. Compared greater instructions
1.1. Instruction Description
The greater than instruction is used to compare the size of two values. If the data above is greater than 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 word | LDW>, AW>, ORW> | Compare two single word integers to see if the first one is greater than the last one |
| Double word | LDD>, AD>, ORD> | Compare two double word integers to see if the front is greater than the back |
| Floating point | LDF>, AF>, ORF> | Compare two floating point numbers to see if the front is greater than the back |
1.2. The valid operands of the instruction
1.2.1. Single character types(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 word 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 number 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' greater 'than D1
ORW>D4 D5//Compare whether D4 is' greater than 'D5, and perform an' OR 'operation on the comparison result and the stack top value
AW>D2 D3//Compare whether D2 is' greater than 'D3, 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' greater 'than D8D9
ORD>D14 D16//Compare whether D14D15 is' greater than 'D16D17, and perform an' OR 'operation on the comparison result and the stack top value
AD>D10 D12//Compare D10D11 to see if it is' greater than 'D12D13, and perform an' AND 'operation on the comparison result and the stack top value
LDF>D18 D20//Load floating-point numbers D18D19 and D20D21, and compare whether floating-point number D18D19 is' greater 'than floating-point number D20D21
ORF>D26 D28//Compare whether floating-point number D26D27 is' greater than 'floating-point number D28D29, and perform an' OR 'operation on the comparison result and the top of the stack value
AF>D22 D24//Compare whether floating-point number D22D23 is' greater than 'floating-point number D24D25, 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 G1
图2 G2