Lecture 2 digital logic gate

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 17

ICE-2109: DIGITAL LOGIC DESIGN

Dr. Mohammad Amzad Hossain


Associate Professor
Department of Information & Communication Engineering
Noakhali Science & Technology University
Gray Code
2

 The Gray Code is a sequence of binary number systems, which is


also known as reflected binary code. In this code, two successive
numbers are differed by one bit of binary digits.

 In the typical sequence of binary numbers produced by the


hardware that could provide an error or ambiguity during the
change from one number to the next. Gray code simply solves this
problem by changing only one bit when the transition is between
numbers is done.
Binary to Gray code conversion
3
Decimal Number 4-bit Binary Code 4-bit Gray Code

ABCD G 1G 2G 3G 4
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000
Binary to Gray code conversion
4
Binary to Gray code conversion
5

 How to Convert Binary to Gray Code


• In the Gray code, the MSB will always be the same as the 1'st bit
of the given binary number.
• In order to perform the 2nd bit of the gray code, we perform the
exclusive-OR (XOR) of the 1'st and 2nd bit of the binary number.
It means that if both the bits are different, the result will be one
else the result will be 0.
• In order to get the 3rd bit of the gray code, we need to perform the
exclusive-OR (XOR) of the 2nd and 3rd bit of the binary number.
The process remains the same for the 4th bit of the Gray code.
Let's take an example to understand these steps.
Binary to Gray code conversion
6

 Example
Gray to Binary Code Conversion
7
Gray to Binary Code Conversion
8

 Example
BCD or Binary Coded Decimal
9

 Binary Coded Decimal (BCD) is another process for converting


decimal numbers into their binary equivalents.

 This encoding can be done in either 4-bit or 8-bit (usually 4-bit is


preferred).

 It is a fast and efficient system that converts the decimal numbers


into binary numbers as compared to the existing binary system.

 These are generally used in digital displays where is the


manipulation of data is quite a task.
Truth Table for Binary Coded Decimal
10

DECIMAL NUMBER BCD


0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Decimal-to-BCD Conversion
11

 Convert (123)10 in BCD

From the truth table above,


1 -> 0001
2 -> 0010
3 -> 0011
Thus, BCD becomes -> (0001 0010 0011)2
BCD-to-Decimal Conversion
12

 In the first step, we will convert the BCD number into a decimal
by making the four-bit groups and finding the equivalent decimal
number for each group.
 In the last step, we will convert a decimal number into Binary
using the process of converting decimal to binary number.

Steps BCD Number Conversion

Step 1 (00101000)BCD (0010)2 (1000)2

Step 2 (00101000)BCD (2)10 (8)10

Step 3 (00101000)BCD (28)10


Limitation of BCD
13

1. Inefficiency in Storage: BCD requires more bits to represent a decimal digit


compared to pure binary representation. For example, in 4-bit BCD, each decimal
digit is represented by a 4-bit binary number, while in pure binary, it would only
require 3 bits. This inefficiency can lead to wasted storage space.
2. Limited Range: BCD representation typically limits the range of numbers that can be
represented within a given number of bits. For example, in 4-bit BCD, only decimal
digits 0 through 9 can be represented.
3. Complexity in Arithmetic Operations: Performing arithmetic operations directly on
BCD numbers can be more complex and less efficient compared to pure binary
arithmetic.
4. Difficulty in Hardware Implementation: BCD arithmetic operations often require
specialized hardware support, increasing the complexity and cost of hardware
implementations compared to pure binary arithmetic.
5. Limited Support in Modern Computing: While BCD was more commonly used in
older computing systems, modern computing platforms and programming languages
often favor pure binary representation due to its simplicity, efficiency, and widespread
support in hardware and software.
ASCII (American Standard Code for
14
Information Interchange)
 ASCII, in full American Standard Code for Information
Interchange, is a standard data-encoding format for
electronic communication between computers.
 ASCII assigns standard numeric values to letters,
numerals, punctuation marks, and other characters used
in computers.
 Before ASCII was developed, different models of
computers could not communicate with one another.
Each computer manufacturer represented alphabets,
numerals, and other characters in its own way.
ASCII (American Standard Code for
15
Information Interchange)
 ASCII Table: In the following, you can see the ASCII
table with codes in decimal, hexadecimal and octal
notation.
Limitations of ASCII
16

 Only having the ability to support 256 characters is


limiting for many languages and impossible for Asia
languages like Chinese. To help overcome this
limitation, Unicode was created and adopted by all
countries.
What is Unicode?
17

 Unicode is a universal encoding system to provide a


comprehensive character set and it created by the
Unicode Consortium. Basically, Unicode is an
international character encoding standard that provides a
unique number for every character across languages and
scripts, making almost all characters accessible across
platforms, programs, and devices. It aims to provide a
unique code point for every character, regardless of
platform, application, or language.
 It overcomes the difficulty in ASCII and extended
ASCII.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy