π Back to Ladder Logic Functions
Comparators are specialized functions in PLC ladder logic that compare two values and determine their relationship. They are essential for decision-making processes in automation systems, allowing the PLC to respond based on specific conditions.
The most common comparator functions include:
Comparators are used in ladder logic to evaluate conditions based on the values of variables, inputs, or constants. When the comparison condition is met, the comparator outputs a true signal, allowing the logic flow to continue or activate subsequent functions.
Each comparator function typically takes two input values and produces a single output. The output is true (energized) if the comparison condition is satisfied and false (de-energized) otherwise. This output can then be used to control other elements in the ladder logic, such as coils or other contacts.
The most common applications of comparators are checking sensor values and making integer sequential programs.
The below table summarizes the behavior of an Output Coil:
| Comparator Type | Input A | Input B | Output State |
|---|---|---|---|
| Equal To (==) | 5 | 5 | True (Signal Flows) |
| Not Equal To (!=) | 5 | 3 | True (Signal Flows) |
| Greater Than (>) | 7 | 4 | True (Signal Flows) |
| Less Than (<) | 2 | 6 | True (Signal Flows) |