ECE 3430 – Intro to Microcomputer Systems

Slides:



Advertisements
Similar presentations
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Advertisements

Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
EE 261 – Introduction to Logic Circuits
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.
Simple Data Type Representation and conversion of numbers
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Computer Arithmetic Nizamettin AYDIN
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
IT253: Computer Organization
Eng.Samra Essalaimeh Philadelphia University 2013/ nd Semester PIC Microcontrollers.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Introduction to Microprocessors Chapter 2. Decimal or Base 10 Numbers  Have ten different digits (0-9)  It is a weighted number system. Each position.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
MECH1500 Chapter 3.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
ECE 2110: Introduction to Digital Systems
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.
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
CS2100 Computer Organisation
Unit 1 Introduction Number Systems and Conversion.
Cosc 2150: Computer Organization
NUMBER SYSTEMS.
Lec 3: Data Representation
CS2100 Computer Organisation
ECE 3430 – Intro to Microcomputer Systems
CHAPTER 9 COMPUTER ARITHMETIC - ALU
ECE 3430 – Intro to Microcomputer Systems
Lecture No. 4 Number Systems
Data Representation Binary Numbers Binary Addition
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
CHAPTER 1 : INTRODUCTION
Digital Arithmetic Wen-Hung Liao, Ph.D..
Binary Arithmetic Binary arithmetic is essential in all digital computers and in many other types of digital systems. Addition, Subtraction, Multiplication,
Logistics Always read the Calendar at
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 Systems.
ECE 3430 – Intro to Microcomputer Systems
William Stallings Computer Organization and Architecture 7th Edition
University of Gujrat Department of Computer Science
CS1010 Programming Methodology
Computer Organization and ASSEMBLY LANGUAGE
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
INTRODUCTION TO LOGIC DESIGN Chapter 1 Digital Systems and Binary Numbers gürtaçyemişçioğlu.
Number Systems and Codes
MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
Digital Logic & Design Lecture 03.
ECE 3430 – Intro to Microcomputer Systems
Digital Logic & Design Lecture 02.
ECEG-3202 Computer Architecture and Organization
C1 Number systems.
COMS 161 Introduction to Computing
2’s Complement form 1’s complement form 2’s complement form
Chapter 8 Computer Arithmetic
ECE 331 – Digital System Design
Lecture 2: Number Systems
Presentation transcript:

ECE 3430 – Intro to Microcomputer Systems ECE 3430 – Introduction to Microcomputer Systems University of Colorado at Colorado Springs Lecture #1 Agenda Today: 1) Microcomputers, Microprocessors, Microcontrollers 2) Number Systems Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

Microcomputers and Terminology There are lots of confusing terms floating around which don’t always have consistent definitions. Get used to it! What is a microcomputer? Term which evolved into personal computer (PC)—desktop and laptop. Sometimes just referred to as a computer. A microcomputer is a computer—but a computer is not a microcomputer. Other types of computers (not digital in nature): Analog (slide ruler, abacus, mechanical computers) Pulse (neural networks) Talk about main components of a microcomputer. Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

Microcomputers and Terminology Other types of digital computers: Minicomputers (larger than microcomputers) Mainframe computers (larger than minicomputers) Supercomputers (biggest and fastest) Microcomputers have five classic components: Input (keyboards, mice, touch-screens, etc.) Output (LCD panels, monitors, printers) Memory (ROM, RAM, hard drives) Datapath (performs arithmetic and logical operations [ALU]) Control (state machine in nature, controls the datapath) The last two (datapath and control) are usually collectively called the processor or central processor unit (CPU). Microcomputers are typically computers that are developed around a microprocessor. Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

Microprocessors and Microcontrollers A CPU packaged in a single integrated circuit. Typically employs multiple execution pipelines, data and instruction caches, and other complex logic to get very high execution throughput (lots of “work” done in a given unit of time). Microcontroller: A computer system implemented on a single, very large-scale integrated circuit. Generally speaking, a microcontroller contains everything in a microprocessor plus on-chip peripheral devices (bells and whistles). A microcontroller may contain memories, timer circuits, A/D converters, USB interface engines, the kitchen sink, et cetera. Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

