Chapter 5

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

CHAPTER 5

Encoding, Decoding, and Seven-Segment


Displays
Lecture Outline

8421 BCD Code, ASCII Code


Encoder, Seven-Segment LED displays, Decoders
BCD-to-Seven-Segment Decoders/Drivers
Liquid Crystal Displays (LCD)
THE 8421 BCD CODE

How would you present the decimal


number 926 in binary form?

In chapter 2, we have seen that 92610 = 11100111102.


A code that uses binary in a different way than in the
above example is called the 8421 binary-coded
decimal code.
This code is frequently referred to as just the BCD
code.
THE 8421 BCD CODE

BCD stands for = Binary Coded Decimal

A BCD number is a four-bit binary group that


represents one of the ten decimal digits 0 through 9.
For example: Thousands Hundreds Tens Ones

Decimal number 4926 4 9 2 6

8421 BCD coded number 0100 1001 0010 0110


THE 8421 BCD CODE
Converting from BCD to decimal numbers

Thousands Hundreds Tens Ones

8421 BCD coded number 0001 1000 0111 0001

Decimal number 4926 1 8 7 1


THE EXCESS-3 CODE
Another code that is really a BCD code.

How does it reads? Decimal Binary +3 Excess-3


0 0000 0011 0011
1 0001 0011 0100
2 0010 0011 0101
3 0011 0011 0110
We add 3 to each digit of the 4 0100 0011 0111
decimal number and convert to 5 0101 0011 1000
binary form
6 0110 0011 1001
7 0111 0011 1010
8 1000 0011 1011
Example: Excess-3 coded
number 9 1001 0011 1100
4 + 3 = 7 0111
Decimal Convert to binary
number
THE GRAY CODE
Invented by Frank Gray of Bell Labs. Decimal Gray code
Is a code where only one bit changes as it is 0 00000
count from top to bottom.
1 00001
The Gray code cannot be used in arithmetic
circuit. The Gray code is used for input and 2 00011
output devices in digital systems. 3 00010
It is quite difficult to translate from decimal 4 00110
numbers to the Gray code and back to decimals 5 00111
again. 6 00101
The Gray code is commonly associated with 7 00100
optical encoding of a shaft’s angular position.
8 01100
The Gray code is NOT a BCD code. 9 01101
Example: 10 01111
+ + + + + Addition of Binary
0+0=0 carry 0
11 01110
1 0 1 1 1 02 12 01010
0+1=1 carry 0
1+0=1 carry 0 13 01011
1+1=0 carry 1 14 01001
1 1 1 0 0 12 1+1+1=1 carry 1 15 01000
16 11000
THE ASCII CODE
ASCII acronym for = American Standard
Code for Information Interchange

It is widely used to send information to and from microcomputers.


The standard ASCII code is a 7-bit code (127 characters) used in
transferring coded information from keyboards and to computer
displays and printers. (Represents numbers, letters, punctuation
marks and control characters).
Extended ASCII (IBM ASCII), an 8-bit code, is also very popular.
Extended ASCII adds graphics and math symbols to code (total of
256 symbols)
The ASCII code is an alphanumeric code. It can represent both
letters and numbers.
THE ASCII CODE

Example:
What is the coding for ”A” in ASCII? This is the code would expect to
Assembling the 7-bit code gives 100 0001 = A be sent to a computer’s CPU if A
key is pressed on the keyboard.
THE ASCII CODE

Be aware that the control characters may have other meanings on specific computers or
other equipment. However common control characters such as BEL (bell), BS (Backspace), LF
(line feed), CR (carriage return), DEL (delete), and SP (space) are used on most computers.
The exact meaning of the ASCII control codes should be looked up in equipment manual.
TYPICAL ARRANGEMENT OF DIGITAL SYSEMS

KEYBOARD
INPUT
ENCODERS
Encoder is an electronic translator that
Definition:
translates the decimal input from the keyboard
to an 8421 BCD code.

This encoder is called a 10-line-to-4-line


priority encoder by the manufacturer.

For instance:
If the decimal input 3 on the decoder is
activated, then the logic circuit inside the
unit outputs of the BCD number 0011 is
ACTIVATED .

