Digital Logic Lecture 4 Binary Codes The Hashemite University Computer Engineering Department.

Slides:



Advertisements
Similar presentations
KFUPM COE 202: Digital Logic Design Number Systems Part 3 Courtesy of Dr. Ahmad Almulhem.
Advertisements

Company LOGO Edit your slogan here DKT 122/3 DIGITAL SYSTEM 1 WEEK #3 NUMBER SYSTEMS, OPERATION & CODES (PART 2)
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits.
ENGIN112 L4: Number Codes and Registers ENGIN 112 Intro to Electrical and Computer Engineering Lecture 4 Number Codes and Registers.
ECE 331 – Digital System Design
Chapter 1 Binary Systems 1-1. Digital Systems
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Using Binary Coding Information Remember  Bit = 0 or 1, Binary Digit  Byte = the number of bits used to represent letters, numbers and special characters.
Using Binary Coding Information Remember  Bit = 0 or 1, Binary Digit  Byte = the number of bits used to represent letters, numbers and special characters.
CS 151 Digital Systems Design Lecture 4 Number Codes and Registers.
Representing Information as Bit Patterns Lecture 4 CSCI 1405, CSCI 1301 Introduction to Computer Science Fall 2009.
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
IT-101 Section 001 Lecture #4 Introduction to Information Technology.
Data Representation – Chapter 3 Sections 3-2, 3-3, 3-4.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
COMPUTER FUNDAMENTALS David Samuel Bhatti
9/15/09 - L3 CodesCopyright Joanne DeGroat, ECE, OSU1 Codes.
1.6 Signed Binary Numbers.
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Programmable Logic Controllers
Lecture 6 Topics Character codes Error Detection and Correction
Digital Systems and Logic Design
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Ahmad Almulhem, KFUPM 2010 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
Cosc 2150: Computer Organization
Morgan Kaufmann Publishers
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 2 Number.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
1 INFORMATION IN DIGITAL DEVICES. 2 Digital Devices Most computers today are composed of digital devices. –Process electrical signals. –Can only have.
CS151 Introduction to Digital Design
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
Number systems & Binary codes MODULE 1 Digital Logic Design Ch1-2 Outline of Chapter 1  1.1 Digital Systems  1.2 Binary Numbers  1.3 Number-base Conversions.
Number Systems and Codes. CS2100 Number Systems and Codes 2 NUMBER SYSTEMS & CODES Information Representations Number Systems Base Conversion Negative.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
1 Binary Codes Digital systems use 2-state devices that understand only 2 binary values (0 and 1). But we communicate using various symbols and methods.
Data Representation, Number Systems and Base Conversions
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  The necessity and advantages of coding  The variety of coding systems You will learn: 2.
MECH1500 Chapter 3.
1 Digital Design Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
Module –I Codes: Weighted and non-weighted codes
AGBell – EECT by Andrew G. Bell (260) Lecture 2.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
ECE DIGITAL LOGIC LECTURE 4: BINARY CODES Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/26/2016.
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
Computer Math CPS120 Introduction to Computer Science Lecture 7.
Digital Systems: Number Systems and Codes Wen-Hung Liao, Ph.D.
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Introduction to Chapter 2
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
Digital Systems: Number Systems and Codes
MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
Digital Logic & Design Lecture 03.
Dr. Clincy Professor of CS
Fundamentals of Data Representation
ECB2212-Digital Electronics Codes
COMS 161 Introduction to Computing
Learning Intention I will learn how computers store text.
ECE 331 – Digital System Design
Arithmetic Circuits.
Presentation transcript:

Digital Logic Lecture 4 Binary Codes The Hashemite University Computer Engineering Department

The Hashemite University2 Outline Introduction. Character coding. Error detection codes. Gray code. Decimal coding.

The Hashemite University3 Introduction Binary code is a sequence of 1 and 0 to represent specific values or quantities. Simply it is a substitution or a simplification technique. Binary code objectives: Security assurance: encryption and decryption techniques used to secure communication and data storage. Civil applications: such as text coding in computers, and codes used to reduce digital communication errors opportunities. Mainly we are interested in civil applications.

The Hashemite University4 General Rules of Binary Codes For n-bit binary code, the number of values that can be codes (or simply the max number of codes) = 2 n. The min number of bits required to code m values = ciel[log 10 m/log 10 2]. The max number of bit used to code m values can be >= min limit computed using the above equation (i.e. there is no restrictions on the maximum limit of the used bits). Each value must be assigned a unique code and vice versa to enable correct encoding and decoding.

The Hashemite University5 Binary Codes Types Character coding. Error detection codes. Gray code. Decimal coding.

