ME 4447/6405 Microprocessor Control of Manufacturing Systems and

Slides:



Advertisements
Similar presentations
Representing Numbers: Integers
Advertisements

HEXADECIMAL NUMBERS Code
Number Systems & Operations
Chapter 2 : Number System
Chapter 1 Binary Systems 1-1. Digital Systems
Number Systems Standard positional representation of numbers:
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Number Systems & Logic Gates Day 2. Octal Number System Base (Radix)8 Digits0, 1, 2, 3, 4, 5, 6, 7 e.g = =648 1 =88 0 =1 The digit.
Mantıksal Tasarım – BBM231 M. Önder Efe
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
Dr. Bernard Chen Ph.D. University of Central Arkansas
Simple Data Type Representation and conversion of numbers
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
Computer Arithmetic Nizamettin AYDIN
Number Systems. Today Decimal Hexadecimal Binary –Unsigned Binary –1’s Complement Binary –2’s Complement Binary.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
1 DLD Lecture 18 Recap. 2 Recap °Number System/Inter-conversion, Complements °Boolean Algebra °More Logic Functions: NAND, NOR, XOR °Minimization with.
Number systems, Operations, and Codes
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
1 IT 231, CMPE 331 Digital Logic Design Week 2 Number systems and arithmetic.
Microcomputers I - Electrical and Computer Engineering Dept. at Kettering.
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
SAK Chapter 21 Chapter 2 : Number System 2.1 Decimal, Binary, Octal and Hexadecimal Numbers 2.2 Relation between binary number system with other.
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Introduction To Number Systems Binary System M. AL-Towaileb1.
CSC 331: DIGITAL LOGIC DESIGN COURSE LECTURER: E. Y. BAAGYERE. CONTACT: LECTURE TIME: 15:40 – 17:45 hrs. VENUE: SP-LAB.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
1’S COMPLEMENT REPRESENTATION 1’s complement of a number (binary) is obtained by changing all 1’s to 0 and all 0’s to 1. If one of these numbers is positive.
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.
Prepared By: Norakmar Binti Mohd Nadzari CHAPTER 2 ARITHMETIC AND LOGIC UNIT.
Lecture 4: Digital Systems & Binary Numbers (4)
Digital Logic & Design Adil Waheed Lecture 02.
Negative Numbers and Subtraction
Chapter 4 Operations on Bits.
Negative Binary Numbers
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
Digital Systems and Number Systems
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Digital Systems and Binary Numbers
Introduction The term digital is derived from the way computers perform operation, by counting digits. Application of digital technology: television, communication.
Negative Binary Numbers
CSE 102 Introduction to Computer Engineering
Number System conversions
Number Systems.
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
University of Gujrat Department of Computer Science
Computer Organization and ASSEMBLY LANGUAGE
Data Representation Data Types Complements Fixed Point Representation
Digital Electronics & Logic Design
Digital Logic & Design Lecture 03.
ELL100: INTRODUCTION TO ELECTRICAL ENGG.
Subtraction The arithmetic we did so far was limited to unsigned (positive) integers. Today we’ll consider negative numbers and subtraction. The main problem.
Digital Logic & Design Lecture 02.
EE207: Digital Systems I, Semester I 2003/2004
Data Representation – Chapter 3
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
1.6) Storing Integer:.
Numbers and Arithmetic and Logical Operation
Unit 18: Computational Thinking
Digital Systems and Binary Numbers
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
2’s Complement form 1’s complement form 2’s complement form
Number Systems Rayat Shikshan Sanstha’s
Number Systems Rayat Shikshan Sanstha’s
Binary to Decimal Conversion
Copyright © Cengage Learning. All rights reserved.
Introduction To Number Systems
COE 202: Digital Logic Design Number Systems Part 2
Presentation transcript:

ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics Instructor: Professor Charles Ume Lecture #6

Review Digital Arithmetic

Hexadecimal – Base 16 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30

Octal – Base 8 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 20 21 22 23 24 25 26 27 30

Conversion from base 10  base 16  base 2 and back  base 10 Example 1: 67410 32 10 Remainder 2 Remainder A 64 34 2 - Read - Read Remainders backwards Therefore, 67410 = 2A216 = 0010 1010 0010

Example 1 Cont’d 2A216 to base 10: = 2 x 160 + A x 161 + 2 x 162 = 67410 0010 1010 00102 to base 10: =0 x 20 + 1 x 21 + 0 x 22 + 0 x 23 +0 x 24 + 1 x 25 + 0 x 26 + 1 x 27 +0 x 28 + 1 x 29 + 0 x 210 + 0 x 211 =67410

Conversion from base 10 to 2 This method known as “repeated division by 2.” Example 2: Convert 3710 to base 2. Remainder 1 Remainder 0 Read Stop dividing when the answer is 0. The remainders are read in reverse order to form the answer. Therefore, 3710 = 00100101 = 2516 (Note: 2 front bits added for 8-bit processor)

