2 Number Systems and Codes Edited by Jerry Bernardini.

Slides:



Advertisements
Similar presentations
Number Systems and Codes
Advertisements

Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh.
DATA REPRESENTATION CONVERSION.
CHAPTER 2 Number Systems, Operations, and Codes
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
Chapter 1 Number Systems and Codes William Kleitz Digital Electronics with VHDL, Quartus® II Version Copyright ©2006 by Pearson Education, Inc. Upper Saddle.
Number Systems and Codes In PLC
Mantıksal Tasarım – BBM231 M. Önder Efe
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
Number Systems and Codes
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Programmable Logic Controllers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Computers Organization & Assembly Language
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
Chapter 2 – Number Systems and Codes Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
Computer System Architecture © Korea Univ. of Tech. & Edu. Dept. of Info. & Comm. Chap. 2 Number Systems and Codes Binary to Decimal Conversions.
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.
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.
Number systems, Operations, and Codes
Number Systems and Codes
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Introduction to Microprocessors Chapter 2. Decimal or Base 10 Numbers  Have ten different digits (0-9)  It is a weighted number system. Each position.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
MECH1500 Chapter 3.
Chapter 1: Binary Systems
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
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.
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
Computer Math CPS120 Introduction to Computer Science Lecture 7.
Ch2 Number systems and codes
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.
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.
Some basic concepts underlying computer archi­tecture
Chapter 1 Digital Systems and Binary Numbers
Digital Design Chapter One Digital Systems and Binary Numbers
Number Systems and Codes
Lec 3: Data Representation
Lecture No. 4 Number Systems
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
CHAPTER 1 : INTRODUCTION
Introduction to Chapter 2
Binary Arithmetic Binary arithmetic is essential in all digital computers and in many other types of digital systems. Addition, Subtraction, Multiplication,
Introduction The term digital is derived from the way computers perform operation, by counting digits. Application of digital technology: television, communication.
Number System conversions
Chapter 1 Digital Systems and Binary Numbers
University of Gujrat Department of Computer Science
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
INTRODUCTION TO LOGIC DESIGN Chapter 1 Digital Systems and Binary Numbers gürtaçyemişçioğlu.
Number Systems and Codes
Digital Systems: Number Systems and Codes
Digital Electronics & Logic Design
Complement Theory 1’s and, 2’s complement operation
Numbering System TODAY AND TOMORROW 11th Edition
Chapter Nine: Data Transmission
Chap. 2 Number Systems and Codes
UNIT – 3 & 4. Data Representation and Internal
Networks & I/O Devices.
Chapter 3 - Binary Numbering System
CHAPTER 69 NUMBER SYSTEMS AND CODES
Presentation transcript:

2 Number Systems and Codes Edited by Jerry Bernardini

Chapter 2 Objectives Convert decimal, binary, hexadecimal advantages of the hexadecimal BCD and straight binary codes ASCII code Parity error detection

2-1 Binary to Decimal Conversion Convert binary to decimal by summing the positions that contain a 1: An example with a greater number of bits: Ronald Tocci/Neal Widmer/Gregory Moss Digital Systems: Principles and Applications, 10e Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-1 Double-Dabble Binary to Decimal Conversion Binary numbers verify the double-dabble method: Ronald Tocci/Neal Widmer/Gregory Moss Digital Systems: Principles and Applications, 10e Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

Binary-Decimal- Weight Method 27 26 25 24 23 22 21 20 weight 128 64 32 16 8 4 2 1 example sum 170

Decimal to Binary Weight Method 27 26 25 24 23 22 21 20 weight 128 64 32 16 8 4 2 1 decimal example 7510 -64 11 -8 3 -2 Result

2-2 Decimal to Binary Conversion Repeated Division Divide the decimal number by 2. Write the remainder after each division until a quotient of zero is obtained. The first remainder is the LSB. The last is the MSB. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-3 Hexadecimal Number System Hexadecimal allows convenient handling of long binary strings, using groups of 4 bits—Base 16 16 possible symbols: 0-9 and A-F Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-3 Hexadecimal Number System Relationships between hexadecimal, decimal, and binary numbers. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-3 Hexadecimal Number System – Hex to Decimal Convert from hex to decimal by multiplying each hex digit by its positional weight. In a 2nd example, the value 10 was substituted for A and 15 substituted for F. For practice, verify that 1BC216 is equal to 710610 Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-3 Hexadecimal Number System – Decimal to Hex Convert from decimal to hex by using the repeated division method used for decimal to binary conversion. Divide the decimal number by 16 The first remainder is the LSB—the last is the MSB. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-3 Hexadecimal Number System – Decimal to Hex Convert 42310 to hex: Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-3 Hexadecimal Number System – Decimal to Hex Convert 21410 to hex: Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-3 Hexadecimal Number System – Hex to Binary Divide binary number into groups of four bits (nibble) Convert nibble to hex For practice, verify that BA616 = 1011101001102 Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-3 Hexadecimal Number System – Binary to Hex group bits in four starting with the LSB Each group is then converted to the hex equivalent binary number is grouped into groups of four bits & each is converted to its equivalent hex digit. For practice, verify that 101011111 2 = 15F16 Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-3 Hexadecimal Number System – Decimal to Hex to Binary Convert decimal 378 to a 16-bit binary Perform successive division by 16 Remainder in hex is each hex value 37810 = 17A16

Binary Coded Decimal -BCD Code (BCD) is a widely used each decimal digit converted to binary equivalent. The primary advantage of BCD is the relative ease of converting to and from decimal. . Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-4 BCD Code Convert the number 87410 to BCD: Each decimal digit is represented using 4 bits. Each 4-bit group can never be greater than 9. Reverse the process to convert BCD to decimal. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-4 BCD Code Convert 0110100000111001 (BCD) to its decimal equivalent. Divide the BCD number into four-bit groups and convert each to decimal. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-4 BCD Code Convert 0110100000111001 (BCD) to its decimal equivalent. Divide the BCD number into four-bit groups and convert each to decimal. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

The forbidden group represents an error in the BCD number. 2-4 BCD Code Convert BCD 011111000001 to its decimal equivalent. The forbidden group represents an error in the BCD number. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

Three bit binary and Gray code equivalents. 2-5 The Gray Code The Gray code is used in applications where numbers change rapidly. Only one bit changes from each value to the next. Three bit binary and Gray code equivalents. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-5 The Gray Code Binary to Gray Gray to Binary Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

Decimal-Binary-Hex-BCD-Gray Decimal numbers 1 – 15 in binary, hex, BCD, Gray Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-7 The Byte, Nibble, and Word Most microcomputers handle and store binary data and information in groups of eight bits. 8 bits = 1 byte. A byte can represent numerous types of data/information. Binary numbers are often broken into groups of four bits. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

Byte-Nibble-Word 1 nibble = 4 bits 1 byte = 8 bits 1 nibble = 4 bits 1 word = Variable ( 8, 16, 32, 64 bits ) Word size depends upon the digital system PC word size could be 32 or 64 bits

American Standard Code for Information Interchange -ASCII Represents characters and functions on a computer keyboard 26 lowercase 26 uppercase letters 10 digits 7 punctuation marks 20 to 40 other characters. Seven bit code: 27 = 128 possible codes use: transfer information between computers; computers & printers; Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

ASCII – Codes Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

ASCII – Codes Examples example Keyboard “A” = 4116 = 6510 Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

Transmission Errors Electrical noise can cause errors during transmission. (Spurious fluctuations in voltage or current present in all electronic systems) Noise can change one or more “1” to “0” or “0” to “1” You want detect the errors and possibly correct the errors Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

Error Detection and Correction Digital systems should first detect errors Then correct errors if possible Parity is a simple method of detection errors Parity method requires the addition of an extra bit to a code group

Parity Method for Error Detection The added bit is the parity bit It can be either a 0 or 1, depending on the number of 1s in the code group There are two parity methods Even or odd The transmitter and receiver must “agree” on the type of parity checking Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

Parity Method for Error Detection Even parity method—the total number of bits in a group including the parity bit must add up to an even number. The binary group 1 0 1 1 would require the addition of a parity bit 1, making the group 1 1 0 1 1. The parity bit may be added at either end of a group. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

2-9 Parity Method for Error Detection Odd parity method—the total number of bits in a group including the parity bit must add up to an odd number. The binary group 1 1 1 1 would require the addition of a parity bit 1, making the group 1 1 1 1 1. The parity bit becomes a part of the code word. Adding a parity bit to the seven-bit ASCII code produces an eight-bit code. Copyright ©2007 by Pearson Education, Inc. Columbus, OH 43235 All rights reserved.

ASCII Transmission there must be a way to tell the receiver a new character is coming. There is often a need to detect errors in the transmission as well. The method of transfer is called asynchronous data communication. An ASCII character must be “framed” so the receiver knows where the data begins and ends.

2-10 Applications ASCII code is sent LSB first and MSB last. The first bit must always be a start bit (logic 0). ASCII code is sent LSB first and MSB last. After the MSB, a parity bit is appended to check for transmission errors. Transmission is ended by sending a stop bit (logic 1).

Boolean Algebra and Common Logic Boolean constants and variables are “1” and “0” “1” could be 2 to 5 volts “0” could be 0 to 0.8 volts

OR Gates x = A + B x = 1 + 1 + 1 = 1 x = A + B is read as “x equals A OR B

AND Gate x = A B expression x = A B is read as “x equals A AND B

NOT Gate NOT gate is Inverter or Complementer “1” input produces a “0” output “0” input produces a “1” output

Combining Logic Gates

Operator Precedence If an expression contains both AND and OR operations, the AND operations are performed first Unless there are parentheses in the expression, in which case the operation inside the parentheses is to be performed first. This is the same rule that is used in ordinary algebra to determine the order of operations