Logic Gates
Logic Gates
Introduction
Truth Tables
Truth tables are used to help show the function of a logic gate.
Logic gates
NOT gate
The NOT gate is an electronic circuit that produces an inverted
version of the input at its output. It is also known as an inverter.
If the input variable is A, the inverted output is known as NOT
A. This is also shown as A', or A with a bar over the top, as
shown at the outputs.
NAND gate
EXOR gate
The 'Exclusive-OR' gate is a circuit which will give a
high output if either, but not both, of its two inputs are
high. An encircled plus sign ( ) is used to show the EOR
operation.
EXNOR gate
The left hand side (LHS) of this theorem represents a NAND gate with inputs A
and B, whereas the right hand side (RHS) of the theorem represents an OR gate
with inverted inputs.
This OR gate is called as Bubbled OR.
Truth Table
Half-Subtractor logical circuit
Multiplexer Types
Multiplexers are classified into four types:
1x4 De-Multiplexer
1x4 De-Multiplexer has one input I, two selection lines, s1 & s0 and four
outputs Y3,Y2, Y1 &Y0. The block diagram of 1x4 De-Multiplexer is
shown in the following figure.
The single input ‘I’ will be connected to one of the four outputs, Y3 to Y0
based on the values of selection lines s1 & s0.
(Refer PDF also)
Encoder
An Encoder is a combinational circuit that performs the reverse operation
of Decoder. It has maximum of 2^n input lines and ‘n’ output lines,
hence it encodes the information from 2^n inputs into an n-bit code. It will
produce a binary code equivalent to the input, which is active High.
Therefore, the encoder encodes 2^n input lines with ‘n’ bits.
4 : 2 Encoder –
The 4 to 2 Encoder consists of four inputs Y3, Y2, Y1 & Y0 and two
outputs A1 & A0. At any time, only one of these 4 inputs can be ‘1’ in
order to get the respective binary code at the output. The figure below
shows the logic symbol of 4 to 2 encoder :
The Truth table of 4 to 2 encoder is as follows :
Logical expression for A1 and A0 :
A1 = Y3 + Y2
A0 = Y3 + Y1
The above two Boolean functions A1 and A0 can be implemented usingtwo
input OR gates :
Decimal to BCD Encoder –
The decimal to binary encoder usually consists of 10 input lines and 4 output lines. Each input line corresponds to the each
decimal digit and 4outputs correspond to the BCD code. This encoder accepts the decoded decimal data as an input and encodes
it to the BCD output which is available on the output lines. The figure below shows the logic symbol of decimal to BCD
encoder :
A1 = Y7 + Y6 + Y3 +Y2
A0 = Y9 + Y7 +Y5 +Y3 + Y1
The above two Boolean functions can be implemented using OR gates :
DECODER
The combinational circuit that change the binary information into2N output lines is known as Decoders. The binary
information is passed in the form of N input lines. The output lines define the 2 N-bit code for the binary information. In simple
words, the Decoder performs the reverse operation of the Encoder. At a time, only one input line is activated for simplicity. The
produced 2N-bit output code is equivalent to the binary information.
2 to 4 line decoder:
In the 2 to 4 line decoder, there is a total of three inputs, i.e., A0, andA1 and E and four outputs,
i.e., Y0, Y1, Y2, and Y3. For each combination of inputs, when the enable 'E' is set to 1, one of these four
outputs will be 1.The block diagram and the truth table of the 2 to 4 line decoder are givenbelow.
Block Diagram:
Truth Table:
The logical expression of the term Y0, Y0, Y2, and Y3 is as follows:
Y3=E.A1.A0
Y2=E.A1.A'
Y1=E.A1'.A0
Y0=E.A1'.A0'
BCD TO 7 SEGMENT DISPLAY
A digital system like a computer can understand and easily read a large number in binary format.
However, a human cannot read large binary numbers. To solve this problem we need to display it as a
decimal digit using 7-segment display.
7-Segment Display
It is a digital device that can be used for displaying decimal number,alphabets, and characters.
7-Segment display contains 7 LED segments arranged in a shape given in figure above.
Generally,there are 8 input pins in a 7-Segment display. 7 input pins for each of the 7 LEDs and one
pin for the common terminal.
Working of 7-Segment Display (LED & LCD) Circuit
7 LED segments of the display and their pins are “a”, “b”, “c”, “d”, “e”, “f” & “g” as shown in the
figure given below. Each of the pins will illuminate the specific segment only.
We assume common cathode LED segment as our example.
Suppose we want to display digit ‘0’, in order to display 0, we need to turn on “a”, “b”, “c”, “d”, “e”,
“f”. & turn-off the “g”. which would look like the figure given below.
7-Segment Display Segments for all Numbers
Display combination of decimal numbers is given below.
Digit 1: to display the digit 1 we need to turn on the segments b, c. and turn off the LED segments a, d,
e, f, and g. This configuration will result in the display as shown in the figure below.
Digit 5: to display the digit 5 we need to turn on the segments a, c, d, f, g.and turn off the LED segments
b, e. This configuration will result in the display as shown in the figure below.
Digit 7: to display the digit 7 we need to turn on the segments a, b, c. andturn off the LED segments d,
e, f, g. This configuration will result in the display as shown in the figure below.
Digit 8: to display the digit 8 we need to turn on the segments a, b, c, d,e, g only. This configuration
will result in the display as shown in the figure below.
To display these digits using binary numbers we need to decode these binary numbers into the
combination used for each pattern or display using Decoder.
Truth Table
Assume common cathode 7-Segment display. Suppose the binary input ABCD to the decoder and
output a, b, c, d, e, f, & g for the display.
FLIP FLOPS
The RS Flip Flop is considered as one of the most basic sequential logiccircuits. The Flip Flop is a
one-bit memory bi-stable device.
It has two inputs, one is called “SET” which will set the device
(output = 1) and is labeled S and another is known as “RESET” which willreset the device
The flip-flop is reset back to its original state with the help of RESET inputand the output is Q that will
be either at logic level “1” or logic”0”. It
depends upon the set/reset condition of the flip-flop. Flip flop word means that it can be “FLIPPED”
into one logic state or “FLOPPED” backinto another.
The basic NAND gate RS Flip Flop circuit is used to store the data and thusprovides feedback from
both of its outputs again back to its inputs. The RS Flip Flop actually has three inputs, SET, RESET and
its current output Qrelating to its current state.
The basic NAND gate RS flip flop circuit is used to store the data and thus provides feedback from both
of its outputs again back to its inputs. The RS flip flop actually has three inputs, SET, RESET and clock
pulse.
Figure-1:R-S flip flop circuit diagram
D Flip-Flop
The D flip-flop is a two-input flip-flop. The inputs are the data (D) inputand a clock (CLK) input.
The clock is a timing pulse generated by the
equipment to control operations. The D flip-flop is used to store data at apredetermined time and hold it
until it is needed. This circuit is sometimes called a delay flip-flop. In other words, the data input is
delayed up to one clock pulse before it is seen in the output. The simplest form of a D flip-
flop is shown in the figure below
J-K Flip-Flop
The J-K flip-flop is the most widely used flip-flop because of its versatility.When
properly used it may perform the function of an R-S or D flip-flop. The standard
symbol for the J-K flip-flop is shown in the figure below.
This simple JK flip Flop is the most widely used of all the flip-flop designsand is
considered to be a universal flip-flop circuit. The two inputs labelled“J” and “K” are
not shortened abbreviated letters of other words, such as “S” for Set and “R” for Reset,
but are themselves autonomous letters chosen by its inventor Jack Kilby to distinguish
the flip-flop design from other types.
The sequential operation of the JK flip flop is exactly the same as for the previous SR
flip-flop with the same “Set” and “Reset” inputs. The differencethis time is that the “JK
flip flop” has no invalid or forbidden input states of the SR Latch even when S and R are
both at logic “1”.
The JK flip flop is basically a gated SR flip-flop with the addition of a clockinput
circuitry that prevents the illegal or invalid output condition that can occur when both
inputs S and R are equal to logic level “1”. Due to this additional clocked input, a JK
flip-flop has four possible input combinations,“logic 1”, “logic 0”, “no change” and
“toggle”. The symbol for a JK flip flop issimilar to that of an SR Bistable Latch as
seen in the previous tutorial except for the addition of a clock input.
COUNTERS
A Counter is a device which stores (and sometimes displays) the number of times a
particular event or process has occurred, often in relationship to a clock
signal. Counters are used in digital electronics for counting purpose, they can count
specific event happening in the circuit. For example, in UP counter a counter increases
count for every rising edge of clock. Not only counting, a counter can follow the
certain sequence based on our design like any random sequence 0,1,3,2… .They can
also be designed with the help of flip flops. They are used as frequency dividers where
the frequency of given pulse waveform is divided. Counters are sequential circuit that
count the number of pulses can be either in binary code or BCD form. The main
properties of a counter are timing , sequencing , and counting. Counter works in two
modes: Up counter & Down counter.