Ch2 Number systems and codes

Slides:



Advertisements
Similar presentations
Number Systems and Codes
Advertisements

Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
ICS312 Set 2 Representation of Numbers and Characters.
Chapter 1 Digital Systems and Numbers System
ENGIN112 L4: Number Codes and Registers ENGIN 112 Intro to Electrical and Computer Engineering Lecture 4 Number Codes and Registers.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Binary Representation
CS 151 Digital Systems Design Lecture 4 Number Codes and Registers.
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
EECC341 - Shaaban #1 Lec # 3 Winter Binary Multiplication Multiplication is achieved by adding a list of shifted multiplicands according.
Digital Systems Number Systems and Codes Wen-Hung Liao, Ph.D.
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.
Lesson 2 0x Coding ASCII Code.
Number Systems and Codes In PLC
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
Number Systems and Codes
Number Systems.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
BR 8/99 Digital Devices Integrated Circuits that operate on Digital Data are in 95% of every electrical powered device in the U.S. The theory of operation.
Programmable Logic Controllers
Computers Organization & Assembly Language
CSC212 – Computer Organization and Design
Digital Systems and Logic Design
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Chapter 3 Data Representation
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 2 Number.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Chapter 2 – Number Systems and Codes Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Number Systems Spring Semester 2013Programming and Data Structure1.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
CS151 Introduction to Digital Design
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.
Number systems: binary, decimal, hexadecimal and octal. Conversion between various number systems Number systems: binary, decimal, hexadecimal and octal.
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.
Data Representation Conversion 24/04/2017.
Data Representation, Number Systems and Base Conversions
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
MECH1500 Chapter 3.
WEEK #11 FUNCTIONS OF COMBINATIONAL LOGIC (PART 4)
Computer Number System
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.
Digital Systems: Number Systems and Codes Wen-Hung Liao, Ph.D.
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.
1. Binary, Decimal, Hexadecimal and Octal. 2. Conversion between various number systems. Number Systems:
Number Systems and Codes
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
CHAPTER 1 : INTRODUCTION
Introduction to Chapter 2
Digital Devices Integrated Circuits that operate on Digital Data are in 95% of every electrical powered device in the U.S. The theory of operation of these.
Chapter 3 Data Representation
Number System conversions
2 Number Systems and Codes Edited by Jerry Bernardini.
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
Number Systems and Codes
Digital Systems: Number Systems and Codes
Numbering System TODAY AND TOMORROW 11th Edition
Chapter Four Data Representation in Computers By Bezawit E.
Chap. 2 Number Systems and Codes
CHAPTER 69 NUMBER SYSTEMS AND CODES
Presentation transcript:

Ch2 Number systems and codes Octal(base 8) Decimal(base 10) Binary(base 2) Hexadecimal (base16) kjspace@nlsun.inha.ac.kr

Examples Decimal numbers(base 10) 36.210 9810 36.210 9810 Hexadecimal number(base 16) 3F216 Binary number(base 2) 10112

Positional system Each digit carries a certain weight based on its position. 346.17463.71 Position matters Weight vs Position

Decimal Positional System (Base 10 or radix 10) decimal point … 104 103 102 101 100 . 10-1 10-2 tenths position ones position tens position hundredth position hundreds position

Binary Positional System (Base 2 or radix 2) binary point … 24 23 22 21 20 . 2-1 2-2 halves position ones position twos position quarters position fours position

Example Decimal Example Binary Example

Binary to Decimal Conversion What is 1101012 in decimal?

n 2n 20=1 1 21=1 2 22=4 3 23=8 4 24=16 5 25=32 6 26=64 7 27=128 n 2n 8 28=256 9 29=512 10 210=1024 11 211=2048 12 212=4096 20 220=1M 30 230=1G

Decimal-To-Binary Conversions(method 1) The decimal number is simply expressed as a sum of powers of 2, and then 1s and 0s are written in the appropriate bit positions.

(Method 2)Flowchart for Repeated Division

Example for Repeated Division quotient remainder 50/2 = 25 0 LSB 25/2 = 12 1 12/2 = 6 0 6/2 = 3 0 3/2 = 1 1 1/2 = 0 1 MSB 5010=1100102

Example for Repeated Division quotient remainder 346/2 173 0 173/2 86 1 86/2 43 0 43/2 21 1 21/2 10 1 10/2 5 0 5/2 2 1 2/2 1 0 1/2 0 1 34610=1010110102

How many different values can we represent with N binary digits How many different values can we represent with N binary digits? Decimal digits? Octal digits? Radix Z digits? Decimal: 1 digit 0-9 10 different values 2 digits 10X10=100 different values .. 6 digits 106=1,000,000 different values Binary: 1 digit 0,1 2 different values=21 2 digits 00,01,10,11 4 different values=22 n digits 2n different values Radix Z digits: n digits Zn different values(0 thru. Zn-1)

Octal-to-Decimal Conversion

Decimal-to-Octal Conversion Convert 26610 to Octal quotient remainder 266/8 = 33 2 LSB 33/8 = 4 1 4/8 = 0 4 MSB 26610=4128

Octal-to-Binary Conversion Convert 4728 to binary 4 7 2    100 111 010 Convert 54318 to binary 5 4 3 1     101 100 011 001

Binary-to-Octal Conversion Convert 1001110102 to octal Convert 110101102 to octal

Octal-to-hex Conversion Convert B2F16 to octal B2F16=1011 0010 1111 {convert to binary} =101 100 101 111 {group into three-bit groupings} = 5 4 5 78 {Convert to octal}

2-5 BCD Code If each digit of a decimal number is represented by its binary equivalent, the result is a code called binary-code-decimal(BCD). 8 7 4 (decimal)    1000 0111 0100 (BCD) 9 4 3 (decimal)    1001 0100 0011 (BCD)

Example Convert 0110100000111001(BCD) to its decimal equivalent. Convert the BCD number 011111000001 to its decimal equivalent.

Comparison of BCD and Binary A straight binary code takes the complete decimal number and represents it in binary. A BCD code converts each decimal digit to binary individually. 13710=100010012 (binary) 13710=0001 0011 0111 (BCD) BCD uses more bits, easier to convert to and from decimal.

Review Questions Represent the decimal value 178 by its straight binary equivalent. Then encode the same decimal number using BCD. How many bits are required to represent an eight-digit decimal number in BCD? What is an advantage of encoding a decimal number in BCD as compared with straight binary? What is a disadvantage?

2-6 Putting it ALL together(TBA)

2-7 The byte A string of 8 bits is called a byte. How many bytes are in a 32-bit string? What is the largest decimal value that can be represented in binary using two bytes? How many bytes are needed to represent the decimal value 846,569 in BCD?

Review Questions How many bytes are needed to represent 23510 in binary? What is the largest decimal value that can be represented in BCD using two bytes?

2-8 Alphanumeric Codes Codes representing letters of the alphabet, punctuation marks, and other special characters as well as numbers are called alphanumeric codes. The most widely used alphanumeric code is the American Standard Code for Information Interchange(ASCII). The ASCII(pronounced “askee”) code is a seven-bit code.

Partial listing of ASCII code

Example The following is a message encoded in ASCII code. What is the message? 1001000 1000101 1001100 1010000 An operator is typing in a JAVA program at the keyboard of a certain microcomputer. The computer converts each keystroke into its ASCII code and stores the code as a byte in memory. Determine the binary strings that will be entered into memory when the operator types in the following JAVA statement. import java.applet.*

Review Questions Encode the following message in ASCII code using the hex representation: “COST=$72.” The following padded ASCII-coded message is stored in successive memory location in a computer: 01010011 01010100 01001111 01010000 What is the message?

2-9 Parity method for error detection Whenever information is transmitted from one device to another device, there is a possibility that errors can occur such that the receiver does not receive the identical information that was sent by the transmitter.

Parity Bit A parity bit is an extra bit that is attached to a code group that is being transferred from one location to another. Even-parity The value of the parity bit is chosen so that the total number of 1s in the code group(including the parity bit) is an even number. 1 1 0 0 0 0 1 1  Added parity bit Odd-parity The parity bit is chosen so that the total number of 1s(including the parity bit) is an odd number. The parity bit is issued to detect any single-bit errors during the transmission of a code from one location to another.

Example Computers often communicate with other remote computers over the telephone lines. For example, this is how some communication over the internet takes place. When one computer is transmitting a message to another, the information is usually encoded in ASCII.What actual bit strings would a computer transmit to send the message HELLO, using ASCII with even parity?

Review Questions Attach an odd-parity bit to the ASCII code for the $ symbol, and express the result in hexadecimal. Attach an even-parity bit to the BCD code for decimal 69. Why can’t the parity method detect a double error in transmitted data?

2-10 Applications A typical CD-ROM can store 650 megabytes of digital data. Since mega=220, how many bits of data can a CD-ROM hold? An automotive parts shop uses a computer to store all of its parts numbers in 7-bit ASCII code with an odd parity bit. The codes for each part are stored in successive memory locations. List the binary contents of memory that stores the part number JR2-5. A small process-control computer uses octal codes to represent its 12-bit memory addresses. How many octal digits are required? What is the range of addresses in octal? How many memory locations are there?

Applications(cont.) A typical PC uses a 20-bit address code for its memory locations. How many hex digits are needed to represent a memory address? What is the range of addresses? What is the total number of memory locations? Most calculators use BCD to store the decimal values as they are entered into the keyboard and to drive the digit displays. If a calculator is designed to handle 8-digit decimal numbers, how many bits does this require? What bits are stored when the number 375 is entered into the calculator?

Summary The octal and hexadecimal number systems are used in digital systems and computers as efficient ways of representing binary quantities. In conversion between octal and binary, one octal digit corresponds to three bits. In conversions between hex and binary, each hex digit corresponds to four bits. The repeated-division method is used to convert decimal numbers to binary, octal or hexadecimal. Using an N-bit binary number, we can represent decimal values from 0 to 2N-1. The BCD code for a decimal number is formed by converting each digit of the decimal number to its four-bit binary equivalent.

Summary(cont.) A byte is a string of eight bits. An alphanumeric code is one that uses groups of bits to represent all of the various characters and functions that are part of a typical computer’s keyboard. The ASCII code is the most widely used alphanumeric code. The parity method for error detection attaches a special parity bit to each transmitted group of bits.