Example 2 Cont’d Note: 3710 = 7 x 100 + 3 x 101 = 7 + 30 = 37 Therefore, 1001012 = 1 x 20 + 0 x 21 + 1 x 22 + 0 x 23 + 0 x 24 + 1 x 25 + 0 x 26 + 0 x 27 = 1 + 0 + 4 + 0 + 0 +32 + 0 + 0 = 3710

Example 3 Convert 110.1112 to the decimal system Solution: 110.1112 = (1 x 2-3) + (1 x 2-2) + (1 x 2-1) + (0 x 20) + (1 x 21) + (1 x 22) = 0.125 + 0.25 + 0.5 + 2 + 4 = 6.87510

Example 4 Convert 2A2.516 to the decimal system Solution: 2A2.5 = (5 x 16-1) + (2 x 160) + (A x 161) + (2 x 162) = 0.3125 + 2 +160 +512 = 674.3125

Example 5 Convert 0.7510 to Binary Solution: 0.75 x 2 = 1.50  1 Therefore, 0.7510 = 0.112 Read

Example 6 Convert 0.301710 to Binary Solution: 0.3017 x 2 = 0.6034  0 Therefore, 0.301710 = 0.0100…… Read

The circuitry required for computers to add binary numbers is relatively simple. However, since circuitry to subtract binary numbers is very difficult to design and build, another subtraction method would be desirable. The method is subtraction by addition of the 1’s or 2’s complements of the number. Subtraction by the addition of 1’s complement requires much more hardware to implement. Most computers on the market perform subtraction by the addition of 2’s complement. Therefore we will concentrate only on subtraction by 2’s complement. How to obtain 1’s and 2’s complements: Binary number = 1011 1001 1’s complement = 0100 0110 2’s complement = 0100 0111 When subtraction is performed the answer can be positive or negative, depending upon the relative values of the minuend and subtrahend (e.g. a-b) We must, therefore, in some way account for the sign of the answer.

The most significant bit (MSB) is used as the sign bit The most significant bit (MSB) is used as the sign bit. If the MSB is a ‘1’, the number represented by the remaining 7 bits is assumed to be negative and is represented by its 2’s complement. If the MSB is a ‘0’, the number represented in the remaining seven bits is positive and is equal to the binary equivalent of these seven bits. Example 1: 1710 – 610=(1116 – 616) 0000 0110 = 616 1111 1001 = 1’s complement of 616 1111 1010 = 2’s complement of 616 0001 0001 = 1116 1111 1010 = 616 in 2’s complement ------------- 1 0000 1011 1 0000 1011 = + 0B16 = + 1110

Example 2: 610 – 1710 = (616 – 1116) 0001 0001 = 1116 1110 1110 = 1’s complement of 1116 1110 1111 = 2’s complement of 1116 0000 0110 = 616 1110 1111 = 1116 in 2’s complement ------------ 1111 0101 1111 0101 = - (0000 1010 + 1) = - 0000 1011 = - 0B16 or - 1110 Note: C and N bits will be set. C is set to 1 because the absolute value of subtraction (17) Is larger than the absolute value of the minuend (6)

Since bit 7 serves as the sign bit Since bit 7 serves as the sign bit. A ‘0’ in bit 7 indicates a positive number. Thus the maximum positive number an 8-bit processor can represent in 2’s complement is 0111 11112 or 7F16 or 12710. Likewise a ‘1’ in bit 7 indicates a negative number. The minimum negative number that an 8-bit processor can represent in 2’s complement is 8016 (1000 0000). Its 2’s complement is – (0111 1111 + 1) = - (1000 0000) = - 8016 = - 12810 It is possible to (add) or subtract two numbers and get invalid answer, especially when the answer is out of the range of –128  +127 This situation is referred to as 2’s complement overflow. If a subtraction (or addition) is performed and 2’s complement overflow occurs the V bit will be set to a ‘1’ otherwise it will be cleared.

Example 3: - 8510 - 9010= -17510 8510 = 5516 = 0101 01012 1010 1010 = 1’s comp. of 5516 1010 1011 = 2’s comp. of 5516 9010 = 5A16 = 0101 10102 1010 0101 = 1’s comp. of 5A16 1010 0110 = 2’s comp. of 5A16 1010 1011 = (2’s comp. of 5516) 1010 0110 = (2’s comp. of 5A16) ------------- 1 0101 0001 = +5116 = +8110 V bit will be set. C bit will be set.

Example 4: 4D16 + 6616 01001101 positive 01100110 positive -------------- 10110011 negative V bit is set.

Logic Gates

Logic Gates Why do we study Logic Gates? Used to Determine Status or Occurrence of Events

“AND” Function Symbol Equation Input A Output C 1 B C = A ● B

“OR” Function Symbol Equation Input A Output C 1 B C = A + B

C = A + B “Exclusive OR” Function (XOR) Symbol Equation Input A Output 1 B C = A + B

“Not” Function (Inverter) Symbol Equation Input A Output C 1 C = A

“NOR” Function “NAND” Function Input A Output C 1 B Input A Output C 1 B

QUESTIONS???