PLC Tutorials

Siemens PLC Comparator Logic

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

Comparator used in Siemens S7-1200 PLC.

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

Author: Bhavesh

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:

You've successfully subscribed !

View Comments

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

Share

Recent Articles

  • PLC Tutorials

Example PLC Program to Control a Pump based on Level Sensors

Learn an example PLC program to control a pump based on level sensors using ladder…

2 weeks ago
  • PLC Tutorials

PLC Timer Application in Security Camera Recording

In the PLC timer application for security camera recording, when motion is detected then camera…

2 weeks ago
  • PLC Tutorials

Batch Mixing with PLC Ladder Logic Program

In this example, we will learn batch mixing with PLC ladder logic program using timer…

2 weeks ago
  • PLC Tutorials

PLC Example on Manufacturing Line Assembly

This PLC example on manufacturing line assembly is an intermediate-level PLC program prepared for the…

2 weeks ago
  • PLC Tutorials

PLC Programming Example with Pushbutton and Motor

In this article, you will learn the PLC programming example with pushbutton and motor control…

3 weeks ago
  • PLC Tutorials

Boolean Logic to PLC Programming

This article teaches how to convert Boolean logic to PLC programming ladder logic with the…

1 month ago