Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Chapter-7

Logic Systems
 Logic Gates: are the basic building blocks for digital
electronic circuits.
 Digital vs Analog Waveforms

+5 +5
1 0 1
V V
Time Time

–5 –5

Digital: only assumes Analog: values vary over


discrete values a broad range continuously

1
Boolean Algebra and Logical Operators

Algebra: variables, values, operations

In Boolean algebra, the values are the symbols 0 and 1


If a logic statement is false, it has value 0
If a logic statement is true, it has value 1

Operations: AND, OR, NOR, NAND, XOR

2
Logic Functions
AND Operation
Both inputs must be true for the output to be true.

Boolean logic diagram

3
OR operation
 A coil is not energized until either Normally open switch A
or B is closed.

4
NOR Operation
 There has to be an output neither A nor B has input.
 That is, when there is input to either A or B output ceases.

5
NAND Operation
There is no output when both A and B have an
input.

6
Exclusive-OR (XOR) Operation
 No output when the status of both the inputs is same.
 In other words, No output when there is no input to both
A and B and when there is an input to both A and B

7
Combinational logic: is used for the combining
two or more basic logic gates to form a required
function.
 A combinational circuit consists of logic gates whose
outputs, at any time, are determined by combining
the values of the inputs.
 For n input variables, there are 2n possible binary
input combinations.
 For each binary combination of the input variables,
there is one possible output.

8
Combinational logic…
 Hence, a combinational circuit can be described by:
1. A truth table that lists the output values for each
combination of the input variables, or
2. m Boolean functions, one for each output
variable.

n-inputs Combinational m-outputs


••
• Circuit ••

9
Sequential Logic
 Where a system requires an output which depends
on the values the inputs, a sequential logic system is
required.
 It has some form of memory.
Combinational
outputs Memory outputs

Combinational Memory
logic elements

External inputs

Sequential circuit = Combinational logic + Memory Elements


10
Sequential Logic…

There are two types of sequential circuits:

synchronous: outputs change only at specific time

asynchronous: outputs change at any time

11
Combinational vs. Sequential Circuits
 Combinational circuits are memory-less. Thus, the
output value depends ONLY on the current input
values.
 Sequential circuits consist of combinational logic
as well as memory elements (used to store certain
circuit states). Outputs depend on BOTH current
input values and previous input values (kept in the
storage elements).
 Memory element: a device which can remember
value indefinitely, or change value on command
from its inputs.

12
Flip -flop
 The Flip-flop is the basic memory element which is
made up of an assembly of logic gates and sequential
logic device.
 Flip-flops are memory elements that change state on
clock signals.
Memory Q
command element stored value

clock

Positive pulses

Positive edges Negative edges


13
Flip –flop…
 A basic sequential circuit is a flip-flop
 Flip-flop has two stable states of complementary
output values.

14
Timers/Counters
 Timer: is a device that counts
the increments of time.
 It is a special operand of PLC,
which represents a time delay
relay in a relay logic system.
 It is possible to achieve time delays in the range of few
milliseconds to few hours.
 Timers are represented by boxes in a ladder diagram.
 When timer is receives an enable status, the timer
starts timing an activity. The timer compares its
current time with preset time.

15
Timer…

 As long as the current time is less than the preset

time the output of the timer is a logic 0.

 When the current time is greater than the preset

time, the timer output goes to logic 1.

16
On-Delay Timer(TON)
 When there is an I/P signal,
the O/P signal becomes on
with certain delay (Preset time).
 But when the input signal is absent, the output signal
becomes off immediately.
 The timer resets to zero when the input signal
becomes off (i.e., enabling inputs goes to a logic 0.)
 Output is not observed until input
pulse width greater than the delay
time.

Input-Output Wave form


17
On-Delay Timer(TON)…

Hard-wired timing circuit

When S1 closed, TR1 begins timing.


After 5 seconds (preset), TR1 will close its associated normally
open TR1 contact, illuminating pilot light PL1.
When S1 opens, de-energizing TR1, the TR1 circuit open ,
immediately extinguishing PL1.

18
Equivalent PLC program
 Switch S1is connected to input A, and the pilot lamp
(PL1) is connected to output B.
 When the switch close, the
contact A closes and timer
T37 begins timing.
 After 5 seconds, the timer
output becomes a logic 1,the
T37 contact closes, output B becomes a logic 1, and the
light turns on.

19
Retentive on-delay timer (TONR)
 TONR functions just like TON . But does not reset (to zero)
when the input changes.
 The timer must be reset with a RESET (R) instruction.

20
Retentive on-delay timer (TONR)…
Operation

 When the input is ‘ON’ , the internal counter starts


counting the time.
 If the input is ‘off’, the counter holds the value.
 When the input is on, counting the time starts from the
previous value existing in the register.
 The output is on only when the time reaches its ‘preset
time’.

21
Off-delay Timer
 When the input signal become off the output signal
becomes ‘off’ with certain delay.
 But when the input signal becomes on,
the output signal becomes on immediately.

Input output waveform for an off-delay timer


 The delay in the output is not observed until the input pulse
width is greater than the delay time.
22
Counters
 They used in PLCs serve the same function as mechanical
counters.
 They compare an accumulated value to a preset value to
control circuit functions.
 Used to initiate an operation when a count is reached or
to prevent an operation from occurring until a count has
been reached.

23
Counters. . .

 They represented by boxes in ladder logic.


 The same number cannot assigned to more than one
counter.
 Counters increment or decrement one count when ever the
input changes from off to on status.
 Counters are reset when a RESET instruction is executed.
 The maximum count value of a counter is ±32,767.
24
Count-up counter (CTU)

 Counts up from the current value when the count up


(CU) goes from off to on.
 When the current value is greater than or equal to the
preset value (PV), the counter bit is a logic 1.
 The counter stops counting when it reaches its maximum
value of 32,767.

25
Count down counter (CTD)

 Counts down from the current value when the count


down (CD) input goes from off to on.
 When the current value is equal to zero, the counter bit
is a logic 1.The counter stops counting at zero.
 The counter resets and loads the current value with the
preset value (PV) when the load input (LD) turns on.

26
Count UP/DOWN counter (CTUD)

 Counts Up when the count up (CU) input turns on and


counts down when the count down (CD) input turns on.

27

You might also like