Introduction to Microprocessors Chapter 2. Decimal or Base 10 Numbers  Have ten different digits (0-9)  It is a weighted number system. Each position.

Slides:



Advertisements
Similar presentations
Intro to CS – Honors I Representing Numbers GEORGIOS PORTOKALIDIS
Advertisements

ICS312 Set 2 Representation of Numbers and Characters.
HEXADECIMAL NUMBERS Code
ENGIN112 L4: Number Codes and Registers ENGIN 112 Intro to Electrical and Computer Engineering Lecture 4 Number Codes and Registers.
Chapter 2 : Number System
Chapter 1 Binary Systems 1-1. Digital Systems
Digital Fundamentals Floyd Chapter 2 Tenth Edition
M68K Assembly Language Programming Bob Britton Chapter 4 Number Systems.
CS 151 Digital Systems Design Lecture 4 Number Codes and Registers.
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
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
Number Systems and Codes Discussion D4.1. Number Systems Counting in Binary Positional Notation Hexadecimal Numbers Negative Numbers.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Number System and Codes
1.6 Signed Binary Numbers.
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Programmable Logic Controllers
Simple Data Type Representation and conversion of numbers
Computers Organization & Assembly Language
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Chapter 3 Data Representation
Binary Arithmetic & Data representation
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
1.11, 1.12, 1.13, 1.14, 1.18, 1.20, 1.23, 1.24, 1.25, 1.32, 1.33.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
ICS312 Set 1 Representation of Numbers and Characters.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
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. Today Decimal Hexadecimal Binary –Unsigned Binary –1’s Complement Binary –2’s Complement Binary.
46 Number Systems Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs Display: Seven segment displays Inputs: Switches.
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 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
CPU Internal memory I/O interface circuit System bus
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)
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.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
SAK Chapter 21 Chapter 2 : Number System 2.1 Decimal, Binary, Octal and Hexadecimal Numbers 2.2 Relation between binary number system with other.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
MECH1500 Chapter 3.
Chapter 1: Binary Systems
CCE Department – Faculty of engineering - Islamic University of Lebanon Chapter 6 Binary Arithmetic.
Introduction to Digital Electronics Lecture 2: Number Systems.
In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative The same is true for binary numbers a computer.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Digital Logic Design Lab 1,2 By Nora Alaqeel.
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
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.
11001 / 101, / ) Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the result.
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.
COMPUTER ORGANIZATION 4 TH LECTURE. ASCII Code  ASCII ( American Standard Code for Information Interchange).  Input and output devices that communicate.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
11001 / 101 , / ) Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the.
CHAPTER 1 : INTRODUCTION
Chapter 3 Data Representation
Digital Systems: Number Systems and Codes
Chapter 1 Number System RGGP, Narwana.
C1 Number systems.
Presentation transcript:

Introduction to Microprocessors Chapter 2

Decimal or Base 10 Numbers  Have ten different digits (0-9)  It is a weighted number system. Each position as you move to the left has a weight of the base (10 for decimal) raised to an integer power. The first position (from right to left) has power of zero, next position power of one…….  Ex: 123 = (1 x 10 2 ) + (2 x 10 1 ) + (3 x 10 0 )

Binary numbers  They have two digits (0 & 1)  To convert it to decimal:  ex1: = (1 x 2 2 ) + (0 x 2 1 ) + (1 x 2 0 ) = = 5 10  ex2: = (1 x 2 3 ) + (1 x 2 2 ) + (0 x 2 1 ) + (0 x 2 0 ) = =12 10  ex3: = (1 x 2 4 ) + (1 x 2 3 ) + (0 x 2 2 ) +  (0 x 2 1 ) + (1 x 2 0 ) = =25 10

Convert Decimal to Binary  Repeated division by 2  Ex: = ? 2  18/2=9 and reminder is 0  9/2 = 4 and reminder is 1  4/2 =2 and reminder is 0  2/2 =1 and reminder is 0  ½ = 0 and reminder is 1  Therefore =

Hexadecimal (base 16)  Need 16 digits.  We use our ordinary decimal digits (0-9) and A-F

Hex to decimal ex1: = (1 x 16 2 ) + (2 x 16 1 ) + (3 x 16 0 ) = = ex2: 1A 16 = (1 x 16 1 ) + (10 x 16 0 ) = =26 10

Decimal to Hex Repeated division by 16 Ex1: = ? 16 26/16=1 and reminder is 10 (A) 1/16 = 0 and reminder is 1 Therefore = 1A 16 Ex2: = 53 16

Determine next number in HEX  2E  9F  7CBF

Hex to Binary  Convert each digit to 4 bits binary equivalent  Example: AB35H

Binary to Hex  Break binary number into 4-bit sections from LSB to MSB  Convert the 4 bits binary to its hex equivalent  Example:  Add zeros to the left if necessary A F B 2

Two’s complement signed number  Positive number ex: =  Negative number is shown as 2’s complement of positive number  Write number as 8 bits  Complement each bit (0 ->1 and 1-> 0)  Add 1  Ex: = ?  (1’s complement) =>  1 

Signed & unsigned numbers  8 bit unsigned can represent 0 to  8 bit signed can represent -128 to  2’s complement of a negative number is it’s corresponding positive number.  We do not have negative & positive zero!  If you have a negative number, How do you get its decimal equivalent??

2’s complement application  CPU do not need 2 separate hardware module to perform add & subtraction. Subtraction can be done as: a – b = a + (-b)

ASCII Code  American Standard Code for Information Interchange  7 bits needed. Ex: code for Q is 51( )  One bit is added for Parity  Parity is even or odd  Even parity: Number of 1s are even ex:  Odd parity: Number of 1s are odd

Binary Coded Decimal (BCD)  Each decimal digit is represented by 4 bits  Example1: 53  Example 2:

Application of BCD  Most common application of BCD is with seven-segment displays  BCD to seven segment decoder inputs one 4- bit BCD and outputs a segment pattern-code

Seven-segment  The display consists of seven individual bar LEDs  Displays decimal and hexadecimal values  The LED segments are labeled “a” through “g”  To illuminate a “0” on the display, segment “a” through “f” are illuminated

Overflow  Whenever two signed numbers are added or subtracted and the result is too large for the number of bits allocated

No overflow when adding a positive and a negative number No overflow when subtracting numbers with the same sign Overflow occurs when the result has “wrong” sign (verify!): Operation Operand A Operand B Result Indicating Overflow A + B  0  0  0 A + B  0  0  0 A – B  0  0  0 A – B  0  0  0 Detecting Overflow

Computer Programming  High level language  Assembly Language  Machine Language