Back to tutorials
PLC Instructions

PLC Programming Comparison Instructions – GRT | Greater Than

Vladimir Romanov
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

Related Tutorials


PowerFlex 525 Parameter, Input and Output Programming Tutorial in RSLogix Studio 5000

The PowerFlex 525 series of Variable Frequency Drives from Allen Bradley is highly utilized and respected within the automation field. The drives are compact, versatile and easy to use. We’ve written an extensive tutorial on how to get started with these drives in a previous tutorial; it covers how to initialize the drive, connect it to an EtherNet/IP based PLC and how to set the right parameters. In this tutorial, we’re looking to expand on the concepts and demonstrate a way to access and utilize the multiple Input and Output options available on the drive. The reason you may want to utilize the IO is to save money on purchasing external components, integrate instrumentation into your drive and save floor space, wiring and cost. We’ve seen the need to integrate closely related sensors into a PowerFlex 525 application; this would be the right way to do it.

Vladimir Romanov

Publishing MQTT Data Using Opto 22 groov EPIC PAC

MQTT is a communication protocol that has taken off in the IIoT community. It’s a light-weight, efficient protocol that works through a publisher / broker / subscriber model. It creates an easy way for field devices to communicate and retrieve data from a single location. In this article, we’ll go over MQTT and dive into an example of how you can publish data using a groov EPIC PAC and retrieve the data using a MQTT client.

Vladimir Romanov

HMI Design - Best Practices for Effective HMI Screens

HMI Design is the practice of building HMI screens that are intuitive to the end user, pleasing to the eye and are efficient to operate. As control systems within manufacturing are migrated from traditional push button designs to primarily operated from HMI displays, HMI Design has become trivial to any new installation.Although there is a wide range of HMI based systems, the basic principles of good design remain the same. Different industries may dictate different patterns of layout for their systems, but the good practices remain.

Vladimir Romanov