0% found this document useful (0 votes)
16 views

ITAS 104 Module II Lesson 1

This module provides an overview of digital logic gates and how they can be replicated using programmable logic controllers (PLCs). It discusses Boolean algebra and its use in programming some small PLCs. The module covers basic logic functions like AND, OR, and NOT through logic gates, truth tables, and examples. It aims to describe how contacts and coils in a PLC represent digital inputs and outputs and how basic logic instructions in a PLC duplicate relay-based logic functions.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

ITAS 104 Module II Lesson 1

This module provides an overview of digital logic gates and how they can be replicated using programmable logic controllers (PLCs). It discusses Boolean algebra and its use in programming some small PLCs. The module covers basic logic functions like AND, OR, and NOT through logic gates, truth tables, and examples. It aims to describe how contacts and coils in a PLC represent digital inputs and outputs and how basic logic instructions in a PLC duplicate relay-based logic functions.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

MODULE II

Fundamentals of Logic and PLC


Programming

Lesson 1. The Binary Concept and Boolean

Algebra

Lesson 2. Hardwired Logic versus


Programmed Logic
Lesson 3. Processor Memory Organization and

Program Scan

Lesson 4. PLC Programming Languages


PAGE \* MERGEFORMAT 2

MODULE II

FUNDAMENTALS OF LOGIC AND PLC PROGRAMMING

This module gives an overview of digital logic gates and illustrates how
to duplicate this type of control on a PLC. Boolean algebra, which is a
shorthand way of writing digital gate diagrams, is discussed briefly. Some small
hand-held programmers have digital logic keys, such as AND, OR, and NOT, and
are programmed using Boolean expressions.

Each input and output PLC module terminal is identified by a unique


address. In PLCs, the internal symbol for any input is a contact. Similarly, in
most cases, the internal PLC symbol for all outputs is a coil. This module shows
how these contact/coil functions are used to program a PLC for circuit
operation. It covers only the basic set of instructions that perform functions
similar to relay functions.

After reading this MODULE, YOU MUST be able to:

1. Describe the binary concept and the functions of gates.

2. Draw the logic symbol, construct a truth table, and state the Boolean
equation for the AND, OR, and NOT functions.

3. Construct circuits from Boolean expressions and derive Boolean equations


for given logic circuits.

4. Develop elementary programs based on logic gate functions.

Module II
PAGE \* MERGEFORMAT 2

5. Program instructions that perform logical operations.

6. Describe input and output image table files and types of data files.

7. Describe the PLC program scan sequence.

8. Understand how ladder diagram language, Boolean language, and function


chart programming language are used to communicate information to the
PLC.

9. Write and enter ladder logic programs.

1. There are four lessons in Module II. It is imperative and important for you
to read and understand the lessons thoroughly in order to hasten your
knowledge about the topics.

2. In case you need further clarifications on some topics, you can have
supplemental reading using any references listed in the preliminaries or you
may surf the net re. the matter or raise questions during the set Google
Meet.

3. For erroneous concepts/ideas encountered, just take note of them and


consult your instructor, Lazaro N. Olivares via messenger GC/FB or thru
text/call at cp # 0923 737 1551, for further explanation.

4. Learning activities are found at the end of each lesson and at the classwork
of our Google Classroom; you are advised to answer all the items in the test
independently and upload them via Google Classroom . Refrain from going
over your module while answering in order to measure your level of
comprehension and retention of the lessons. However, you may do so
afterwards for the purpose of clarification and confirmation.

Module II
PAGE \* MERGEFORMAT 2

Lesson 1

 The Binary Concept and Boolean Algebra

The Binary Concept

The PLC, like all digital equipment, operates on the binary principle. The
term binary principle refers to the idea that many things can be thought of as
existing in only one of two states. These states are 1 and 0. The 1 and 0 can
represent ON or OFF, open or closed, true or false, high or low, or any other
two conditions. The key to the speed and accuracy with which binary
information can be processed is that there are only two states, each of which
is distinctly different. There is no in-between state so when information is
processed the outcome is either yes or no.

A logic gate is a circuit with several inputs but only one output that is
activated by particular combinations of input conditions. The two-state binary
concept, applied to gates, can be the basis for making decisions. The high
beam automobile lighting circuit of Figure 1 is an example of a logical AND
decision. For this application, the high beam light can be turned on only when
the light switch AND the high beam switch are closed.

The dome light automobile circuit of Figure 2 is an example of a logical


OR decision. For this application, the dome light will be turned on whenever
the passenger door switch OR the driver door switch is activated.

Figure 1. The Logical AND. Figure 2. The Logical OR.


Module II Source: Google Source: Google
PAGE \* MERGEFORMAT 2

