ECE – III SEM BINARY CODES

Slides:



Advertisements
Similar presentations
Technology ICT Option: Data Representation. Data Representation In our everyday lives, we communicate with each other using analogue data. This data takes.
Advertisements

Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
A digital system is a system that manipulates discrete elements of information represented internally in binary form. Digital computers –general purposes.
Chapter 1 Binary Systems 1-1. Digital Systems
Digital Fundamentals Floyd Chapter 2 Tenth Edition
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
ITEC 1011 Introduction to Information Technologies 2. Data Formats Chapt. 3.
9/15/09 - L3 CodesCopyright Joanne DeGroat, ECE, OSU1 Codes.
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
©Brooks/Cole, 2003 Chapter 2 Data Representation.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Programmable Logic Controllers
Numeral Systems Subjects: Numeral System Positional systems Decimal
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 1 – Digital Systems and Information Logic.
Computers Organization & Assembly Language
Binary Codes Computers and other digital systems "work" with binary numbers. I/P & O/P is usually done using decimal numbers, alphabetics, special symbols.
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Chapter 2 Computer Hardware
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Number Systems Spring Semester 2013Programming and Data Structure1.
1.7 BINARY CODES BCD Code (Binary –Coded Decimal ) BCD Addition
UNIVERSAL COLLEGE OF ENGINEERING AND TECHNOLOGY PREPARED BY:- Chirag Parmar ( ) Kashish Soni ( ) Maitrey Bhatt( )
Introduction to Computer Design CMPT 150 Section: D Ch. 1 Digital Computers and Information CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 1.
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
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.
CHAPTER 1 BINARY SYSTEMS
ECE 3110: Introduction to Digital Systems BCD, Gray, Character, Action/Event, Serial Data.
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: ,
Complements and Codes by Dr. Amin Danial Asham. References  Digital Design 5 th Edition, Morris Mano  Programmable Controllers-Theory and Implementation,
1 Lect # 1 Binary Systems Digital vs. Analog Analog – a continuous range of values Digital – a discrete set of values –Like money –Can’t get smaller than.
Data Representation Conversion 24/04/2017.
Codes by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Data Representation, Number Systems and Base Conversions
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
Data Representation. What is data? Data is information that has been translated into a form that is more convenient to process As information take different.
MECH1500 Chapter 3.
Chapter 1: Binary Systems
Module –I Codes: Weighted and non-weighted codes
ASCII AND EBCDIC CODES By : madam aisha.
Characters and Strings
ECE DIGITAL LOGIC LECTURE 4: BINARY CODES Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/26/2016.
2. Data Formats. Introduction Examples pp Real World Data Computer Data Input device Dear Mom: Keyboard … Digital camera …
ECE DIGITAL LOGIC LECTURE 2: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/14/2016.
Fall’ 2014 Lesson - 1 Number System & Program Design CSE 101.
Dr. Nermin Hamza. Agenda Signed Numbers Properties of Switching Algebra.
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.
Digital logic COMP214  Lecture 2 Dr. Sarah M.Eljack Chapter 1 1.
Number Systems By, B. R. Chandavarkar CSE Dept., NITK, Surathkal.
Chapter 1 Digital Systems and Binary Numbers
Programming and Data Structure
Lec 3: Data Representation
Lecture No. 4 Number Systems
Number Representation
3.1 Denary, Binary and Hexadecimal Number Systems
Introduction The term digital is derived from the way computers perform operation, by counting digits. Application of digital technology: television, communication.
Chapter 1 Digital Systems and Binary Numbers
Ch2: Data Representation
2. Data Formats Chapt. 3.
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Chapter Four Data Representation in Computers By Bezawit E.
ECE 331 – Digital System Design
CHAPTER 69 NUMBER SYSTEMS AND CODES
Presentation transcript:

ECE – III SEM BINARY CODES Manav Rachna University Manav Rachna College of Engineering

BINARY CODES Electronic digital systems use signals that have two distinct values and circuit elements that have two stable states. There is a direct analogy among binary signals, binary circuit elements, and binary digits. A binary number of n digits, for example, may be represented by n binary circuit elements, each having an output signal equivalent to a 0 or a 1. Digital systems represent and manipulate not only binary numbers, but also many other discrete elements of information. Any discrete element of information distinct among a group of quantities can be represented by a binary code. For example, red is one distinct color of the spectrum. The letter A is one distinct letter of the alphabet. A bit, by definition, the binary digit. When used in conjunction with a binary code, it is better to think of it as denoting a binary quantity equal to 0 or 1. To represent a group of 2n distinct elements in a binary code requires a minimum of n bits. This is because it is possible to arrange n bits in 2n distinct ways. For example, a group of four distinct quantities can be represented by a two-bit code, with each quantity assigned one of the following bit combinations: 00, 01, 10, 11. Manav Rachna University

