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.
DATA REPRESENTATION CONVERSION.
Binary Representation
1 Number Systems. 2 Numbers Each number system is associated with a base or radix – The decimal number system is said to be of base or radix 10 A number.
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 Arithmetic
Number Systems and Codes In PLC
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
Chapter 1 Number Systems and Codes 1. Outline 1. NUMBER SYSTEMS AND CODES 2. DIGITAL ELECTRONIC SIGNALS AND SWITCHES 3. BASIC LOGIC GATES 4. PROGRAMMABLE.
Number Systems.
Programmable Logic Controllers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Numbering systems.
CSC212 – Computer Organization and Design
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
Numbering Systems CS208.
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,
Number Systems Spring Semester 2013Programming and Data Structure1.
ICS312 Set 1 Representation of Numbers and Characters.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Number Systems and Codes
CISC1100: Binary Numbers Fall 2014, Dr. Zhang 1. Numeral System 2  A way for expressing numbers, using symbols in a consistent manner.  " 11 " can be.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
Data Representation, Number Systems and Base Conversions
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
AEEE2031 Data Representation and Numbering Systems.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
MECH1500 Chapter 3.
Computer Number System
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
Number Systems. ASCII – American Standard Code for Information Interchange – Standard encoding scheme used to represent characters in binary format on.
Fall’ 2014 Lesson - 1 Number System & Program Design CSE 101.
Ch2 Number systems and codes
Digital logic COMP214  Lecture 2 Dr. Sarah M.Eljack Chapter 1 1.
Fall’ 2014 Number System CSE Number System How Computers Represent Data Binary Numbers The Binary Number System Bits and Bytes Text Codes Binary.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Programmable Logic Controller
Cosc 2150: Computer Organization
Digital Design Chapter One Digital Systems and Binary Numbers
Number Systems and Codes
Lecture No. 4 Number Systems
What is a byte? What is it? How would you use it?
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
CHAPTER 1 : INTRODUCTION
Dr. Clincy Professor of CS
Introduction to Chapter 2
Number Systems.
Introduction The term digital is derived from the way computers perform operation, by counting digits. Application of digital technology: television, communication.
Chapter 3 Data Representation
Number System conversions
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
Dr. Clincy Professor of CS
Digital Logic & Design Lecture 03.
Numbering System TODAY AND TOMORROW 11th Edition
Digital Electronics and Microprocessors
COMS 161 Introduction to Computing
2’s Complement form 1’s complement form 2’s complement form
Chapter Four Data Representation in Computers By Bezawit E.
Number Systems Rayat Shikshan Sanstha’s
Number Systems Rayat Shikshan Sanstha’s
UNIT – 3 & 4. Data Representation and Internal
Presentation transcript:

Number Systems and Codes Chapter 1 Number Systems and Codes

Chapter Objectives You should be able to: Determine the weighting factor of each digit position in the decimal, binary, octal, and hexadecimal numbering systems. Convert any number among the four number systems, and its equivalent value in any of the remaining three numbering systems. Describe binary coded decimal (BCD) numbers. Translate alphanumeric data to and from ASCII using the ASCII code translation table.

Digital versus Analog Digital Analog OFF and ON states that can be represented using 0s and 1s (respectively). Analog Continuously varying Examples: temperature, pressure, velocity

Discussion Points Explain the difference between analog and digital signals. Describe some applications for digital technology. What are the benefits of using digital systems? Are there any problems associated with digital systems?

Digital vs. Analog

Digital Representations of Analog Quantities Audio Recording Audio CD and MP3 players/recorders Video Recording DVDs store digital representations of analog video and audio signals

Analog Signal Voltages and Their Digital Equivalents

Digital-to-Analog and Back Again

Why Digital Systems Are Immune to Analog Noise

Digital Representations of Alternative Energy Sources Energy technicians must keep track of the efficiency of their energy collection systems. Naturally occurring quantities like solar, wind, and temperature are analog quantities and must be digitized before a computer can understand them.

A Solar Radiation Data-logger System

Decimal Numbering System (Base 10) 10 possible digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 Least-significant position is on the right end Most-significant position is on the left end Weighting factor of 10

Decimal Numbering System (Base 10) Example: 3251         Sum = 3251

Binary Numbering System (Base 2) Only two possible digits: 0 and 1 Weighting factor of 2 Conversion techniques Digit times weighting factor Successive division

Binary - to - Decimal Example: 10110011                 Sum = 179

Binary as Fractional

Binary as Fractional Example: 101.011             Sum = 5.375

Decimal to Binary Example: 39 2 78 R= 0 19 2 39 R= 1 9 2 R= 1 19 4 2 9   39 LSB 2 78 R= 0 19 2 39 R= 1 9 2 R= 1   19 4 2 9 R= 1 2 2 R= 0 4 1 2 2 R= 0 2 1 R= 1 MSB

Decimal-to-Binary Conversion Subtracting weighting factors (Example 1-4) Successive division (Example 1-5) First remainder is the Least-Significant Bit (LSB) Last remainder is the Most-Significant Bit (MSB)

Octal Numbering System (Base 8) Eight allowable digits: 0, 1, 2, 3, 4, 5, 6, and 7 Weighting factor of 8

Octal Conversions Binary to octal Octal to binary Octal to decimal Group binary positions in groups of three Write the octal equivalent Octal to binary Reverse the process Octal to decimal Multiply by weighting factors Decimal to octal Successive division

} } Octal 5 2 101 011 010 Example: Binary to Octal     } } 5 2 Example: Octal to Decimal   Example: Octal to Binary       101 011 010      