Use Models for Microprocessors/Microcontrollers Used in systems that need to do complex calculations (serious number crunching). Used in systems that need to do calculations very quickly. Microcontrollers: Typically don’t have overly-complex datapaths and control logic. Microcontrollers typically live in a system to do one dedicated operation. Circuits that do complex control operations (not complex calculations) use microcontrollers. The datapath complexity of a microprocessor is often scaled back in microcontrollers—in favor of on-chip peripheral devices. This course will focus on the use of the MC68HC11 microcontroller to solve engineering problems (see chip timeline on web). Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Number Base Notation Used in this Course: Decimal, Base 10 <nothing> Ex) 11 Binary, Base 2 % Ex) %1011 Octal, Base 8 @ Ex) @13 Hexadecimal, Base 16 $ Ex) $BD ASCII ‘ Ex) ‘z This notation is also used by the HC11 assembler we will be using. We’ll discuss assembly and the assembler later. Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Base Conversion – Binary to Decimal Each digit has a “weight” of 2n that depends on the position of the digit. Multiply each digit by its “weight”. Sum the resultant products. Ex) Convert %1011 to decimal 23 22 21 20 (weight) % 1 0 1 1 = 1•(23) + 0• (22) + 1• (21) + 1• (20) = 1•(8) + 0• (4) + 1• (2) + 1• (1) = 8 + 0 + 2 + 1 = 11 Decimal Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Base Conversion – Binary to Decimal with Fractions The weight of the binary digits have negative positions. ex) Convert %1011.101 to decimal 23 22 21 20 2-1 2-2 2-3 % 1 0 1 1 . 1 0 1 = 1•(23) + 0• (22) + 1• (21) + 1• (20) + 1• (2-1) + 0• (2-2) + 1• (2-3) = 1•(8) + 0• (4) + 1• (2) + 1• (1) + 1• (0.5) + 0• (0.25) + 1• (0.125) = 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125 = 11.625 Decimal Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Base Conversion – Decimal to Binary - the decimal number is divided by 2, the remainder is recorded - the quotient is then divided by 2, the remainder is recorded - the process is repeated until the quotient is zero ex) Convert 11 decimal to binary Quotient Remainder 2 11 5 1 LSB 2 5 2 1 2 2 1 0 2 1 0 1 MSB = %1011 Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Base Conversion – Decimal to Binary with Fractions - the fraction is converted to binary separately - the fraction is multiplied by 2, the 0th digit is recorded - the remaining fraction is multiplied by 2, the 0th digit is recorded - the process is repeated until the fractional part is zero ex) Convert 0.375 decimal to binary Product 0th Digit 0.375•2 0.75 0 MSB 0.75•2 1.50 1 0.5•2 1.00 1 LSB 0.375 decimal = % .011 finished Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Base Conversion – Hex to Decimal - the same process as “binary to decimal” except the weights are now BASE 16 - NOTE ($A=10, $B=11, $C=12, $D=13, $E=14, $F=15) ex) Convert $2BC to decimal 162 161 160 (weight) $2 B C = 2• (162) + B• (161) + C• (160) = 2•(256) + 11• (16) + 12• (1) = 512 + 176 + 12 = 700 Decimal Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Base Conversion – Hex to Decimal with Fractions - the fractional digits have negative weights (BASE 16) - NOTE ($A=10, $B=11, $C=12, $D=13, $E=14, $F=15) ex) Convert $2BC.F to decimal 162 161 160 16-1 (weight) $2 B C . F = 2• (162) + B• (161) + C• (160) + F• (16-1) = 2•(256) + 11• (16) + 12• (1) + 15• (0.0625) = 512 + 176 + 12 + 0.938 = 700.938 Decimal Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Base Conversion – Decimal to Hex - the same procedure is used as before but with BASE 16 as the divisor/multiplier ex) Convert 420.625 decimal to hex 1st, convert the integer part… Quotient Remainder 16 420 26 4 LSB 16 26 1 10 16 1 0 1 MSB = $1A4 2nd, convert the fractional part… Product 0th Digit 0.625•16 10.00 10 MSB = $ .A 420.625 decimal = $1A4.A Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Base Conversion – Octal to Decimal / Decimal to Octal The same procedure is used as before but with BASE 8 as the divisor/multiplier Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

Number Systems (Shortcuts) Base Conversion – Hex to Binary Each HEX digit is made up of four binary bits which represent 8, 4, 2, and 1 Ex) Convert $ABC to binary $A B C = % 1010 1011 1100 = %1010 1011 1100 Octal to Binary works the same except using groups of three binary Bits which represent 4, 2, and 1. Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

