Download presentation
Presentation is loading. Please wait.
1
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 2014
2
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 2014
3
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 2014
4
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 2014
5
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 MSP430 microcontroller to solve engineering problems (see chip timeline on web). Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
6
ECE 3430 – Intro to Microcomputer Systems
Number Systems Number Base Notation Used in this Course: Decimal, Base 10 <num> or d’<num>’ Ex) 11 or d’11’ Binary, Base b<num> or b’<num>’ or <num>b Ex) 0b1011 or b’1011’ or 1011b Octal, Base 8 q’<num>’ or <num>q Ex) q’13’ or 13q Hexadecimal, Base 16 0x<num> or h’<num>’ or <num>h Ex) 0xBD or h’BD’ or BDh ASCII ‘<chars>’ or “<chars>” Ex) ‘Fred’ (non-terminated) or “Barney” (terminated) The MSP430 assembler and C/C++ compiler will make use of one of the above. We’ll discuss assembly, the assembler, and higher-level programming languages (C/C++) later. Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
7
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 b’1011’ to decimal (weight) % = 1•(23) + 0• (22) + 1• (21) + 1• (20) = 1•(8) + 0• (4) + 1• (2) + 1• (1) = = d’11’ Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
8
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 b’ ’ to decimal = 1•(23) + 0• (22) + 1• (21) + 1• (20) + 1• (2-1) + 0• (2-2) • (2-3) = 1•(8) + 0• (4) • (2) • (1) • (0.5) + 0• (0.25) + 1• (0.125) = = d’11.625’ Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
9
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 LSB MSB = b’1011’ Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
10
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 decimal to binary Product th Digit • MSB • • LSB d’0.375’ = b’.011’ finished Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
11
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 NOTE (h’A’=d’10’, h’B’=d’11’, h’C’=d’12’, h’D’=d’13’, h’E’=d’14’, h’F’=d’15’) ex) Convert h’2BC’ to decimal (weight) B C = 2• (162) + B• (161) + C• (160) = 2•(256) • (16) • (1) = = d’700’ Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
12
ECE 3430 – Intro to Microcomputer Systems
Number Systems Base Conversion – Hex to Decimal with Fractions - the fractional digits have negative weights (BASE 16) - NOTE (h’A’=d’10’, h’B’=d’11’, h’C’=d’12’, h’D’=d’13’, h’E’=d’14’, h’F’=d’15’) ex) Convert h’2BC.F’ to decimal (weight) B C F = 2• (162) + B• (161) + C• (160) + F• (16-1) = 2•(256) • (16) • (1) • (0.0625) = = d’ ’ Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
13
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 decimal to hex st, convert the integer part… Quotient Remainder LSB MSB = h’1A4’ 2nd, convert the fractional part… Product th Digit • MSB = h’.A’ d’ ’ = h’1A4.A’ Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
14
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 2014
15
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 h’ABC’ to binary A B C = = b’ ’ 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 2014
16
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 b’ ’ to hex = 3 2 F = h’32F’ Binary to Octal works the same way using groups of 3 binary bits. Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
17
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 b’1011’ and b’1001’ +________ Carry Bit Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
18
ECE 3430 – Intro to Microcomputer Systems
Number Systems Ways to represent integer signed values: Sign-Magnitude (historical): b’ ’ = d’-127’ 0 and -0 can be represented. 8-bit range: to 127 Number line: 0,1,…,127,-0,-1,…,-127 <repeat> One’s Complement (historical): b’ ’ = d’-0’ 8-bit range: -127 to 127 Number line: 0,1,…,127,-127,-126,…,-0 <repeat> Two’s Complement (used today): b’ ’ = d’-1’ Only one 0 representation. Always one more negative value than positive. 8-bit range: -128 to 127 Number line: 0,1,…,127,-128,-127,…-1 <repeat> Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
19
ECE 3430 – Intro to Microcomputer Systems
Number Systems Two’s Complement - this encoding was chosen to represent negative numbers in modern computers - this way we can use “adding” circuitry to perform subtraction (easily) - 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: b’ ’ is positive number) Negative #’s : MSB = (ex: b’ ’ is 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 2014
20
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 = b’ ’ Note the Sign Bit Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
21
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 = b’ ’ Invert: = Add 1 = b’ ’ (-52dec) Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
22
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 = b’ ’ right-most 1 b’ ’ (-52dec) Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
23
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 2014
24
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 d’8’ from d’15’ d’15’ = b’ ’ d’8’ = b’ ’ -> two’s complement -> invert add = d’-8’ Now Add: (-8) = _________ = d’7’ Disregard Carry Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
25
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 2014
26
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 ex) Represent 17dec Binary = BCD = 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 2014
27
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’ = h’41’ ‘a’ = h’61’ There are ASCII tables everywhere. Google it. Unicode Supports text expressed in most of the world’s writing systems. Each character represented by one or more bytes. UTF-8, UTF-16 are most popular today. UTF-8 is ubiquitous on the World-Wide Web (avoids complications arising from byte-ordering). Lecture #1 ECE 3430 – Intro to Microcomputer Systems Fall 2014
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.