Download Prospectus


What are logic functions, and how are they applied?

In our previous article, we dived into PLC Programming techniques. In this article, we’re going to check out logic functions and how they are applied to PLC systems.

What is a PLC timer?

A PLC timer is an instruction that controls and operates the device for a specific duration of time.  A timer is essential in a PLC for this reason.  We can set time-based activity with the help of the PLC programming timer instruction.

The timer instruction provides programming logic and is used to decide when to turn the circuit on or off.  It has normally open (NO) and normally closed (NC) contacts.

The image below shows the input and output timers for NO and NC contact in LD programming:

, What are logic functions and how are they applied?

If we want to perform work or device activity in a particular time span, we have to learn I/O timer instructions for writing the PLC program.  In the Ladder Diagram (LD) PLC programming, we can set the PLC timer from millisecond (ms) to an hour (hr) time range. 

Logic functions used in PLC timer programming

There are several logic functions used in the programming of PLC timers.  Let’s have a look at some of them:

 AND logic function

, What are logic functions and how are they applied?

Switch A and switch B have both to be open to give an AND logic situation. 

InputsOutput
AB
000
010
100
111

The ladder diagram starts with | |, a normally open set of contacts labelled input A, to represent switch A and in series with it | |, another normally open set of contacts labelled input B, to represent switch B. The line then terminates with O to represent the output.

For there to be an output, both input A and input B have to occur, i.e., input A and input B contacts have to be closed

OR logic function

, What are logic functions and how are they applied?

This describes an OR logic gate in that input A or input B must be on for there to be an output.

InputsOutput
AB
000
011
101
111

An example of an OR gate control system is a conveyor belt transporting bottled products to packaging, where a deflector plate is activated to deflect bottles into a reject bin if either the weight is not within certain tolerances or there is no cap on the bottle.

NOT logic function

, What are logic functions and how are they applied?

When there is an input to the switch, it opens and there is then no current in the circuit. This illustrates a NOT gate in that there is an output when there is no input and no output when there is an input. The gate is sometimes referred to as an inverter.

Input AOutput
01
10

With no input-to-input A, the contacts are closed and so there is an output. When there is an input-to-input A, it opens and there is then no output. An example of a NOT gate control system is a light that comes on when it becomes dark, i.e., when there is no light input to the light sensor there is an output.

NAND logic function

, What are logic functions and how are they applied?

Suppose we follow an AND gate with a NOT gate. The NOT gate will invert all the outputs from the AND gate. An alternative, which gives exactly the same results, is to put a NOT gate on each input and then follow that with OR

InputsOutput
AB
001
011
101
110

Bthe inputs A and B have to be 0 for there to be a 1 output. There is an output when input A and input B are not 1. The combination of these gates is termed a NAND gate.

, What are logic functions and how are they applied?

An example of a NAND gate control system is a warning light that comes on if, with a machine tool, the safety guard switch has not been activated and the limit switch signalling the presence of the workpiece has not been activated.

NOR logic function

, What are logic functions and how are they applied?

Suppose we follow an OR gate by a NOT gate. The NOT gate will to invert the outputs of the OR gate. An alternative, which gives exactly the same results, is to put a NOT gate on each input and then an AND gate for the resulting inverted inputs.

InputsOutput
AB
001
010
100
110

The combination of OR and NOT gates is termed a NOR gate. There is an output when neither input A or input B is 1.

, What are logic functions and how are they applied?

Keep an eye out for our next articles where we’re going to dive even further into Programmable Logic Controller systems and their uses.

Interested in our courses?

You can read more about our selection of accredited online electrical and electronic engineering courses here.

Check out individual courses pages below:

Diploma in Electrical and Electronic Engineering

Higher International Certificate in Electrical and Electronic Engineering

Diploma in Electrical Technology

Diploma in Electronics

Diploma in Renewable Energy (Electrical)

Higher International Diploma in Electrical and Electronic Engineering

Alternatively, you can view all our online engineering courses here.

Recent Posts

What are the principles of operation of electrical cells?

What are the principles of operation of electrical cells? In our last article, we looked at the basic electrical parameters in D.C. circuits.  In this article, we’re going to move on to the principles of operation of electrical cells.  We’ll look at the different types of cells and batteries, their mechanisms, and their applications. What […]

How can we calculate basic electrical parameters?

How can we calculate basic electrical parameters? In our last article, we looked at how we can select the best engineering material for the task.  In this article, we’re going to move on to basic electrical parameters in D.C. circuits. As an engineer, we need to be able to define these key terms and apply […]

How can we select engineering materials?

How can we select engineering materials? In our previous article, we looked at elastic and magnetic hysteresis. In this article, we’re going to look at how we can select engineering materials.  In other articles, we have previously looked at the different materials and their properties.  However, it’s important that engineers understand how we can go […]