Skip to main content

Comparison Instructions in PLC Programming

 Comparison instructions in PLC are used to test pairs of values to condition the logical continuity of a rung.

Thus, comparison instructions would seldom, if ever, be the last instruction on a rung.

Types of Comparison Instructions

As an example, suppose a LES instruction is presented with two values. If the first value is less than the second, then the comparison instruction is true.

Equal (EQU) Instruction

Use the EQU instruction to test whether two values are equal. If source A and source B are equal, the instruction is logically true. If these values are not equal, the instruction is logically false.

Source A must be an address.

Source B can be either a program constant or an address.

Values are stored in two’s complementary form.

Not Equal (NEQ) Instruction

Use the NEQ instruction to test whether two values are not equal.


If source A and source B are not equal, the instruction is logically true.

Source A must be an address.

Source B can be either a program constant or an address.

Values are stored in two’s complementary form.

Less Than (LES) Instruction


Use the LES instruction to test whether one value (source A) is less than another (source B).


If source A is less than the value at source B, the instruction is logically true.


Source A must be an address.


Source B can be either a program constant or an address.


Values are stored in two’s complementary form.


Less Than or Equal (LEQ) Instruction


Use the LEQ instruction to test whether one value (source A) is less than or equal to another (source B).


If the value at source A is less than or equal to the value at source B, the instruction is logically true.

Source A must be an address.


Source B can be either a program constant or an address.


Values are stored in two’s complementary form.


Greater Than (GRT) Instruction

Use the GRT instruction to test whether one value (source A) is greater than another (source B).

If the value at source A is greater than the value at source B, the instruction is logically true.

Greater Than Or Equal (GEQ) Instruction
Use the GEQ instruction to test whether one value (source A) is greater than or equal to another (source B).

If the value at source A is greater than or equal to the value at source B, the instruction is logically true.

Masked Comparison for Equal (MEQ)
se the MEQ instruction to compare data at a source address with data at a compare address.

The Use of this instruction allows portions of the data to be masked by a separate word.

Source is the address of the value you want to compare.
Mask is the address of the mask through which the instruction moves data.

The mask can be a hexadecimal value.

Compare is an integer value or the address of the reference.

If the 16 bits of data at the source address are equal to the 16 bits of data at the compare address (less masked bits), the instruction is true.

The instruction becomes false as soon as it detects a mismatch.

Limit Test (LIM) Instruction
Use the LIM instruction to test for values within or outside a specified range, depending on how you set the limits.

The Low Limit, Test, and High Limit values can be word addresses or constants, restricted to the following combinations:

If the Test parameter is a program constant, both the Low Limit and High Limit parameters must be word addresses.
If the Test parameter is a word address, the Low Limit and High Limit parameters can be either a program constant or a word address.
True/False Status of the LIM Instruction
If the Low Limit has a value equal to or less than the High Limit, the instruction is true when the Test value is between the limits or is equal to either limit.

If the Low Limit has a value greater than the High Limit, the instruction is false when the Test value is between the limits.
If you liked this article, then please subscribe to our YouTube Channel for PLC and SCADA video tutorials.

-END-



Comments

Popular posts from this blog

Ferrules and Cross Ferruling

 Ferrules are identification labels provided for every wire terminations in an instrument, equipment, or electrical/instrumentation control panels. These tube-shaped sleeves can be inserted easily on each individual wire in a multi-core cable. In earlier days fixed digits/letters are used as ferrules, but now Instrumentation engineers/technicians prints out desired ferrules by using a ferrule printing machine. Typical Ferrule The numbers/ letters on the ferrules will be given as per the approved electrical hook up or loop diagrams. This helps technicians to easily identify a particular loop/wiring from a series of terminal blocks and to troubleshoot the desired terminal connection. Separate numbers on the ferrules distinguish the positive and negative polarities of wires, thus ensure the polarity protection of the instrument. Cross Ferruling  As a wire is connected on its both ends, it is quite useful to use a cross reference method for wire identification. Unlike normal ferru...

What is a Torbar? – Averaging Pitot Tubes

 The Torbar is employed for flow measurement of liquids, gases, or steam in circular, square, or rectangular section ducts for large flow rates. The Torbar is an insertion type multi-port self-averaging primary sensor for flow measurement. Torbar TORBAR is a set of Pitot tubes mounted on a bar across the pipeline with no moving parts. An averaging Pitot tube is a technology, while TORBAR is a manufacturing brand name. There are several brands available in the market with VERABAR, ANNUBAR, etc. Averaging Pitot Tube Principle Purpose Averaging Pitot tube can be employed when the average velocity of the flow profile, rather than the velocity in a specific point in the cross-section is desired. Averaging Pitot Tubes Principle It measures the differential pressure between the static pressure tap and the tap of full pressure of a stream. Thus such magnitude of differential pressure is directly proportional to the square of the flow rate. Working The TORBAR is designed in such a way that ...

Thermowell Insertion and Immersion Length

 The thermowell is the industrial housing for temperature elements like RTD or thermocouple or temperature gauges. Thermowell is directly exposed to process fluid/media. Inside the thermowell, element/gauge is installed. Thermowell transfers the heat to the temperature element. Depending upon the element type, the fluid temperature can be known. So Thermowell protects the temperature element against harsh conditions and process fluid. It enables removal of the temperature element for replacement, repair, or testing without affecting the process system. Generally, thermowells are provided with all-temperature Elements like RTD or Thermocouple or temperature gauge. A few exceptions would be bearing RTD, skin type thermocouple, air duct thermometer, etc where thermowell is not applicable / required. When the thermowell assembly is inserted into the pipe, it is subjected to vibration. This vibration is caused by vortices to be generated alternately on either side of the thermowell. The...