A group of eight elements requires a three-bit code, with each element assigned to one of the following: 000, 001, 010, 011, 100, 101, 110, 111. The examples show that the distinct bit combinations of an n- bit code can be found by counting in binary from 0 to (2n-1). Some bit combinations of n-bit code can be found by the number of elements of the group to be coded is not a multiple of the power of 2. The ten decimal digits 0, 1, 2, 3, …., 9 are an example of such a group. A binary code that distinguishes among ten elements must contain at least four bits; three bits can distinguish a maximum of eight elements. Four bits can form 16 distinct combinations, but since only ten digits are coded, the remaining six combinations are unassigned and not used Although the minimum number of bits required to code 2n distinct quantities is n, there is no maximum number of bits that may be used for a binary code.] For example, the ten decimal digits can be coded with ten bits, and each decimal digit assigned a bit combination of nine 0’s and a 1.In this particular binary code, the digit 6 is assigned the bit combination 0001000000. Manav Rachna University

Binary Codes Binary codes are codes which are represented in binary system with modification from the original ones. Below we will be seeing the following:   Weighted Binary Systems Non Weighted Codes Manav Rachna University Manav Rachna College of Engineering

Weighted Binary Systems Weighted binary codes are those which obey the positional weighting principles, each position of the number represents a specific weight. The binary counting sequence is an example Manav Rachna University

Decimal 8421 2421 5211 Excess-3 0000 0011 1 0001 0100 2 0010 0101 3 0110 4 1010 0111 5 1011 1000 6 1001 7 1101 1100 8 1110 9 1111 Manav Rachna University

Manav Rachna College of Engg. Binary Codes A binary code is a group of n bits that assume up to 2n distinct combinations of 1’s and 0’s with each combination representing one element of the set that is being coded. Manav Rachna University Manav Rachna College of Engg. BCD – Binary Coded Decimal ASCII – American Standard Code for Information Interchange

BCD – Binary Coded Decimal Decimal BCD Number Number 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 When the decimal numbers are represented in BCD, each decimal digit is represented by the equivalent BCD code.(4-BITS PER DIGIT) Example :BCD Representation of Decimal 6349 6 3 4 9 0110 0011 0100 1001 Manav Rachna University

8421/BCD Codes Binary codes for decimal digits require a minimum of four bits. Numerous different codes can be obtained by arranging four or more bits in ten distinct possible combinations. The BCD (Binary Coded Decimal) is a straight assignment of the binary equivalent. It is possible to assign weights to the binary bits according to their positions. The weights in the BCD code are 8,4,2,1. Example: The bit assignment 1001, can be seen by its weights to represent the decimal 9 because:   1x8+0x4+0x2+1x1 = 9 Manav Rachna University

When specifying data, the user likes to give the data in decimal form. The BCD (binary-coded decimal) is a straight assigned of the binary equivalent. It is possible to assign weight to the binary bits according to their position. The weights in the BCD code are 8,4,2,1. The weights in the BCD code are 8,4,2,1. The bit assignment 0110 for example can be interpreted by the weights to represent the decimal digit 6 because 0X8+1X4+1X2+0X1=6. Numbers are represented in digital computers either in binary or in decimal through a binary code. When specifying data, the user likes to give the data in decimal form. The input decimal numbers are stored internally in the computer by means of decimal code. Each decimal digit requires at least four binary storage elements. The decimal numbers are converted to binary when arithmetic operations are done internally with numbers represented in binary. Manav Rachna University

It is possible to perform the arithmetic operations directly in decimal with all numbers left in a coded form throughout. For example, the decimal number 395, when converted to binary, is equal to 110001011 and consists of nine binary digits. The same number, when represented internally in the BCD code, occupies four bits of each decimal digit, for a total of 12 bits 001110010101. The first four bits represent a 3, the next four a 9 and the last four a 5. It is every important to understand the difference between conversion of a decimal number to binary and the binary coding of a decimal number. In each case the final results is a series of bits. The bits obtained from conversion are binary digits. Bits obtained from coding are combinations of 1’s and 0’s in the digital system may sometimes represent a binary number and at other times represent some other discrete quantity of information as specified by a given binary code. Manav Rachna University

The BCD code, for example, has been chosen to be both a code and a direct binary conversion, as long as the decimal numbers are integers from 0 to 9. For numbers greater than 9, the conversion and the coding are completely different. This concept is so important that it is worth repeating with another example. The binary conversion of decimal 13 is 1101, the coding of decimal 13 with BCD is 00010011. Manav Rachna University