Figure 1. The Logical AND.


Source: Google
Logic is the ability to make decisions when
one or more different factors must be taken into account before an action is
taken. This is the basis for the operation of the PLC, where it is required for a
device to operate when certain conditions have been met.

AND, OR, and NOT Functions

The operations performed by digital equipment are based on three


fundamental logic functions: AND, OR, and NOT. Each function has a rule that
will determine the outcome and a symbol that represents the operation. For
this discussion, the outcome or output is called Y and the signal inputs are
called A, B, C, and so on. Also, binary 1 represents the presence of a signal or
the occurrence of some event, and binary 0 represents the absence of the
signal or non-occurrence of the event.

The AND Function

The symbol drawn in Figure 3 is that of an AND gate. An AND gate is a


device with two or more inputs and one output. The AND gate output is 1 only
if all inputs are 1. The AND truth table in Figure 3 shows the resulting output
from each of the possible input combinations. Logic gate truth tables show
each possible input to the gate or circuit and the resultant output depending
upon the combination of the input(s).

Figure 3. AND gate. Source: Google

Figure 4. AND logic gate digital


signal states. Source: Google

Module II
PAGE \* MERGEFORMAT 2

Since logic gates are digital ICs (Integrated Circuits) their input and
output signals can be in only one of two possible digital states, i.e., logic 0 or
logic 1. Thus, the logic state of the output of a logic gate depends on the logic
states of each of its inputs. Figure 4 illustrates the four possible combinations
of inputs for a 2-input AND gate. The basic rules that apply to an AND gate is:

• If all inputs are 1, the output will be 1.


• If any input is 0, the output will be 0.
The AND logic gate operates similarly to control devices connected in
series, as illustrated in Figure 5. The light will be on only when both switch A
and switch B are closed.

Figure 5. AND logic gate operates similarly to control devices connected in


series. Source: Google
The OR Function
The symbol drawn in Figure 6 is that of an OR gate. An OR gate can have
any number of inputs but only one output. The OR gate output is 1 if one or
more inputs are 1. The truth table in Figure 6 shows the resulting output Y
from each possible input combination.

Figure 6. OR gate. Source: Google

Figure 7 illustrates the four


possible combinations of inputs for a 2-input OR gate. The basic rules that
apply to an OR gate are:

• If one or more inputs are 1, the output is 1.


• If all inputs are 0, the output will be 0

Module II
PAGE \* MERGEFORMAT 2

The OR logic gate operates similarly to control devices connected in


parallel, as illustrated in Figure 8. The light will be on if switch A or switch B
or both are closed.

Figure 7. OR logic gate digital signal


states. Source: Google

Figure 8. OR logic gate operates similarly to control devices connected in


parallel. Source: Google
The NOT Function

The symbol drawn in Figure 9 is that of a NOT function. Unlike the AND
and OR functions, the NOT function can have only one input. The NOT output is
1 if the input is 0. The output is 0 if the input is 1. The result of the NOT
operation is always the inverse of the input, and the NOT function is,
therefore, called an inverter. The NOT function is often depicted by using a
bar across the top of the letter, indicating an inverted output. The small circle
at the output of the inverter is referred to as a bubble and indicates that an
inversion of the logical function has taken place.

Module II
PAGE \* MERGEFORMAT 2

Figure 9. NOT function. Source: Google


The logical NOT function can
be performed on a contact input simply by using a normally closed instead of
normally open contact. Figure 10 shows an example of the NOT function

constructed using a normally closed pushbutton in series with a lamp. When


the input pushbutton is not actuated, the output lamp is ON. When the input
pushbutton is actuated, the output lamp switches OFF.

Figure 10. NOT function constructed using a normally closed pushbutton.


Source: Google

The NOT function is most often used in conjunction with the AND or the
OR gate. Figure 11 shows the NOT function connected to one input of an AND
gate for a low-pressure indicator circuit. If the power is on (1) and the pressure
switch is not closed (0), the warning light will be on (1).

Module II
PAGE \* MERGEFORMAT 2

Figure 11. NOT function is most often used in conjunction with an AND gate.
Source: Google

The NOT symbol placed at the output of an AND gate would invert the
normal output result. An AND gate with an inverted output is called a NAND
gate. The NAND gate symbol and truth table are shown in Figure 12. The NAND
function is often used in integrated circuit logic arrays and can be used in
programmable controllers to solve complex logic.

The same rule about inverting the normal output result applies if a NOT
symbol is placed at the output of the OR gate. The normal output is inverted,
and the function is referred to as a NOR gate. The NOR gate symbol and truth
table are shown in Figure 13.

Figure 12. NAND gate symbol and Figure 13. NOR gate symbol and
truth table. Source: Google truth table. Source: Google