The Hashemite University6 Character Coding -- ASCII ASCII stands for “American Standard Code for Information Interchange”. It is a 7-bit code. So, each character is assigned a 7- bit binary value. This value is used by the digital systems (e.g. Computers) to correctly store and manipulate text data. Originally used on non IBM systems. Basis of most currently used digital systems. Need to add an additional bit to make the code 8-bit to be stored in a byte. Two options are provided: Simply add 0 in the MSB. Use it in even or odd-parity error detection coding as will be seen later.

The Hashemite University7 ASCII Table

The Hashemite University8 Character Coding -- EBCDIC EBCDIC stands for “Extended Binary Coded Decimal Interchange Code”. 8-bit code. Originally used in IBM mainframes. Provide a larger set of codes than ASCII. Less common than ASCII.

The Hashemite University9 Character Coding -- Unicode Designated as the universal code for text coding. Comes to provide a large set of codes, i.e. solve the limitations found in ASCII and EBCDIC. 16-bit code. Used in the Internet.

The Hashemite University10 Error Detection Codes I Data communication requires special codes and algorithms to determine whether the received data is the same as the one transmitted, i.e. error free. The simplest error detection code is based on adding a parity bit for ASCII code. Parity means that two things are equal (identical). Simply add a 1 or 0 to the MSB in ASCII (parity) to make the number of ones in that byte either odd (odd parity) or even (even parity). Even parity is most common. E.g.: for add 0 to MSB to obtain an even parity and 1 to obtain an odd parity.

The Hashemite University11 Error Detection Codes II The sender and the receiver know in advance the used parity type (odd or even). The sender add the parity bit to each byte before transmission. The receiver checks the parity before decoding the data. Assume that even parity is used, if the number of ones in a byte found to be odd, this means that there is an error in this byte.

The Hashemite University12 Error Detection Codes III Disadvantages: Both even and odd parity can detect odd number of error bits only. So, if two bits are in error for example, the parity remains correct. Parity cannot determine the locations of the bits in error. Cannot determine the number of bits in error. What to do when detecting an error in the received message? Ask the sender to retransmit the message. Or use an error correction algorithm to recover the original message.

The Hashemite University13 Gray Code Also, known as “The Reflected Binary Code”. The main idea of Gray code is that any two subsequent codes differ in one bit only. Useful for error detection and correction in digital communication systems. Manly used in applications that produce values in an increasing (or decreasing) order, i.e. similar to the counter concept. Gray code can be 1-bit, 2-bit, 3-bit, etc., based on the number of values needed to be coded.

The Hashemite University14 3-bit Gray Code

The Hashemite University15 Gray Code Conversion I The first method includes conversion in one direction only (from binary value to Gray). Start from the LSB, if the next bit (in the higher significance location) is 1 invert the current bit. If it is 0 then do not change the current bit. E.g. convert to Gray code Answer = Inverted (1  0) since the bit after it is 1 Remains the same since the bit after it is 0

The Hashemite University16 Gray Code Conversion II The second method includes conversion in two directions and it is based on the usage of the XOR logical function. Convert Binary to Gray as follows: Copy the most significant bit For each smaller i do G[i] = XOR(B[i+1], B[i]) (to convert binary to Gray)

The Hashemite University17 Gray Code Conversion III Convert Gray to Binary as follows: Copy the most significant bit B[i] = XOR(B[i+1], G[i]) (to convert Gray to binary)

The Hashemite University18 Decimal Coding I BCD is the main example of decimal coding. BCD Code (Binary Coded Decimal): A code used to represent each decimal digit of a number by a 4-Bit Binary Value. Valid Digits for 0-9 are (0000 to 1001) the binary codes 1010 to 1111 are invalid. So, the BCD code of each digit is the binary conversion of that decimal digit. BCD comes to provide: A solution for the difficulty of the conversion between binary and decimal. Easier to be understood by humans.

The Hashemite University19 Decimal Coding II

The Hashemite University20 Decimal Coding III For a compound number of decimal (multi- digit number) the BCD of that number is simply the substitution of the BCD code of each digit. E.g  (BCD) So, n digit decimal number needs 4*n binary bits to be represented in BCD. Pay attention to number justification when it is in BCD. Also, note that numbers in BCD are decimal not binary numbers.

The Hashemite University21 Decimal Coding IV Note that a BCD digit needs 4 bit to be stored. The smallest storage unit in computer is byte which is larger than what needed by 1 BCD digit. There are two types of BCD code depending on how to store BDC digits in a byte. BCD code types: Packed BCD: a byte can store two BCD digits. So, for example, the number needs 2 bytes. Unpacked BCD: a byte can store one BCD digit in the lower nibble while the higher nibble contains zeros. So, for example, the number needs 4 bytes.

The Hashemite University22 Additional Notes This lecture covers the following material from the textbook: Chapter 1: Section 1.7