PLC

Logic Gates in PLC Programming: A Guide with Truth Tables and Ladder Logic Diagrams

  • Programmable Logic Controllers (PLCs) are crucial in industrial automation, controlling machinery and processes by executing programmed logic sequences. 
  • At the core of PLC programming are logic gates, which perform fundamental logical operations on one or more binary inputs to produce a single binary output. 
Logic Gates in PLC Programming: A Guide with Truth Tables and Ladder Logic Diagrams

This guide will provide an in-depth look at the primary logic gates used in PLC programming, including their truth tables and representation in ladder logic diagrams.

Logic Gates in PLC Programming: 1

An AND gate outputs true (1) only if all its inputs are true (1). This gate is used in scenarios where multiple conditions must be satisfied simultaneously.

Input AInput BOutput
000
010
100
111
  • When both Input A and Input B are 1, the output is 1.
  • For all other combinations of inputs, the output is 0.
Logic Gates in PLC Programming: 2

In the ladder logic diagram, the series connection of two contacts (A and B) represents the AND gate. Both contacts must be closed (true) for the output coil to be energized.

Logic Gates in PLC Programming: 3

An OR gate outputs true (1) if at least one of its inputs is true (1). This gate is used when any one of multiple conditions can trigger an action.

Input AInput BOutput
000
011
101
111
  • When either Input A or Input B is 1, the output is 1.
  • If both inputs are 0, the output is 0.
Logic Gates in PLC Programming: 4

In this diagram, the parallel connection of two contacts (A and B) represents the OR gate. If either contact is closed (true), the output coil is energized.

Logic Gates in PLC Programming: 5

A NOT gate outputs the inverse of its input. This gate is used when the output should be true if the input is false, and vice versa.

InputOutput
01
10
  • When the input is 0, the output is 1.
  • When the input is 1, the output is 0.
Logic Gates in PLC Programming: 6

In ladder logic, a normally closed contact (A) represents the NOT gate. When A is open (false), the output coil is energized.

Logic Gates in PLC Programming: 7

A NAND gate outputs true (1) if at least one of its inputs is false (0). It is the inverse of the AND gate and is useful in circuits where the output should be true unless all inputs are true.

Input AInput BOutput
001
011
101
110
  • When both Input A and Input B are 1, the output is 0.
  • For all other combinations of inputs, the output is 1.
Logic Gates in PLC Programming: 8

The parallel  connection of two contacts (A and B) followed by a normally closed contact represents the NAND gate. The output is false only when both A and B are true.

Logic Gates in PLC Programming: 9

A NOR gate outputs true (1) if all its inputs are false (0). It is the inverse of the OR gate and is used where the output should be true only when all inputs are false.

Input AInput BOutput
001
010
100
110
  • When both inputs are 0, the output is 1.
  • If either input is 1, the output is 0.
Logic Gates in PLC Programming: 10

In this diagram, the series  connection of two normally closed contacts (A and B) represents the NOR gate. The output is true only when both contacts are open (false).

Logic Gates in PLC Programming: 11

An XOR (exclusive OR) gate outputs true (1) if exactly one of its inputs is true (1). It is used when the output should be true only if one of the inputs is true, but not both.

Input AInput BOutput
000
011
101
110
  • The output is true if only one of the inputs is true.
  • If both inputs are the same, the output is false.
Logic Gates in PLC Programming: 13

In ladder logic, the XOR gate is represented by a combination of series and parallel connections of normally open and normally closed contacts. This ensures the output is true only when the inputs are different.

Logic Gates in PLC Programming: 14

An XNOR (exclusive NOR) gate outputs true (1) if both inputs are the same. It is the inverse of the XOR gate and is used when the output should be true if both inputs are either true or false.

Input AInput BOutput
001
010
100
111
  • The output is true if both inputs are the same.
  • If the inputs are different, the output is false.
Logic Gates in PLC Programming: 15

The XNOR gate is represented by a combination of series and parallel connections, similar to the XOR gate but arranged to produce the inverse result. This ensures the output is true only when the inputs are identical.

Understanding and implementing logic gates in PLC programming is fundamental for developing complex and efficient control systems. Each logic gate performs a specific logical function, which can be represented and combined in ladder logic diagrams to achieve desired automation outcomes. By mastering these basic elements, engineers can create sophisticated control programs that enhance the performance and reliability of industrial automation systems.

Sundareswaran Iyalunaidu

With over 24 years of dedicated experience, I am a seasoned professional specializing in the commissioning, maintenance, and installation of Electrical, Instrumentation and Control systems. My expertise extends across a spectrum of industries, including Power stations, Oil and Gas, Aluminium, Utilities, Steel and Continuous process industries. Tweet me @sundareshinfohe

Related Articles

Back to top button