Binary Codes for the decimal digits (BCD) 8421 Excess-3 84-2-1 2421 (Biquinary) 5043210 0000 0011 0100001 1 0001 0100 0111 0100010 2 0010 0101 0110 0100100 3 0101000 4 0110000 5 1000 1011 1000001 6 1001 1010 1100 1000010 7 1101 1000100 8 1110 1001000 9 1111 1010000 Binary Codes for the decimal digits Manav Rachna University The components used to construct digital systems are enclosed within IC packages. It is important that the digital designer be familiar w/ the various digital components encountered in IC form

BINARY CODES It is possible to assign weights to the binary bits according to their positions. BCD code, 84-2-1, 2421, 5043210 Weighted codes Numbers are represented in digital computers either in binary or in decimal through a binary code. Manav Rachna University When specifying data, the user likes to give the data in decimal form.

2421 Code This is a weighted code, its weights are 2, 4, 2 and 1. A decimal number is represented in 4-bit form and the total four bits weight is 2 + 4 + 2 + 1 = 9. Hence the 2421 code represents the decimal numbers from 0 to 9. Manav Rachna University

5211 Code This is a weighted code, its weights are 5, 2, 1 and 1. A decimal number is represented in 4-bit form and the total four bits weight is 5 + 2 + 1 + 1 = 9. Hence the 5211 code represents the decimal numbers from 0 to 9. Manav Rachna University

REFLECTION CODES A code is said to be reflective when code for 9 is complement for the code for 0, and so is for 8 and 1 codes, 7 and 2, 6 and 3, 5 and 4. Codes 2421, 5211, and excess-3 are reflective, whereas the 8421 code is not. Manav Rachna University

Sequential Codes A code is said to be sequential when two subsequent codes, seen as numbers in binary representation, differ by one. This greatly aids mathematical manipulation of data. The 8421 and Excess-3 codes are sequential, whereas the 2421 and 5211 codes are not Manav Rachna University

Non Weighted Codes Non weighted codes are codes that are not positionally weighted. That is, each position within the binary number is not assigned a fixed value.   Manav Rachna University

WHAT ARE GRAY CODES Manav Rachna University

REFLCETED CODES Reflected Code(also known as the Gray code) Digital systems can be designed to process data in discrete form only. Many physical systems supply continuous output data. These data must be converted into digital or discrete form before they are applied to a digital system. Advantage: A number in the reflected code changes by only one bit as it proceeds from one number to the next. Manav Rachna University

Forming a Gray Code Start with all 0's Change the least significant bit that forms a new code word 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 a b c d e Manav Rachna College of Engg.

Binary Reflected Gray Code 0 0 0 1 0 1 2 1 1 3 1 0 0 0 0 0 0 1 0 0 0 1 2 0 0 1 1 3 0 0 1 0 4 0 1 1 0 5 0 1 1 1 6 0 1 0 1 7 0 1 0 0 8 1 1 0 0 9 1 1 0 1 10 1 1 1 1 11 1 1 1 0 12 1 0 1 0 13 1 0 1 1 14 1 0 0 1 15 1 0 0 0 0 0 0 0 1 0 0 1 2 0 1 1 3 0 1 0 4 1 1 0 5 1 1 1 6 1 0 1 7 1 0 0 Manav Rachna College of Engg.

Reflected Gray and Binary Codes Binary Gray 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 2 0 0 1 0 0 0 1 1 3 0 0 1 1 0 0 1 0 4 0 1 0 0 0 1 1 0 5 0 1 0 1 0 1 1 1 6 0 1 1 0 0 1 0 1 7 0 1 1 1 0 1 0 0 8 1 0 0 0 1 1 0 0 9 1 0 0 1 1 1 0 1 10 1 0 1 0 1 1 1 1 11 1 0 1 1 1 1 1 0 12 1 1 0 0 1 0 1 0 13 1 1 0 1 1 0 1 1 14 1 1 1 0 1 0 0 1 15 1 1 1 1 1 0 0 0 Manav Rachna College of Engg.

Why Gray Codes? Single output changes at a time Asynchronous sampling Permits asynchronous combinational circuits to operate in fundamental mode Potential for power savings Multiphase, multifrequency clock generator Manav Rachna College of Engg.

Why Gray Codes? Manav Rachna College of Engg.

Why Gray Codes? Manav Rachna College of Engg.

BINARY CODES Reflected Code Decimal Equivalent 0000 0001 1 0011 2 0010 0001 1 0011 2 0010 3 0110 4 0111 5 0101 6 0100 7 1100 8 Manav Rachna College of Engg.

BINARY CODES 1101 9 1111 10 1110 11 1010 12 1011 13 1001 14 1000 15 Manav Rachna College of Engg.

