LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology



Similar documents
Number and codes in digital systems

The string of digits in the binary number system represents the quantity

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

2011, The McGraw-Hill Companies, Inc. Chapter 3

Systems I: Computer Organization and Architecture

Lecture 11: Number Systems

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Number Representation

Binary Number System. 16. Binary Numbers. Base 10 digits: Base 2 digits: 0 1

NUMBER SYSTEMS. 1.1 Introduction

Goals. Unary Numbers. Decimal Numbers. 3,148 is s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

Useful Number Systems

Solution for Homework 2

Binary Representation

Numbering Systems. InThisAppendix...

CPEN Digital Logic Design Binary Systems

3. Convert a number from one number system to another

CSI 333 Lecture 1 Number Systems

Levent EREN A-306 Office Phone: INTRODUCTION TO DIGITAL LOGIC

Chapter 2. Binary Values and Number Systems

Number Systems. Introduction / Number Systems

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Computer Science 281 Binary and Hexadecimal Review

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Chapter 1: Digital Systems and Binary Numbers

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

HOMEWORK # 2 SOLUTIO

Binary, Hexadecimal, Octal, and BCD Numbers

THE BINARY NUMBER SYSTEM

Binary Numbers. Binary Octal Hexadecimal

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

Lecture 2. Binary and Hexadecimal Numbers

Number Systems and Radix Conversion

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Decimals Adding and Subtracting

CS321. Introduction to Numerical Methods

Unsigned Conversions from Decimal or to Decimal and other Number Systems

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Addition Methods. Methods Jottings Expanded Compact Examples = 15

NUMBER SYSTEMS. William Stallings

2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

Digital codes. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

Lecture 8: Binary Multiplication & Division

Positional Numbering System

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points.

Measures of Error: for exact x and approximation x Absolute error e = x x. Relative error r = (x x )/x.

Chapter 4: Computer Codes

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

A Step towards an Easy Interconversion of Various Number Systems

Base Conversion written by Cathy Saxton

Chapter 5. Binary, octal and hexadecimal numbers

BINARY CODED DECIMAL: B.C.D.

Binary Numbering Systems

Digital Logic Design. Introduction

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

PREPARATION FOR MATH TESTING at CityLab Academy

Paramedic Program Pre-Admission Mathematics Test Study Guide

Counting in base 10, 2 and 16

Chapter 4 -- Decimals

1.Eastron SDM220Modbus Smart Meter Modbus Protocol Implementation V1.0

Chapter 1. Binary, octal and hexadecimal numbers

Sheet 7 (Chapter 10)

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

Basic Use of the TI-84 Plus

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Micro Motion Modbus Interface Tool

Today s topics. Digital Computers. More on binary. Binary Digits (Bits)

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

ASCII and BCD Arithmetic. Chapter 11 S. Dandamudi

Decimal to Binary Conversion

MATH-0910 Review Concepts (Haugen)

RS485 & Modbus Protocol Guide

Memory is implemented as an array of electronic switches

=

COMPSCI 210. Binary Fractions. Agenda & Reading

Number of bits needed to address hosts 8

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Zuse's Z3 Square Root Algorithm Talk given at Fall meeting of the Ohio Section of the MAA October College of Wooster

Math Workshop October 2010 Fractions and Repeating Decimals

Technical Support Bulletin Nr.18 Modbus Tips

The Hexadecimal Number System and Memory Addressing

Exponents. Learning Objectives 4-1

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

Math 115 Spring 2011 Written Homework 5 Solutions

Session 29 Scientific Notation and Laws of Exponents. If you have ever taken a Chemistry class, you may have encountered the following numbers:

Binary Adders: Half Adders and Full Adders

APPENDIX B. Routers route based on the network number. The router that delivers the data packet to the correct destination host uses the host ID.

CS201: Architecture and Assembly Language

Transcription:

LSN 2 Number Systems Department of Engineering Technology