Octal Example: Decimal to Octal   4 5 8 362 32 R=2 42 40   2 5 8 45 R=5 40 5 R=5 8 5

Hexadecimal Numbering System (Base 16) 16 allowable digits. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F Each hex digit represents a 4-bit group See Table 1-3 Two hex digits are used to represent 8 bits 8 bits are called a byte 4 bits are called a nibble

Hexadecimal Numbering System

Hexadecimal Conversions Binary-to-hexadecimal conversion Group the binary in groups of four Write the equivalent hex digit Hexadecimal-to-binary conversion Reverse the process

Hexadecimal Conversions Hexadecimal-to-decimal conversion Multiply by weighting factors Decimal-to-hexadecimal conversion Successive division

} } Hexadecimal F 5 1011 0111 Example: Binary to Hex     } } F 5 Example: Hex to Decimal   Example: Hex to Binary       1011 0111      

Hexadecimal Example: Decimal to Hex   5 9 16 948 80 R=4 148 144 4 3𝐵 4 16 3 16 59 R=11=B 48 11 R=3 16 3

} } Hexadecimal 5 3 Example: Binary to Hex     } } 5 3 Add as many zeros in front as needed

Binary-Coded-Decimal System (BCD) Each of the 10 decimal digits is represented by its 4-bit binary equivalent. Decimal-to-BCD conversion Convert each decimal digit to its 4-bit binary code BCD-to-Decimal conversion Reverse the process

The ASCII Code American Standard Code for Information Interchange (ASCII) Represents alphanumeric data Uses 7 bits 128 different code combinations (see Table 1-5) 3-bit group is most significant 4-bit group is least significant

Numbering System Applications Because digital systems must work with 1s and 0s, learning the different numbering systems is important. Which system is used is determined by how the data were developed and how they are to be used. Several numbering system applications follow.

Application 1-1 The four chemical storage tanks shown are monitored for temperature (T) and pressure (P).

Application 1-1 (continued) Using the table shown below, interpret the following: If the computer reads a binary string of 0010 1000 what problems exist? This indicates that the pressure in tanks C and B are too high.

Application 1-1 (continued) Using the table shown below, interpret the following: If the computer reads a hex value of 55H what problems exist? Since 55H =0101 0101 This indicates that all tank temperatures are too high. 22

Application 1-1 (continued) Using the table shown below, interpret the following: If the temperature and pressure in tanks B and D are too high, what hex value is read by the computer? This condition would produce a digital output of 1100 1100 = CCH.

Application 1-1 (continued) Using the table shown below, interpret the following: Assume that tanks A and B are shut down and all sensors are tied high (1s). What is the lowest decimal value that indicates a problem in the other two tanks? With the four low-order bits tied high, the lowest value that indicates a problem is 0001 111 or 3110.

Application 1-1 (continued) Using the table shown below, interpret the following: If only tanks A, B, and C are monitored, what octal value indicates tank B has both temperature and pressure problems? The binary output would be 001 1002 = 148.

Application 1-2 A CD player converts 12-bit signals from a CD into equivalent analog values. What are the largest and smallest hex values that can be used in this system? The largest is FFF16 and the smallest is 00016. How many different analog values can be represented? FFF16 = 409510, so including 0 the total is 4096 unique values.

Application 1-3 Typically, digital thermometers use BCD to drive their displays. How many BCD bits are required to drive a 3-digit display? 12 bits are required; four for each digit. What 12 bits represent 147°F? 0001 (1), 0100 (4), and 0111 (7).

Application 1-4 Most PC-compatible computer systems use a 20-bit address code to identify each of over 1 million memory locations. How many hex characters are required to identify the address of each memory location? Five hex characters are required since each hex character represents 4 bits.

Application 1-4 (continued) What is the hex address of the 200th memory location? 000C8H = 20010, but 00000H is the first memory location, so we must subtract 1. The answer is C8 – 1 = C7. If 50 memory locations are used for data storage starting at location 000C8H, what is the location of the last data item? C8H gets the first data item, so the answer is 24910 = F9H.

Application 1-5 The part number 651-M is stored in ASCII in a computer memory. List the binary contents of its memory locations? 6 = 011 0110 5 = 011 0101 1 = 011 0001 - = 010 1101 M = 100 1101 Grouping the binary bits in eights, this string represents 5 hex memory locations: 011 0110 011 0101 011 0001 010 1101 100 1101 36 35 31 2D 4D

Application 1-6 A programmer uses a debugging utility to find an error in a BASIC program. The utility shows the ASCII code as hex 474F5430203930. Assume that the leftmost bit of each ASCII string is padded with a zero. The program segment is translated as GOT0 90. The error is that a zero (0) was typed instead of the letter O.

Summary Numerical quantities occur naturally in analog form but must be converted to digital form to be used by computers or digital circuitry. The binary numbering system is used in digital systems because the 1s and 0s are easily represented by ON or OFF transistors, which output 0 V for 0 and +5 V for 1.

Summary Any number system can be converted to decimal by multiplying each digit by its weighting factor. The weighting factor for the least significant digit in any number system is always 1. Binary numbers can be converted to octal by forming groups of 3 bits and to hexadecimal by forming groups of 4 bits.

Summary The successive division procedure can be used to convert from decimal to binary, octal, or hexadecimal The binary-coded-decimal system uses groups of 4 bits to drive decimal displays such as those in a calculator. ASCII is used by computers to represent all letters, numbers and symbols in digital form.