Figure 1: 10-line-to-4-line encoder


ENCODERS

Figure 2: Pin diagram for 74147 encoder IC

This is the PIN diagram/connection for the 74147 10-to-4-line


encoder.
The bubbles at the both the inputs (1 to 9) and the outputs (A to
D) means that the 74147 has both active low inputs and active
low outputs.
ENCODERS

Figure 3 : Truth table for 74147 encoder

This is the truth table for 74147 priority encoder.


Note that, only low logic levels (L on the truth table) activate the
appropriate input.
The active state for the outputs on this IC are also LOW.
Notice: in the last line of the truth table, the L (logical 0) at input 1
activates only the A output (the least significant bit (LSB) of the four-
bit group)
ENCODERS

Encoder in previous Figure (1), (2), (3) have a priority feature.


This means that if two inputs are activated at the same time, only the
larger number will be encoded.
For instance:
If both the 9 and the 4 inputs were activated (LOW). Then the output
would be LHHL, representing decimal 9.
Note that, the outputs need to be complemented (inverted) to form the
true binary number of 1001.
SEVEN-SEGMENT LED DISPLAYS
Definition: An output device used to display decimal
numbers in seven-segment display

Just now we have seen that, Encoder is used to translate the decimal
numbers into binary code (BCD).

Decimal
ENCODERS BCD code
Numbers

Translate

So then, how to display this BCD code?

Seven-segment display
SEVEN-SEGMENT LED DISPLAYS
Figure shows seven-segment identification labelled “a” through “g”.
The displays representing decimal digits 0 through 9.
For example, if segments a, b, and c are lit, a decimal 7 is displayed.
If segment a through g are lit, a decimal 8 is displayed.

Figure:
(a) Segment identification.
(b) Decimal numbers on typical seven-segment display.
SEVEN-SEGMENT LED DISPLAYS

Several common seven-segment


display packages are shown in
Figure (a), (b), and (c).
Figure (a) : DIP seven-segment
LED display.
Figure (b) : A common 10-pin
single-digit package. Note the
location of pin 1. Pins are
numbered counterclockwise
from pin 1 when viewed from
the top of the display.
Figure (c) : Multidigit package.
SEVEN-SEGMENT LED DISPLAYS

Gas-discharge tube
It operates at high
voltages and gives off an
orange glow.
Incandescent display
Each of segments being a Vacuum fluorescent (VF)
thin filament that glows It operates at low
(similar to regular lamp) voltages and gives off a
blue-green glow when lit.
Types of display

Light emitting diode (LED)


Liquid-crystal display (LCD)
The common LED display
It creates numbers in a black
gives off a characteristic
or silver color
reddish glow when lit.
SEVEN-SEGMENT LED DISPLAYS
Light emitting diode (LED)

Figure (a) and (b) show a basic single LED.


Figure (a) shows the cutaway view of the LED
with the small exposed diode chip with a reflector
to project the light upward toward the plastic
lens.
Figure (b) shows the physical view on LED. The (a)
flat area represents the cathode side of the LED.
LED basically a PN-junction diode. When the
(b)
diode is forward biased, current flow through the
PN-junction and LED lights.
Many LEDs are fabricated from GaAs (Gallium
arsenide) and several related materials.
LEDs come in several colors including red, green,
orange, blue, and amber.
SEVEN-SEGMENT LED DISPLAYS
Light emitting diode (LED)

A single LED is being tested as shown in figure.


When the switch (SW1) is closed, current flows
from the 5V power supply through the LED,
causing it to light.
The series resistor limits current to about 20
mA. Without the limiting resistor the LED
would burn out.
Typically, LEDs can accept only about 1.7 to 2.1
V across their terminals when lit.
LED is sensitive to polarity, thus the cathode
(K) must be towards the negative (GND)
terminal while the anode (A) must toward the
positive terminal of the power supply.
SEVEN-SEGMENT LED DISPLAYS
Seven-segment LED displays

In seven-segment LED displays, each segment


(a through g) contains an LED, as shown by the
seven symbols.
The display shown has all the anode tied
together and coming out the right side as a
single connection (common anode).
The inputs on the left go to the various
segments of the display.
Figure shows the common-anode seven-
segment LED display.
These units can also be purchased in common
cathode form.
SEVEN-SEGMENT LED DISPLAYS
Seven-segment LED displays

To understand how segments on the display are


activated and lit, consider the circuit presented.
If switch b is closed, current flows from GND
through the limiting resistor to the b-segment
LED and out the common-anode connection to
the power supply. Only segment “b” will light.
Suppose we want the decimal 7 to light on the
display, switches a, b, and c would be closed.
Then, segment a, b, and c will light. The decimal
7 would light on the display.
Likewise, if the decimal 5 were to be lit, switches
a, c, d, f, and g would be closed. These 5 switches In practice, the display driver is
would ground the correct segments, and a usually packaged in the same IC
decimal 5 would appear on the display. Note that as the decoder. Therefore, it is
it takes a GND voltage (LOW logic level) to common to speak of seven-
activate the LED segments on this display segment decoder/drivers.
DECODERS
Decoder is an electronic translator that
Definition:
translates the 8421 BCD code to a seven-
segment display.

Once the 8421 BCD code is translated


into a seven-segment display, the
display will lights the proper segments
on the displays.
The display will shows in decimal
numbers.
Figure shows the BCD number 0101 at
the input of the BCD-to-seven-
segment decoder/driver. The decoder
activates outputs a, c, d, f, and g to
light the segments (the decimal 5
lights up on the display).
DECODERS
This table will helps you to determine how decoder works when
translating 8421 BCD codes into seven-segment-decoder/display
DECODERS
Decoders come in several varieties, such as illustrated in the following figure.
Notice that, the same block diagram is used for the 8421 BCD, the excess-3,
and the Gray decoder.
Types of decoders
available such as :
BCD converters,
BCD-to-binary
converters,
4-to-16-line decoder,
and
2-to-4-line decoders
Decimal-to-octal
8-to-3 line priority
A typical decoder block diagram. Note that inputs
encoder
may be 8421 BCD, Excess-3, or Gray code
DECODERS
Decoders, like encoders, are combinational logic circuits with
several inputs and outputs.
Most decoders contain from 20 to 50 gates.
Most decoders and encoders are packaged in single IC packages.
Specialized encoders and decoders can be fabricated using
programmable logic devices (PLDs).
BCD-TO-SEVEN-SEGMENT DECODER/DRIVERS
A logic symbol for a commercial TTL 7447A BCD-to-seven-segment decoder/driver is
shown below.
The BCD number to be decoded is applied to the inputs labelled D, C, B, and A.
When activated with a LOW:
the lamp test (LT) input activates all outputs (a to g).
the blanking input (BI) makes all outputs HIGH, turning all attached displays OFF.
the ripple-blanking input (RBI) blanks the display only if it contains a 0. When RBI input
activated, the BI/RBO pin temporarily becomes the ripple-blanking output (RBO) and
drops to a LOW. Remember that, “blanking” means to cause no LEDs on the display to
Light.
The seven outputs on the 7447A decoder/driver are all active LOW outputs. In the other
words, the outputs are normally HIGH and drop to a LOW when activated.
BCD-TO-SEVEN-SEGMENT DECODER/DRIVERS
The exact operation of the 7447A decoder/driver IC is detailed in the truth table furnished by Texas Instruments and
reproduced in following Figure.
BCD-TO-SEVEN-SEGMENT DECODER/DRIVERS
The decimal displays generated by the 7447A decoder from previous truth table is shown below.

The 7447A decoder/driver IC is typically connected to a common-anode seven-segment display.


Such a circuit is shown below.

It is special important that


the seven 150-Ω limiting
resistors be wired between
the 7447A IC and the seven-
segment display.
BCD-TO-SEVEN-SEGMENT DECODER/DRIVERS

