This article shows the different types of Siemens PLC Comparator Logics and their ladder diagrams.

## Siemens PLC Comparator Logic

**Problem Description**

Implement equal, not equal, greater or equal, less or equal, greater than, check validity, and check invalidity comparators in Siemens S7-1200 PLC using ladder diagram language.

## Problem Diagram

## Problem Solution

Comparators are used for comparing two values. Say, If we want to compare two physical quantities (temperature, pressure etc.).

We can use the equal instruction to determine, if a first comparison value is equal to a second comparison value or not.

We can use the not equal instruction to determine, if a first comparison value is not equal to a second comparison value or not.

We can use the greater or equal instruction to determine, if a first comparison value is greater than or equal to a second comparison value or not. Both values to be compared must be of the same data type.

We can use the less or equal instruction to determine, if a first comparison value is less than or equal to a second comparison value or not. Both values to be compared must be of the same data type.

We can use the greater than instruction to determine, if a first comparison value is greater than a second comparison value or not. Both values to be compared must be of the same data type.

We can use the less than instruction to determine, if a first comparison value is less than a second comparison value or not. Both values to be compared must be of the same data type.

## List of Inputs and Outputs

#### Output List

- Result 1 = Q0.0
- Result 2 = Q0.1
- Result 3 = Q0.2
- Result 4 = Q0.3
- Result 5 = Q0.4
- Result 6 = Q0.5

#### Memory

- MW0 :- Comparator 1
- MW2 :- Comparator 2
- MW4 :- Comparator 3
- MW6 :- Comparator 4
- MW8 :- Comparator 5
- MW10 :- Comparator 6

## Ladder diagram for comparators used in S7-1200 PLC

## Program Description

In this program, we have used Siemens S7-1200 PLC and TIA Portal Software for programming.

**Network 1:**

If value in MW0 is equal to 2, result 1 (Q0.0) will be ON.

**Network 2:**

If value in MW2 is not equal to 2, result 1 (Q0.1) will be ON.

**Network 3:**

If value in MW4 is greater or equal than 2, result 3 will be ON.

**Network 4:**

If value in MW6 is less or equal than 2, result 4 will be ON

**Network 5:**

If value in MW8 is greater than 2, result 5 will be ON.

**Network 6:**

If value in MW10 is less than 2, result 6 will be ON

## Test Cases

If you liked this article, then please subscribe to our YouTube Channel for PLC and SCADA video tutorials.

You can also follow us on Facebook and Twitter to receive daily updates.

**Read Next:**

- Separate Different Size Objects using PLC
- PLC Tank Heating Control using Heater
- Implement 1 to 8 Demultiplexer using PLC

If we want to control this logic continuously without assistance,what should we do?