Module –I Codes: Weighted and non-weighted codes

Slides:



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

ECE 331 – Digital System Design
Chapter 1 Binary Systems 1-1. Digital Systems
Digital Fundamentals Floyd Chapter 2 Tenth Edition
EECC341 - Shaaban #1 Lec # 3 Winter Binary Multiplication Multiplication is achieved by adding a list of shifted multiplicands according.
CS2100 Computer Organisation
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
CS1104: Computer Organisation comp. nus. edu
Digital Fundamentals Floyd Chapter 2 Tenth Edition
MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 1 Overflow Signed binary is in fixed range -2 n-1  2 n-1 If the answer for addition/subtraction more than the.
Number System and Codes
Number Systems and Codes
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
Digital Systems and Logic Design
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Binary Arithmetic & Data representation
The Digital Codes.
Digital Logic Lecture 4 Binary Codes The Hashemite University Computer Engineering Department.
Morgan Kaufmann Publishers
Topic 2 – Introduction to Computer Codes. Computer Codes A code is a systematic use of a given set of symbols for representing information. As an example,
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 2 Number.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
UNIVERSAL COLLEGE OF ENGINEERING AND TECHNOLOGY PREPARED BY:- Chirag Parmar ( ) Kashish Soni ( ) Maitrey Bhatt( )
Yuh-Jzer JoungDigital Systems1 Number Systems decimal number : 7397=7× × × ×10 0 a 4 a 3 a 2 a 1 a 0. a -1 a -2 = a 4 ×10 4 +a 3 ×10.
CS151 Introduction to Digital Design
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Number Systems and Codes. CS2100 Number Systems and Codes 2 NUMBER SYSTEMS & CODES Information Representations Number Systems Base Conversion Negative.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Logical Circuit Design Week 2,3: Fundamental Concepts in Computer Science, Binary Logic, Number Systems Mentor Hamiti, MSc Office: ,
Summer 2012ETE Digital Electronics1 Binary Arithmetic of Signed Binary Numbers.
ECE 2110: Introduction to Digital Systems BCD, Gray, Character, Action/Event, Serial Data.
Complements and Codes by Dr. Amin Danial Asham. References  Digital Design 5 th Edition, Morris Mano  Programmable Controllers-Theory and Implementation,
1. Number Systems Chapt. 2 Location in course textbook.
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.
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Signed Binary Numbers Arithmetic Subtraction – In 2’s-complement form: Example: 1.Take the 2’s complement of the subtrahend (including the sign bit) and.
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.
WEEK #11 FUNCTIONS OF COMBINATIONAL LOGIC (PART 4)
1 Digital Design Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
Unit - 3 NUMBER SYSTEM AND 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.
Introduction to Digital Electronics Lecture 2: Number Systems.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
ECE DIGITAL LOGIC LECTURE 4: BINARY CODES Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/26/2016.
Computer Math CPS120 Introduction to Computer Science Lecture 7.
Dr. Nermin Hamza. Agenda Signed Numbers Properties of Switching Algebra.
Ch2 Number systems and codes
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.
Dr. ClincyLecture 2 Slide 1 CS Chapter 2 (1 of 5) Dr. Clincy Professor of CS Note: Do not study chapter 2’s appendix (the topics will be covered.
N 3-1 Data Types  Binary information is stored in memory or processor registers  Registers contain either data or control information l Data are numbers.
Introduction to signals The signals are broadly classified into two categories: 1. Analog Signals. 2. Digital signals.
ECE 2110: Introduction to Digital Systems
CS2100 Computer Organisation
Introduction to Chapter 2
Chapter 3 Data Representation
MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
ECE 331 – Digital System Design
CHAPTER 69 NUMBER SYSTEMS AND CODES
Presentation transcript:

Module –I Codes: Weighted and non-weighted codes Digital Design Module –I Codes: Weighted and non-weighted codes Amit Kumar Assistant Professor SCSE, Galgotias University, Greater Noida

Outline Codes Types of Codes Weighted Non-Weighted

Introduction In the coding, when numbers, letters or words are represented by a specific group of symbols, it is said that the number, letter or word is being encoded. The group of symbols is called as a code. The digital data is represented, stored and transmitted as group of binary bits. This group is also called as binary code. The binary code is represented by the number as well as alphanumeric letter.

Advantages of Binary Code Following is the list of advantages that binary code offers. Binary codes are suitable for the computer applications. Binary codes are suitable for the digital communications. Binary codes make the analysis and designing of digital circuits if we use the binary codes. Since only 0 & 1 are being used, implementation becomes easy.

Classification of Binary Code The codes are broadly categorized into following four categories: Weighted Codes Non-Weighted Codes Binary Coded Decimal Code Alphanumeric Codes Error Detecting Codes Error Correcting Codes

Weighted Codes Weighted binary codes are those binary codes which obey the positional weight principle. Each position of the number represents a specific weight. Several systems of the codes are used to express the decimal digits 0 through 9. In these codes each decimal digit is represented by a group of four bits.

Non-Weighted Codes In this type of binary codes, the positional weights are not assigned. The examples of non-weighted codes are Excess-3 code and Gray code.

Binary Coded Decimal (BCD) Systems The BCD system is employed by computer systems to encode the decimal number into its equivalent binary number. This is generally accomplished by encoding each digit of the decimal number into its equivalent binary sequence. The main advantage of BCD system is that it is a fast and efficient system to convert the decimal numbers into binary numbers as compared to the pure binary system.

Binary Coded Decimal (BCD) Systems The 4-bit BCD system is usually employed by the computer systems to represent and process numerical data only. In the 4-bit BCD system, each digit of the decimal number is encoded to its corresponding 4-bit binary sequence. The two most popular 4-bit BCD systems are: Weighted 4-bit BCD code Excess-3 (XS-3) BCD code

Weighted 4-Bit BCD Code (8421) The weighted 4-bit BCD code is more commonly known as 8421 weighted code. It is called weighted code because it encodes the decimal system into binary system by using the concept of positional weighting into consideration. In this code, each decimal digit is encoded into its 4-bit binary number in which the bits from left to right have the weights 8, 4, 2, and 1, respectively.

Weighted 4-Bit BCD Code Decimal digits Weighted 4-bit BCD code 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 Apart from 8421, some other weighted BCD codes are 4221, 2421 and 5211.

Weighted 4-Bit BCD Code Represent the decimal number 5327 in 8421 BCD code. The corresponding 4-bit 8421 BCD representation of decimal digit 5 is 0101 The corresponding 4-bit 8421 BCD representation of decimal digit 3 is 0011 The corresponding 4-bit 8421 BCD representation of decimal digit 2 is 0010 The corresponding 4-bit 8421 BCD representation of decimal digit 7 is 0111 Therefore, the 8421 BCD representation of decimal number 5327 is 0101001100100111.

Advantages & Disadvantage of Binary Code Advantages of BCD Codes It is very similar to decimal system. We need to remember binary equivalent of decimal numbers 0 to 9 only. Disadvantages of BCD Codes The addition and subtraction of BCD have different rules. The BCD arithmetic is little more complicated. BCD needs more number of bits than binary to represent the decimal number. So BCD is less efficient than binary.

Excess-3 Code The Excess-3 (XS-3) BCD code does not use the principle of positional weights into consideration while converting the decimal numbers to 4-bit BCD system. Therefore, we can say that this code is a non-weighted BCD code. The function of XS-3 code is to transform the decimal numbers into their corresponding 4-bit BCD code. In this code, the decimal number is transformed to the 4-bit BCD code by first adding 3 to all the digits of the number and then converting the excess digits, so obtained, into their corresponding 8421 BCD code. Therefore, we can say that the XS-3 code is strongly related with 8421 BCD code in its functioning.

Excess-3 Code The excess-3 codes are obtained as follows

Example

Excess-3 Code Convert the decimal number 85 to XS-3 BCD code. Add 3 to each digit of the given decimal number as: 8+3=11 5+3=8 The corresponding 4-bit 8421 BCD representation of the decimal digit 11 is 1011. The corresponding 4-bit 8421 BCD representation of the decimal digit 8 is 1000. Therefore, the XS-3 BCD representation of the decimal number 85 is 1011 1000.

The Gray Code Unweighted (not an arithmetic code). Only a single bit change from one code number to the next. Good for error detection.

The Gray Code 0000 0001 0100 0101 0111 0110 0010 0011 0001 0000 1100 1101 1111 1110 1010 1011 1001 1000 0001 0000 0011 0010 0110 0111 0101 0100 0010 0011 0001 0000 Generating 4-bit standard Gray code.

Binary-to-Gray Code Conversion Retain most significant bit. From left to right, add each adjacent pair of binary code bits to get the next Gray code bit, discarding carries. Example: Convert binary number 10110 to Gray code. (10110)2 = (11101)Gray

Binary-to-Gray Code Conversion

Gray-to-Binary Conversion Retain most significant bit. From left to right, add each binary code bit generated to the Gray code bit in the next position, discarding carries. Example: Convert Gray code 11011 to binary. (11011)Gray = (10010)2

Gray-to-Binary Conversion

Application of Gray code Gray code is popularly used in the shaft position encoders. A shaft position encoder produces a code word which represents the angular position of the shaft.

Self-Complementing Codes Examples: excess-3, 84-2-1, 2*421 codes. The codes that represent the pair of complementary digits are complementary of each other. Excess-3 code 0: 0011 1: 0100 2: 0101 3: 0110 4: 0111 5: 1000 6: 1001 7: 1010 8: 1011 9: 1100 241: 0101 0111 0100 758: 1010 1000 1011

Alphanumeric Codes Apart from numbers, computers also handle textual data. Character set frequently used includes: alphabets: ‘A’ .. ‘Z’, and ‘a’ .. ‘z’ digits: ‘0’ .. ‘9’ special symbols: ‘$’, ‘.’, ‘,’, ‘@’, ‘*’, … non-printable: SOH, NULL, BELL, … Usually, these characters can be represented using 7 or 8 bits.

Alphanumeric Codes ASCII: 7-bit, plus a parity bit for error detection (odd/even parity).

Alphanumeric Codes ASCII table:

Error Detection Codes Errors can occur data transmission. They should be detected, so that re-transmission can be requested. With binary numbers, usually single-bit errors occur. Example: 0010 erroneously transmitted as 0011, or 0000, or 0110, or 1010. Biquinary code uses 3 additional bits for error-detection. For single-error detection, one additional bit is needed.

Error Detection Codes Parity bit. Example: Odd parity. Even parity: additional bit supplied to make total number of ‘1’s even. Odd parity: additional bit supplied to make total number of ‘1’s odd. Example: Odd parity. Parity bits

Error Detection Codes Parity bit can detect odd number of errors but not even number of errors. Example: For odd parity numbers, 10011  10001 (detected) 10011  10101 (non detected) Parity bits can also be applied to a block of data: Column-wise parity Row-wise parity

Error Detection Codes Sometimes, it is not enough to do error detection. We may want to do error correction. Error correction is expensive. In practice, we may use only single-bit error correction. Popular technique: Hamming Code.