Number Systems (Shortcuts) Base Conversion – Binary to Hex - every 4 binary bits for one HEX digit - begin the groups of four at the LSB - if necessary, fill the leading bits with 0’s ex) Convert $ABC to binary = % 11 0010 1111 $3 2 F Binary to Octal works the same way using groups of 3 binary bits. Talk about representations of negative numbers – alternate formats other than two’s complement: * Sign – Magnitude * One’s complement * Two’s complement Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Binary Addition - same as BASE 10 addition - need to keep track of the carry bit ex) Add %1011 and %1001 1 1 % 1 0 1 1 % 1 0 0 1 +________ 1 0 1 0 0 Carry Bit Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Two’s Complement - we need a way to represent negative numbers in a computer - this way we can use “adding” circuitry to perform subtraction - since the number of bits we have is fixed (i.e., 8), we use the MSB as a sign bit Positive #’s : MSB = 0 (ex: %0000 1111, positive number) Negative #’s : MSB = 1 (ex: %1000 1111, negative number) - the range of #’s that a two’s complement code can represent is: (-2n-1) < N < (2n-1 – 1) : n = number of bits ex) What is the range of #’s that an 8-bit two’s complement code can represent? (-28-1) < N < (28-1 – 1) (-128) < N < (+127) Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Two’s Complement Negation - to take the two’s complement of a positive number (i.e., find its negative equivalent) Nc = 2n – N Nc = Two’s Complement N = Original Positive Number ex) Find the 8-bit two’s complement representation of –52dec N = +52dec Nc = 28 – 52 = 256 – 52 = 204 = %1100 1100 Note the Sign Bit Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Two’s Complement Negation (a second method) - to take the two’s complement of a positive number (i.e., find its negative equivalent) 1) Invert all the bits of the original positive number (binary) 2) Add 1 to the result ex) Find the 8-bit two’s complement representation of –52dec N = +52dec = %0011 0100 Invert: = %1100 1011 Add 1 = %1100 1011 + 1 -------------------- %1100 1100 (-52dec) Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Two’s Complement Negation (a third method) Begin with the original positive value. Change all of bits to the left of the right-most 1 to the opposite state. Done. ex) Find the 8-bit two’s complement representation of –52dec N = +52dec = %0011 0100 right-most 1 %1100 1100 (-52dec) Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Two’s Complement Addition - Addition of two’s complement numbers is performed just like standard binary addition - However, the carry bit is ignored Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Two’s Complement Subtraction - now we have a tool to do subtraction using the addition algorithm ex) Subtract 8dec from 15dec 15dec = %0000 1111 8dec = %0000 1000 -> two’s complement -> invert %1111 0111 add1 %1111 0111 + 1 ----------------- %1111 1000 = -8dec Now Add: 15 + (-8) = %0000 1111 %1111 1000 +_________ % 1 0000 0111 = 7dec Disregard Carry Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Two’s Complement Overflow - If a two’s complement subtraction results in a number that is outside the range of representation (i.e., -128 < N < +127), an “overflow” has occurred. ex) -100dec – 100dec- = -200dec (can’t represent) - There are three cases when overflow occurs 1) Sum of like signs results in answer with opposite sign 2) Negative – Positive = Positive 3) Positive – Negative = Negative - Boolean logic can be used to detect these situations. Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems Binary Coded Decimal - Sometimes we wish to represent an individual decimal digit as a binary representation (i.e., 7-segment display to eliminate a decoder) - We do this by using 4 binary digits. Decimal BCD 0 0000 1 0001 ex) Represent 17dec 2 0010 3 0011 Binary = %10111 4 0100 BCD = %0001 0111 5 0101 6 0110 7 0111 8 1000 9 1001 Comment on why BCD exists: * Simplifies some display electronics (simple mapping). * Avoids conversions binary to ASCII. Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009

ECE 3430 – Intro to Microcomputer Systems Number Systems ASCII American Standard Code for Information Interchange English Alphanumeric characters are represented with a 7-bit code ex) ‘A’ = $41 ‘a’ = $61 There is an ASCII table in the front of the HC11 Programming Reference Guide. More on Number Systems in Appendix A of Your Text Book. Mention UNICODE. Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2009