Back to tutorials

PLC Programming Comparison Instructions – NEQ | Not Equal

Vladimir Romanov
Table of Contents


The NEQ, also known as the Not Equal, instruction is used to compare two values just like the EQU Instruction. However, the key difference is that the NEQ will return TRUE if the values are not equal to each other. In other words, the outcome of this instruction is the absolute opposite of what the EQU will give us.

Just like the EQU, this instruction is critical in the control systems world. It provides an easy way to check whether a certain value is holding the value we expect and act based on the outcome.

The NEQ may operate on the exact same operands as the EQU. In fact; the only difference between the two is that their output state is inverted; just as stated above.

Example & Usage of NEQ

Here’s a real-world scenario of an NEQ instruction:

  1. A Micrologix 1100 Allen Bradley PLC is used to control a process.
  2. An NEQ instruction is used to compare an Integer N7:1 to a constant.
  3. The Integer N7:1 is currently set to “6” and the constant is set to “6”.
  4. This NEQ instruction evaluates to FALSE since the two values are equal.
  5. An NEQ instruction is used to compare an Integer N7:2 to the Integer N7:3.
  6. The Integer N7:2 is currently set to “345” while the Integer N7:3 is set to “38”.
  7. This NEQ instruction evaluates to TRUE since both of these integers are NOT equal.
  8. An NEQ instruction is used to compare a Counter “Accum” Value C5:0.ACC to the Integer N7:4.
  9. The Integer N7:4 is currently set to “0” while the Counter “Accum” Value C5:0.ACC is set to “56”.
  10. This NEQ instruction evaluates to TRUE.

Programming example in RSLogix 500:

NEQ Not Equal RSLogix500


We’re using three different NEQ instructions to demonstrate the capabilities of the instruction. The first instruction will evaluate to FALSE because the two values stored within the “Source A” and “Source B” elements are equal to each other. One is “6” and the other is “6”. The second NEQ instruction will evaluate to TRUE due to the fact that N7:2 and N7:3 values are not the same; one is set to “345” while the other to “38”. The last instruction will also evaluate to TRUE. It demonstrates the fact that you can use the value of a Timer Construct to compare it to a value of a similar type. In this case, both are integers. Since they are “56” and “0” respectively, the NEQ evaluates to TRUE in this case.

Data Types Allowed for NEQ

The NEQ 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 NEQ 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 NEQ 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 NEQ 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


MicroLogix 1100 RSLogix 500 External IO PLC Programming Tutorial

The MicroLogix 1100 PLC is still heavily used in the industry and is one of the most recommended PLCs for learning PLC programming. The MicroLogix 1100 PLC is compact, offers a variety of I/O configurations and is inexpensive relative to other Rockwell options. Furthermore, the MicroLogix 1100 PLC is programmable using the free version of RSLogix 500 that can be downloaded from the official Rockwell website.

Vladimir Romanov

PLC Simulator - PLC Programming & Testing within a Simulated Environment

A PLC Simulator is an excellent avenue to practice PLC ladder logic programming. Although the software environment is not the perfect substitute for hands on experience on an actual PLC, the simulation delivers a very accurate representation of ladder logic execution.

Vladimir Romanov

HMI Software - Different Tools, Applications and Solutions to Meet Your Needs

HMI Software is commonly referred to as the development application that will be used to create the runtime application for an HMI terminal. It’s important to understand this distinction as we will be going over the HMI development environments used by PLC and HMI programmers to create the screens rather than the end-user applications you will see at the plant level.Numerous HMI programming software solutions are found on the market. Although they aim to achieve the same result, different packages have a distinct advantage over others in terms of price, reliability, ease-of-use and technical capability. It is therefore possible to find the right solution that will fit your specific application if you spend the time to research all options.

Vladimir Romanov