# PLC Program to Perform Various Boolean Functions

«
»

This is a PLC program to implement various boolean functions.

Problem Description

Implement following Boolean Functions in PLC Ladder Diagram programming language,

```	F(w,x,y)=∑(1,3,5,7)
F(a,b,c,d)=∑(0,1,2,3,5,7,9,11)```
Problem Solution
• Here in these 2 equations, inputs for equation (1) are w, x, and y while for equation (2) are a, b, c, and d.
• To solve this problem, we must first minimize the expression by using Karnaugh-Map method.

Output of these equations obtained by solving K-Map is as given below.

```	F(w,x,y)  = y
PLC Program

Here is PLC program to implement various boolean functions, along with program explanation and run time test cases.

```	W        =		I:1/0	(Input)
X        =		I:1/1	(Input)
Y        =		I:1/2	(Input)
F(w,x,y) = 	        O:2/0	(Output)``` Program Description
• As you can see the output of equation (1) is F(w,x,y)=y which shows that O:2/0 will go high when Y or I:1/2 is set to 1 and this is obtained by simplifying the equation by Karnaugh Map method.
• Output remains high until input Y is set irrespective of inputs W and X, that is I:1/0 and I:1/1 respectively.

List of Inputs and Outputs for Equation (2)

```	A         =	        I:1/0	(Input)
B         =	        I:1/1	(Input)
C         =		I:1/2	(Input)
D         =		I:1/3	(Input)
F(A,B,C,D)=		O:2/0	(Output)``` Program Description
• Output F(a,b,c,d)/O:2/0 here will go high in 3 conditions. As we can see from the ladder diagram and in the Boolean function which was solved using Karnaugh Map.
• There are 3 pairs of inputs connected in parallel to each other which represent OR function and connecting each of them pair of two inputs in AND function.
• Output goes high in following three conditions.
• Whenever A (I:1/0) and B (I:1/1) are Low irrespective of other input states.
• Whenever A (I:1/0) is Low AND D (I:1/3) is High irrespective of other input states.
• And whenever B (I:1/1) is Low and D (I:1/3) is High irrespective of other input states.
Runtime Test Cases
```
Equation(1)
Inputs	                Output
W	x	y	O:2/0
0	0	0	LOW
0	0	1	HIGH
0	1	0	LOW
0	1	1	HIGH
1	0	0	LOW
1	0	1	HIGH
1	1	0	LOW
1	1	1	HIGH```
```
Equation(2)
Inputs	                        Output
A	B	C	D	O:2/0
0	0	0	0	HIGH
0	0	0	1	HIGH
0	0	1	0	HIGH
0	0	1	1	HIGH
0	1	0	0	LOW
0	1	0	1	HIGH
0	1	1	0	LOW
0	1	1	1	HIGH
1	0	0	0	LOW
1	0	0	1	HIGH
1	0	1	0	LOW
1	0	1	1	HIGH
1	1	0	0	LOW
1	1	0	1	LOW
1	1	1	0	LOW
1	1	1	1	LOW```

Sanfoundry Global Education & Learning Series – PLC Algorithms.

To practice all PLC programs, here is complete set of 100+ PLC Problems and Solutions. 