The Exclusive-OR (XOR) Function


An often-used combination of gates is the exclusive-OR (XOR) function.
The XOR gate symbol and truth table are shown in Figure 14. The output of this
circuit is HIGH only when one input or the other is HIGH, but not both. The
exclusive-OR gate is commonly used for the comparison of two binary numbers.

Figure 14. The XOR gate symbol and


truth table. Source: Google

Module II
PAGE \* MERGEFORMAT 2

Boolean Algebra
The mathematical study of the binary number system and logic is called
Boolean algebra. The purpose of this algebra is to provide a simple way of
writing complicated combinations of logic statements. There are many
applications where Boolean algebra could be applied to solving PLC
programming problems.

Figure 15 summarizes the basic operators of Boolean algebra as they


relate to the basic AND, OR, and NOT functions. Inputs are represented by
capital letters A, B, C, and so on, and the output by a capital Y. The dot (•), or
no symbol, represents the AND operation, an addition sign (+) represents the
OR

operation, the circle with an addition sign ∙ represents the exclusive-OR


operation, and a bar over the letter Ā represents the NOT operation. The
Boolean equations are used to express the mathematical function of the logic
gate.

Figure 15. Boolean algebra is related to AND, OR, and NOT functions.
Source: Google

PLC digital systems may be designed using Boolean algebra. Circuit


functions are represented by Boolean equations. Figure 16 illustrates how logic
operators AND, NAND, OR, NOR, and NOT are used singly to form logical
statements. Figure 17 illustrates how basic logic operators are used in
combination to form Boolean equations.

Module II
PAGE \* MERGEFORMAT 2

Figure 16. Logic operators are used singly to form logical statements. Source:
Google

Figure 17. Logic operators are used in combination to form Boolean equations.
Source: Google

An understanding of the technique of writing simplified Boolean equations


for complex logical statements is a useful tool when creating PLC control
programs. Some laws of Boolean algebra are different from those of ordinary
algebra. These three basic laws illustrate the close comparison between
Boolean algebra and ordinary algebra, as well as one major difference between
the two:

Commutative Law: Associative Law: Distributive Law:

Developing Logic Gate Circuits from Boolean Expressions


As logic gate circuits become more complex, the need to express these
circuits in Boolean form becomes greater. Figure 18 shows a logic gate circuit
developed from the Boolean expression Y = AB + C. The procedure is as follows:

Boolean expression: Y = AB + C
Gates required: (by inspection)
1 - AND gate with input A and B
1 - OR gate with input C and output from previous AND gate

Module II
PAGE \* MERGEFORMAT 2

Figure 18. Logic gate circuit developed from the Boolean expression Y = AB + C.

Figure 19 shows a logic gate circuit developed from the Boolean


expression Y = A(BC + D). The procedure is as follows:

Boolean expression: Y = A(BC + D)


Gates required: (by inspection)
1 - AND gate with inputs B and C 1 - OR gate with inputs BC and D
1 - AND gate with input A and the output from the OR gate

Figure 19. Logic gate circuit developed from the Boolean expression
Y = A(BC + D). Source: Google

Producing the Boolean Equation for a Given Logic Gate Circuit


A simple logic gate is quite straightforward in its operation. However, by
grouping these gates into combinations, it becomes more difficult to determine
which combinations of inputs will produce an output. The Boolean equation for
the logic circuit of Figure 20 is determined as follows:

• The output of the OR gate is A + B


• The output of the inverter is D–
• Based on the input combination applied to the AND gate the Boolean
equation for the circuit is Y = C D – (A +B)

Module II
PAGE \* MERGEFORMAT 2

The Boolean equation for the logic circuit of Figure 21 is determined as


follows:
• The output of AND gate 1 is A – B
• The output of AND gate 2 is AB–
• Based on the combination of inputs applied to the OR gate the Boolean
equation for the circuit is Y = A – B + AB

Figure 20. Determining the Boolean Figure 21. Determining the Boolean
equation for a logic circuit. Source: equation for a logic circuit. Source:
Google Google

Module II
PAGE \* MERGEFORMAT 2

I. Answer briefly what is/are for:

1. Explain the binary principle.

2. Draw the logic symbol, construct a truth table, and state the Boolean
equation for each of the following:
a. Two-input AND gate
b. NOT function
c. Three-input OR gate
d. XOR function
3. Express each of the following equations as a ladder logic program:
a. Y = (A + B)CD
b. Y = A B C + D + E
c. Y = [( A + B )C] + DE
d. Y = ( A B C ) + (D E F)
4. Write the ladder logic program, draw the logic gate circuit, and state the
Boolean equation for the two relay ladder diagrams in the figure below.

Source: Google

Module II

You might also like