Compare blocks (COMP) in Schneider PLC EcoStruxure Control Expert

Published on Sep 01, 2025 | Category: comp-block

Share this Page:

In Schneider PLC EcoStruxure Control Expert, the COMP (Compare) instruction works differently from the standard Ladder Diagram comparison instructions. In standard Ladder comparison instructions, such as Equal, Greater Than, Less Than, etc., you define inputs and outputs separately for each instruction. Each comparison is treated as an independent block with its own input conditions and output result.

In contrast, the COMP instruction allows you to define a single Structured Text (ST) statement that performs the comparison. Instead of using separate blocks for each operator, you write one statement using operators like =, <>, <, >, <=, >= to perform the comparison. The output of the COMP instruction becomes true only if both the input condition is true and the comparison statement evaluates to true.

This approach makes COMP instructions more compact and flexible. You can perform complex comparisons using a single statement, reducing the number of blocks in your Ladder Diagram and keeping your program simpler and easier to read. It is especially useful when you want to execute multiple comparisons or chained logic without creating many individual standard comparison blocks.

What is the COMP (Compare) Block?

The COMP (Compare) block in Schneider PLC EcoStruxure Control Expert is used to check conditions between two values in a Ladder Diagram program. You can use it to see if a value is less than, greater than, equal to, not equal to, or within other standard comparison operators. While you can do the same comparisons using Structured Text directly, the COMP block makes it easy to handle them visually in Ladder Diagram.

The COMP block checks a comparison condition using a single Structured Text (ST) statement ending with a semicolon. The output only becomes 1 (true) if both the input condition and the comparison result are true. For example, if the input is 1 and the comparison gives 1, the output is 1. If either the input or the comparison is 0, the output stays 0.

Using Comparison Operators in a COMP Block:
Within the COMP block, you can write comparisons in the following format:
value1 operator value2;
Here, value1 and value2 are variables or constants, and operator can be any standard comparison operator:

For example, if you want to check if a temperature value is below a setpoint, you could write: Temperature < SetPoint; in the COMP block. If the condition is true and the input to the COMP block is also true, the output becomes 1.

Each COMP block can hold up to 4096 characters of expressions. If the content is too long to show completely, the beginning will appear followed by three dots (...). Horizontally, each block takes up one line and two columns in the Ladder Diagram, making it easy to organize multiple compare blocks in your program.

img/comp-block/what-is-comp-block-in-schneider-plc.webp

How to Add a COMP Comparison Instruction in Schneider PLC

The COMP (Compare) block is used in Ladder Diagram to compare two values using standard operators such as =, <>, <, <=, >, and >=. Here’s how you can add and configure a COMP block in EcoStruxure Control Expert:

  1. Insert the COMP Block: In the Ladder Diagram editor, right-click on the rung where you want the comparison and select Insert > Function Block > COMP. A new COMP block will appear on the rung.
  2. Add the Comparison Statement: Double-click the COMP block to open its editor. Inside, write a Structured Text (ST) comparison statme. Example:
    • value_1=value_2 : Equal to
    • value_1<>value_2 : Not equal to
    • value_1<value_2 : Less than
    • value_1<=value_2 : Less than or equal to
    • value_1>value_2 : Greater than
    • value_1>=value_2 : Greater than or equal to
    Make sure the statement ends with a semicolon (;).
  3. Connect the Output: The Q (Output) of the COMP block will become 1 (true) only if the comparison is true and the EN input is also true. Connect it to a coil, another function block, or logic as needed.
img/comp-block/how-to-add-comp-block-schneider-plc.webp

Each COMP block can hold up to 4096 characters, so you can write complex expressions if needed. Horizontally, it occupies one line and two columns in the Ladder Diagram, making it easy to organize multiple compare blocks in your program.

COMP Block Examples with Different Comparison Operators

img/comp-block/comp-block-structured-text-schneider-plc.webp

The COMP (Compare) block can check conditions between two values using standard comparison operators: <, >, <=, >=, =, <>. Each comparison is written as a single Structured Text (ST) statement ending with a semicolon. The output is sent directly to a coil, which becomes true if the comparison evaluates to true.

1. Equal To (=)

value_1 = value_2;
  

This comparison checks if value_1 is equal to value_2. If the condition is true, the coil result_equal becomes active. Otherwise, it stays off.

2. Not Equal To (<>)

value_1 <> value_2;
  

This checks if value_1 is not equal to value_2. If they are different, the coil result_not_equal becomes active. If they are equal, the coil remains off.

3. Less Than (<)

value_1 < value_2;
  

This checks if value_1 is smaller than value_2. If true, the coil result_less turns on. Otherwise, it stays off.

4. Greater Than (>)

value_1 > value_2;
  

This checks if value_1 is greater than value_2. If true, the coil result_greater becomes active. Otherwise, it stays off.

5. Less Than or Equal To (<=)

value_1 <= value_2;
  

This checks if value_1 is less than or equal to value_2. If the condition is true, the coil result_less_equal turns on. Otherwise, it remains off.

6. Greater Than or Equal To (>=)

value_1 >= value_2;
  

This checks if value_1 is greater than or equal to value_2. If true, the coil result_greater_equal becomes active. Otherwise, it stays off.

Explanation:

In each case, the COMP block evaluates a single ST statement and sets the output coil according to the comparison result. This makes it simple to directly control coils, trigger events, or make decisions in your Ladder Diagram program without writing extra logic. The block provides a compact and efficient way to handle multiple comparisons in Schneider PLC programming.

Applications of the COMP (Compare) Instruction

The COMP instruction is used to perform comparisons between two values using a single ST statement. Unlike traditional Ladder comparison instructions, you do not need to create separate rungs or assignments for each condition. This makes COMP ideal when you want to quickly check a condition and control an output coil.

For example, you can check if a temperature value is greater than a setpoint and directly activate a coil. The coil turns on automatically if the comparison evaluates to true, keeping your Ladder Diagram clean and easy to read.

In short, the COMP instruction is used whenever a comparison between two values is needed. It simplifies the program, reduces unnecessary rungs, and allows a single statement to produce the desired output directly.