LSN 2 Decimal Number System Decimal number system has 10 digits (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3 10-4 10-5... Decimal numbers are sums of the weighted digits 25 = (2 * 10 1 ) + (5 * 10 0 ) = 20 + 5 = 25 833 =

LSN 2 Binary Number System Binary number system has 2 digits (0-1) Base 2 weighting system... 2 5 2 4 2 3 2 2 2 1 2 0. 2-1 2-2 2-3 2-4 2-5...

LSN 2 Converting Binary to Decimal Binary numbers are sums of the weighted binary digits (bits) 11001 = (1 * 2 4 ) + (1 * 2 3 ) + (0 * 2 2 ) + (0 * 2 1 ) + (1 * 2 0 ) = 16 + 8 + 0 + 0 + 1 = 25 10101 = Largest decimal number represented by n bits is 2 n 1 1111 = 15? 11111 = 31?

LSN 2 Converting Decimal to Binary Sum of weights Find closest binary weight to desired decimal number and then work backwards Division by 2 method Repeated division by 2 until whole number quotient is 0 Remainder is binary equivalent Convert decimal 25 to binary: Quotient = 0 25/2 = 12 1 12/2 = 6 0 6/2 = 3 0 3/2 = 1 1 1/2 = 0 1 Remainder LSB MSB 25 = 11001

LSN 2 Converting Decimal to Binary Fractional decimal conversion to binary Sum of weights Find closest binary weight to desired decimal number and then work backwards Multiplication by 2 method Repeated multiplication by 2 until desired resolution or until fractional places equal 0 Carry is binary equivalent Convert decimal 0.4375 to binary: Fractional places = 0 0.4375 * 2 = 0.875 0 0.875 * 2 = 1.75 1 0.75 * 2 = 1.5 1 0.5 * 2 = 1.0 1 Cary MSB LSB 0.4375 =.0111

LSN 2 Binary Arithmetic Addition Sum Carry 0 + 0 0 0 0 + 1 1 0 1 + 0 1 0 1 + 1 0 1 Example: 1010 0110 +0111 +1111

LSN 2 Binary Arithmetic Subtraction Difference Borrow 0-0 0 0 1-1 0 0 1-0 1 0 10-1 1 1 Example: 0101 0101-0100 - 0010

LSN 2 Binary Arithmetic Examples (2.4 review from book) 1101 10111 + 1010 + 01101 1101 1001-0100 - 0111

Chapter 2 Signed Binary Numbers Signed binary number format Sign Magnitude S M M M M M M M Sign-Magnitude representation Only sign bit changes between positive and negative numbers Example: 0 0011010 1 0011010

Chapter 2 Signed Binary Numbers 1 s Compliment representation Change all 1 s to 0 s and all 0 s to 1 s Example: 10110010 Negative numbers are the 1 s Compliment of the corresponding positive number Example: 0 0011010 1 1100101

Chapter 2 Signed Binary Numbers 2 s Compliment representation Method 1 perform the 1 s Compliment and add 1 Method 2 starting with the LSB, retain all bit values up to and including the least significant 1 Take the 1 s compliment of remaining bits Example: 10110010 Negative numbers are the 2 s Compliment of the corresponding positive number Example: 0 0011010 1 1100110

Chapter 2 Signed Binary Numbers Range For n bits there are 2 n combinations With signed binary numbers there is a range from -(2 (n-1) ) to (2 (n-1) 1) Example: n = 8 range is from -128 to 127

LSN 2 Signed Binary Numbers Example Express the number -39 as an 8-bit binary number using Sign-Magnitude 1 s Compliment 2 s Compliment

LSN 2 Signed Binary Numbers Decimal equivalents Sign-Magnitude Sum of weighted binary digits excluding sign bit Adjust sign based upon sign bit 1 s Compliment Positive numbers: Sum of weighted binary digits Negative numbers: Sum of weighted binary digits with a negative weight being assigned to the sign bit and adding 1 Example: 10010110

LSN 2 Signed Binary Numbers 2 s Compliment All numbers: Sum of weighted binary digits with the negative weight being assigned to the sign bit Example: 10010110 Preferred method Single method for both positive and negative numbers Standard binary arithmetic applies

LSN 2 Floating point numbers Contain both integer and fractional parts along with a sign Represented by: Mantissa = magnitude Exponent = number of places the decimal point is to be moved Binary point S Exponent Mantissa 8 bits 23 bits

LSN 2 Floating point numbers Example: Represent 4.533 x 10 3 as a single precision floating point number

LSN 2 Hexadecimal Numbers Base 16 number system 16 digits: 0 1 2 3 4 5 6 7 8 9 a b c d e f Convenient representation since digital systems process binary data in 4n groupings Each hexadecimal digit represents a 4-bit binary number 4n binary digits (bits) n hexadecimal numbers Counting: 0 f 10 1f 20 2f... n0 nf

LSN 2 Hexadecimal Numbers Binary / Hexadecimal conversion Binary Hexadecimal Break binary number into 4-bit groupings starting at the right and use the associated hexadecimal value Example: 0100100111001010 1001110010101101 Hexadecimal Binary Replace each hexadecimal number with its associated 4-bit binary number Example: 2 f d 3 16 3 e a 1 16

LSN 2 Hexadecimal Numbers Decimal / Hexadecimal conversion Hexadecimal Decimal Convert hexadecimal to binary then to decimal Example: a e 3 4 16 Convert hexadecimal directly to decimal by summing the base-16 weighted decimal representation of each digit Example: a e 3 4 16

LSN 2 Hexadecimal Numbers Decimal / Hexadecimal conversion Decimal Hexadecimal Repeated division by 16 Remainder expressed in base 16 is the hexadecimal number from LSD to MSD Example: 25634

LSN 2 Digital Codes and Parity Binary Coded Decimal (BCD) Expresses each decimal digit with a binary number Used for keypads and x-segment displays 8421 code Only uses the 4-bits representing the decimal numbers 8, 4, 2, and 1 (2 3, 2 2, 2 1, 2 0 ) 0 1 2 3 4 5 6 7 8 9 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 There are 6 4-bit binary combinations not used (invalid) 10 11 12 13 14 15 1010 1011 1100 1101 1110 1111

LSN 2 Digital Codes and Parity Decimal BCD conversion Replace each digit with appropriate BCD code Example: 8 9 6 1 2 BCD Decimal conversion Find decimal conversion for each 4-bit sequence Example: 1001100000010100

LSN 2 Digital Codes and Parity BCD Addition Perform standard binary addition If sum is greater than 9, add a binary 6 to sum to ensure a valid BCD code is generated Example:» Add any carry to next BCD number 100101110100 + 000100100000

LSN 2 Digital Codes and Parity Gray Code Not a signed or arithmetic code Only 1 bit position changes between consecutive numbers Useful in applications where the number of bit changes needs to be limited to help reduce errors

LSN 2 Digital Codes and Parity ASCII Code American Standard Code for Information Interchange Represents 128 characters with an 8-bit binary code MSB is always 0 (only uses 7 LSBs)

LSN 2 Digital Codes and Parity Parity Used for error detection Odd: parity bit is used to create an odd number of 1 s Even: parity bit is used to create an even number of 1 s

LSN 2 Homework Reading: Chapter 2.1 2.6 Chapter 2.6 2.11 Problems HW2 Chapter 2, problems 6, 9, 11(a, g), 13(c, f), 15, 16, 21(d,e), 22(g,h), 23, 24, 25, 26, 27, 28 Show all work for credit Problems HW3 30, 37(e, f, g), 38(d, e, f), 39(c, d, h), 40, 47(j, k, l), 51(a, d, g, j), 53(c, d, f), 59, 64 Show all work for credit