The Reflected Code Digital system can be designed to process data in discrete form only. Many physical systems supply continuous output data. These data must be converted into digital or discrete form before they are applied to a digital system. Continuous or analog information is converted to use the reflected code shown in table 1-4 to represent the digital data converted from the analog data. The advantage of the reflected code over pure binary numbers is that a number in the reflected code changes by only one bit as it proceeds from one number to the next. A typical application of the reflected code occurs when the analog data are represented by a continuous change of a shaft position. The shaft is partitioned into segments, and each segment is assigned a number. Manav Rachna College of Engg.

APPLICATION OF GRAY CODE Manav Rachna College of Engg.

APPLICATION OF GRAY CODE Manav Rachna College of Engg.

GRAY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

CONVERTING BETWEEN GRAY & BINARY CODES Manav Rachna College of Engg.

Excess-3 Code Excess-3 is a non weighted code used to express decimal numbers. The code derives its name from the fact that each binary code is the corresponding 8421 code plus 0011(3).   Example: 1000 of 8421 = 1011 in Excess-3 Manav Rachna College of Engg.

EXCESS-3 CODE Manav Rachna College of Engg.

Alphanumeric Codes Many applications of digital computers require the handling of data that consist not only of numbers, but also of letters. For instance, an insurance company with millions of policy holders may use a digital computer to process its files. To represent the policy holder’s name in binary form, it is necessary to have a binary code for the alphabet. In addition, the same binary code must represent decimal numbers and some other special characters. An alphanumeric (sometimes abbreviated alphanumeric) code is binary code of a group of element consisting of special symbol such as $. The total number of elements in an in alphanumeric group is greater than 36. Manav Rachna College of Engg.

Therefore, it must be coded with a minimum of six bits (26=64, but 25 = 32) is insufficient. One possible arrangement of six –bit alphanumeric code is shown in Table1-5 under the name “internal code”. With few variations, it is used in many computers to represent alphanumeric characters internally. The need to represent more than 64 characters (the lowercase letters and special control characters for the transmission of digital information) gave rise to seven and eight-bit alphanumeric codes. One such code is known as ASCII (American Standard Code for Information Interchange); another is known as EBCDIC (Extended BCD Interchange Code). Manav Rachna College of Engg.

The ASCII code listed in table 1-5 consists of seven bits but is, for all practical purposes, an eight-bit code because an eighth bit is invariably added for parity. Most computers translate the input code into an internal six-bit code. As an example, the internal code representation of the name “John Doe” is: 100001 100110 011000 100101 110000 J O H N blank 010100 100110 010101 D O E Manav Rachna College of Engg.

ASCII CODES The Problem Representing text strings, such as “Hello, world”, in a computer Manav Rachna College of Engg.

Codes and Characters Each character is coded as a byte Most common coding system is ASCII (Pronounced ass-key) ASCII = American National Standard Code for Information Interchange Defined in ANSI document X3.4-1977 Manav Rachna College of Engg.

ASCII Features 7-bit code 8th bit is unused (or used for a parity bit) 27 = 128 codes Two general types of codes: 95 are “Graphic” codes (displayable on a console) 33 are “Control” codes (control features of the console or communications channel) Manav Rachna College of Engg.

ASCII Chart Manav Rachna College of Engg.

Most significant bit Least significant bit

e.g., ‘a’ = 1100001

95 Graphic codes

33 Control codes

Alphabetic codes

Numeric codes

Punctuation, etc.

“Hello, world” Example = Binary 01001000 01100101 01101100 01101111 00101100 00100000 01110111 01100111 01110010 01100100 Hexadecimal 48 65 6C 6F 2C 20 77 67 72 64 Decimal 101 108 111 44 32 119 103 114 100 H e l o , w r d Manav Rachna College of Engg.

Common Control Codes CR 0D carriage return LF 0A line feed HT 09 horizontal tab DEL 7F delete NULL 00 null Manav Rachna College of Engg. Hexadecimal code

Terminology Learn the names of the special symbols [ ] brackets { } braces ( ) parentheses @ commercial ‘at’ sign & ampersand ~ tilde Manav Rachna College of Engg.

Escape Sequences Extend the capability of the ASCII code set For controlling terminals and formatting output Defined by ANSI in documents X3.41- 1974 and X3.64-1977 The escape code is ESC = 1B16 An escape sequence begins with two codes: ESC [ Manav Rachna College of Engg. 5B16 1B16

Examples Erase display: ESC [ 2 J Erase line: ESC [ K Manav Rachna College of Engg.

EBCDIC Extended BCD Interchange Code (pronounced ebb’-se-dick) 8-bit code Developed by IBM Rarely used today IBM mainframes only Manav Rachna College of Engg.

THE END Manav Rachna College of Engg.