Greater Than (GT)
This table lists the controllers and applications that support this instruction.
Architecture | Standard applications | Safety applications |
---|---|---|
CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers | Yes | No |
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers | Yes | Yes |
When enabled, the Greater Than (GT) instruction and the operator > tests whether Source A is greater than Source B.
TIP:
In Logix Designer version 36, the mnemonic for this instruction changed from GRT to GT.
Available Languages
Ladder Diagram
Function Block Diagram
Function Block Diagram supports these elements:
FBD Block
FBD Function
TIP:
FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
Structured Text
This instruction is not available in structured text.
TIP:
Use the operator > with an expression to achieve the same result. Refer to Structured Text Syntax for more information on the syntax of expressions and assignments within structured text.
Operands
There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions.
Ladder Diagram
Numeric Comparison
Operand | Data Type CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers | Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers | Format | Description |
---|---|---|---|---|
Source A | SINT INT DINT REAL | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT | immediate tag | Value to test against Source B |
Source B | SINT INT DINT REAL | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT | immediate tag | Value to test against Source A |
TIP:
See Time and date data types for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types.
String Comparison
TIP:
Immediate string literals are only applicable to the CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers.
Operand | Data Type | Format | Description |
---|---|---|---|
Source A | String type | immediate literal value tag | String to test against Source B |
Source B | String type | immediate literal value tag | String to test against Source A |
Function Block Diagram
FBD Block
Operand | Data Type | Format | Description |
---|---|---|---|
GT | FBD_COMPARE | tag | GT structure |
FBD_COMPARE Structure
Input Members | Data Type | Description |
---|---|---|
EnableIn | BOOL | Enable input. If false, the instruction does not execute and outputs are not updated.
Default is true. |
SourceA | REAL | Value to test against SourceB |
SourceB | REAL | Value to test against SourceA |
Output Members | Data Type | Description |
---|---|---|
EnableOut | BOOL | Indicates if the instruction is enabled. |
Dest | BOOL | Set to true when SourceA is greater than SourceB. Cleared to false when SourceA is not greater than SourceB. |
FBD Function
TIP:
FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
Input Operands (Left Pins) | Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers | Description |
---|---|---|
SourceA (top) | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | Value to test against SourceB |
SourceB (bottom) | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | Value to test against SourceA |
Output Operand (Right Pin) | Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers | Description |
---|---|---|
Dest | BOOL | Set to true when SourceA is greater than SourceB. Cleared to false when SourceA is not greater than SourceB. |
See FBD Functions.
Affects Math Status Flags
No
Major/Minor Faults
See GT String Compare Flow Chart for faults.
See Index Through Arrays for array-indexing faults.
Execution
Ladder Diagram
Condition/State | Action Taken |
---|---|
Prescan | N/A |
Rung-condition-in is false | Set Rung-condition-out to Rung-condition-in |
Rung-condition-in is true | Numeric compare: If Source A and Source B are not NANs and Source A is greater than Source B. Set Rung-condition-out to true else Clear Rung-condition-out to false. |
String compare: If output is false Clear Rung-condition-out to false else
Set Rung-condition-out to true | |
Postscan | N/A |
Function Block Diagram
FBD Block
Condition/State | Action Taken |
---|---|
Prescan | N/A |
EnableIn is false | Set EnableOut to EnableIn |
EnableIn is true | Numeric compare: Set EnableOut to EnableIn If SourceA and SourceB are not NANs and SourceA is greater than SourceB. Set Dest to true else Clear Dest to false. |
Instruction first run | N/A |
Instruction first scan | N/A |
Postscan | N/A |
FBD Function
TIP:
FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
Condition/State | Action Taken |
---|---|
Prescan | N/A |
Normal Scan | Numeric compare: If SourceA and SourceB are not NANs and SourceA is greater than SourceB. Set Dest to true else Clear Dest to false. |
Instruction first run | N/A |
Instruction first scan | N/A |
Postscan | N/A |
GT String Compare Flow Chart
SourceA.LEN and SourceB.LEN are handled as unsigned values.
Example
Ladder Diagram
Function Block Diagram
FBD Block
FBD Function
Structured Text
if value_1 > value_2 then
light_1 := 1;
else
light_1 := 0;
end_if;
if value_3 > ’I am EQUAL’ then
light_2 := 1;
else
light_2 := 0;
end_if;
Provide Feedback