Back to tutorials

PLC Programming Comparison Instructions – LES | Less Than

Vladimir Romanov
September 12, 2018
Table of Contents


The LES, also known as the Less Than, is an instruction used to compare two values against each other. The instruction takes two integers, floats or constants and will return TRUE if the value specified in “Source A” is less than the one in “Source B”. The “Source B” operand must be strictly less than the one specified in “Source A”. In other words, the instruction will return FALSE if they are equal.

This instruction can be used to test for an upper limit for an analog sensor and reliably notify the programmer should the value be exceeded.

In RSLogix 500, you may not compare two constants; this restriction is not present in RSLogix 5000 as well as Studio 5000. This is also the case for all comparison instructions.

Example & Usage of LES

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

  1. A Micrologix 1100 Allen Bradley PLC is used to control a process.
  2. A LES instruction is used to compare a Float F7:10 to a Float F7:11.
  3. The Float F7:10 is currently set to “345.464” and the Float F7:11 is set to “2.15915”.
  4. This LES instruction evaluates to FALSE since the value of F7:10 is NOT Less Than the value in F7:11.
  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 LES 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 LES instruction evaluates to FALSE since N7:0 is NOT Less Than N7:1.
  9. A TON instruction is used to run a continuous timer T4:2 loop 2 seconds (200 x 0.01 = 2000 msec.)
  10. A LES instruction is used to compare the value of the accumulated (.ACC) value of Timer T4:2 to the integer N7:3.
  11. The LES instruction will evaluate to TRUE 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 LES instruction will evaluate to FALSE 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:



The first two examples of the LES instruction are straightforward. We’re comparing two operands to each other and return TRUE if the one specified in “Source A” is less than the one in “Source B”. The first instruction is evaluating two distinct float registers. Since the one specified in “Source A” is NOT less than the one in “Source B”, the instruction returns a FALSE. The same is true for the second LES instruction, but it’s used on a set of integers.

The last example which uses the LES instruction in ladder logic is slightly less obvious. A timer is running in a continuous loop due to the XIO Instruction used on its .DN bit. The setting on the timer causes the loop to repeat every two seconds. The LES instruction below the timer is comparing the accumulated value in the timer to the integer N7:3. Since the integer is set to 100, it causes the instruction to evaluate to TRUE during the first half of the timer.

Data Types Allowed for LES

The LES 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 need to be exactly the same while the rung containing the LES instruction is being scanned. Otherwise, the instruction will evaluate to TRUE. In an instance where the value is changed in other locations for only a brief duration, the LES 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 LES 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