Back to tutorials

PLC Programming Comparison Instructions – GRT | Greater Than

Vladimir Romanov
September 12, 2018
Table of Contents


The GRT, also known as the Greater Than, is an instruction which compares two operands and evaluates if the value stored in “Source A” is greater than the value stored in “Source B”. If that’s the case, the instruction will evaluate to TRUE and allow the rest of the rung to execute. The GRT instruction may take integers, floats or constants as operands.

A typical use for this instruction would be a lower limit of a temperature sensor. Should the limit value be greater than the current temperature, the programmer will know immediately that there’s an issue.

This instruction is very commonly used within a ladder logic environment as it’s one of the simplest ways to compare two distinct values against each other.

Example & Usage of GRT

Here’s a real-world scenario of a GRT instruction:

  1. A Micrologix 1100 Allen Bradley PLC is used to control a process.
  2. A GRT  instruction is used to compare a Float F8:12 to a Float F8:13.
  3. The Float F8:12 is currently set to “0” and the Float F8:13 is set to “0”.
  4. This GRT instruction evaluates to FALSE since the value of F8:12 is NOT Greater Than the value in F8:13.
  5. Note: The logic displays the boolean B3:1/0 as energized due to the fact that it’s used elsewhere in the logic. It is not being energized by this rung.
  6. A GRT instruction is used to compare an Integer N7:0 to the Integer N7:1.
  7. The Integer N7:0 is currently set to “564” while the Integer N7:1 is set to “6”.
  8. This GRT instruction evaluates to TRUE since N7:0 is Greater Than N7:1.
  9. A TON instruction is used to run a continuous timer T4:3 loop 2 seconds (200 x 0.01 = 2000 msec.)
  10. A GRT instruction is used to compare the value of the accumulated (.ACC) value of Timer T4:3 to the integer N7:3.
  11. The GRT instruction will evaluate to FALSE during the first half of the timer because N7:3 is set to 100 (100 x 0.01 = 1000 = 1/2 of the timer).
  12. The GRT instruction will evaluate to TRUE during the second half of the timer because N7:3 is set to 100 (100 x 0.01 = 1000 = 1/2 of the timer).

Programming example in RSLogix 500:



We have two GRT instructions used on a set of floats and integers in the first two examples. The first instruction will look at the two operands and evaluate to FALSE because one is not greater than the other. It’s important to point out that the GRT instruction will evaluate to FLASE should the operands be equal to one another. The second instruction is similar to the first one but is used on a set of two integers. These are exactly the same integers and values we’ve observed in the LES Instruction tutorial. The instruction will evaluate to true since the value stored in “Source A” is Greater Than the value stored in “Source B”.

Just like in the tutorial on LES, we have a timer TON instruction which is counting from 0 to 2000 milliseconds. Based on this timer, we are toggling the bit B3:1/2. This is accomplished by comparing the Timer T4:3.ACC value to the integer N7:3. Since the integer is set to 100, the boolean B3:1/2 will be OFF during the first second and ON during the last second of the timer.

Data Types Allowed for GRT

The GRT can be used to compare two values of identical types. These value can be INTs, DINTs, or FLOATs.

  • Integer – You may specify each operand to be of “Integer” type.
  • Float – You may specify each operand to be of “Float” or “Real” type.

Important Notes

  • Note 1 – Both operands will be evaluated within the GRT instruction is being scanned. In an instance where the value is changed in other locations for only a brief duration, the GRT comparison may result in unforeseen outcomes.
  • Note 2 – When working with constants, RSLogix 500 will not allow the user to use the constant in the “Operand A” field. The constant must be specified within “Operand B”. This limitation is not present in all software packages.
  • Note 3 – The user may not specify a comparison of two constants within RSLogix 500. In other words, you may not use the GRT instruction with “Operand A” set to 7 and “Operand B” set to 20. This case will always evaluate to FALSE which should not be used.

Video Tutorial

Back to tutorials

Got a question or comment?

Related Tutorials


Opto 22 groov RIO Getting Started

The groov RIO module from Opto 22 has been released only a few months ago. The groov RIO is a feature packed piece of hardware that is easy to install, configure and deploy for many different field applications. The module comes pre-loaded with an array of software tools used across the industry and is ready to hit the floor running out of the box. Furthermore, the module is equipped with user configurable input and output nodes that have the capability unlike anything else on the market.

August 2, 2020
Vladimir Romanov

Micro800 PLC Programming Getting Started

The Micro800 Control Systems by Rockwell Automation provide a cost effective solution for small to medium automation systems. The controllers within this family are typically used on stand alone machines or small process applications. The family offers five distinct controller types that are further customizable through add-on modules: Micro810, Micro820, Micro830, Micro850 and Micro870.Micro800 Programmable Logic Controllers Getting StartedUnlike the other Rockwell Automation controllers, this line of PLCs is programmed through a dedicated software: Connected Components Workbench. From within this tool, the programmer can flash the firmware, load the program and monitor the state of the controller. Furthermore, Connected Components Workbench (CCW) is often used to program other non-PLC Rockwell Automation devices such as Variable Frequency Drives (VFDs) and certain Safety Relays.

July 26, 2020
Vladimir Romanov

An Introduction to DeviceNet Industrial Networks

In this tutorial you will learn about the DeviceNet industrial network, go over a basic offline configuration, and explore some advanced features.

July 24, 2020
Jacques Venter