Assume that the BCD input to the 7447A decoder/driver in previous figure is 0001
(LLLH).
This is equal to line 2 of the truth table.
This input combination causes segments b and c on the seven-segment display to light
(outputs b and c drop to LOW). Then decimal 1 is displayed.
Since the LT and two BIs are not shown in the previous figure.
So, when not connected, they are assumed to be “floating” HIGH and therefore
disabled in this circuit.
Good design practice suggests that these “floating” inputs should be connected to +5V
to make sure they stay HIGH.
BCD-TO-SEVEN-SEGMENT DECODER/DRIVERS
Many applications, such as calculator or cash register, require that the leading zeros be blanked.
The illustration below shows the use of 7447A decoder/drivers operating a group of displays as in
a cash register.
The six-digit display example
details how the blanking of
leading 0s would be
accomplished using the
7447A IC driving LED displays.

The inputs to the six decoders


are shown across the bottom
of the figure. The BCD input
is 0000 0000 0011 1000 0001
0000 (003810 in decimal)

The two left 0s should be


blanked, so the display reads
38.10

The blanking of the leading 0s


is handled by wiring the RBI
and RBO pins to each 7447A
decoder IC together.
BCD-TO-SEVEN-SEGMENT DECODER/DRIVERS
How does it works?

For the BCD input to IC1 is


0000BCD and a zero (0)
appears on the display. The
The RBI input of IC6 is
zero on the IC1 display is not
grounded . From the truth
blanked because the RBI
table (for 7447A) it can be
input is not activated
determined that when RBI is
(RBI=HIGH). The first row of
LOW and when all BCD inputs
the truth table shows that the
are LOW, then all segments of
7447A decoder/driver will
the display are blanked or off.
display the zero when RBI is
Also the RBO is forced LOW
HIGH.
then it passed to the RBI of
IC5
Even with the RBI LOW IC4
does not blank the display
With the BCD input to IC5 as
because the BCD input is
0000 and the RBI at LOW, the
0011. the RBO of IC4 remains
display is also blanked. The
HIGH, which is sent to IC3.
RBO of IC5 is forced LOW and
is passed to the RBI input of
IC4.
LIQUID CRYSTAL DISPLAYS (LCD)
LED: LCD:
Generates light Controls available light

A liquid-crystal display (LCD) controls reflection


of available light.
 The light may be ambient (room, sun) light.
 Reflective LCDs use ambient light.
 Available light might be provided by a small light source—
part of the display unit.
 Backlit LCDs use this method.
LCDs have gained wide acceptance due to their very low
power consumption—compared to LEDs.
 LEDs have the advantage of a much brighter display that is
easily visible in dark or poorly lit areas.
LIQUID CRYSTAL DISPLAYS (LCD)

Basic Applying voltage between the


arrangement. segment and the backplane
turns the segment ON.

Zero voltage turns the segment OFF.


LIQUID CRYSTAL DISPLAYS (LCD)

Driving a 7-segment
display.

It is common to produce
required ac voltage by
applying out-of-phase
square waves to the
segment and the
backplane.
LIQUID CRYSTAL DISPLAYS (LCD)

 Liquid crystals are available as multidigit 7- segment


decimal numeric displays.
 Alphanumeric LCD modules are available in
many formats—up to 4 lines by 40 characters.
 Other LCD modules allow the user to create a graphical
display by controlling individual dots on the screen called
pixels.
 Larger LCD panels can be scanned at a high rate,
producing high quality video motion pictures.
 Control lines are arranged in rows & columns.
 A digital system must activate a matrix row/column to
control the amount of light at each pixel.
LIQUID CRYSTAL DISPLAYS (LCD)
 Each pixel on a color display is made up of three subpixels,
which control light passing through a red, green, or blue
filter to produce pixel color.

A 640 x 480 LCD screen would


have 640 x 3 connections for
columns and 480 connections
for rows—a total of 2400
connections to the LCD.
LIQUID CRYSTAL DISPLAYS (LCD)

 Older screens are called Twisted Nematic (TN)


or Super Twisted Nematic (STN).
 Referred to as passive LCDs.
 Newer displays are called active matrix TFT LCDs.
 An active element on the display is used to switch pixels on
and off.
 Other display technologies—vacuum fluorescent, gas
discharge plasma, and electroluminescence.
 Optical physics for each of these displays varies.
 The means of controlling all of them is the same.

END OF LECTURE

You might also like