Introduction to Micro Controllers Embedded System Design Introduction
Introduction to Micro Controllers & Embedded System Design Introduction & Background Department of Electrical & Computer Engineering Missouri University of Science & Technology hurson@mst. edu A. R. Hurson 1
Introduction to Micro Controllers & Embedded System Design • Instructor: Ali R. Hurson 128 EECH hurson@mst. edu Office Hours T, R 11: 00 -12: 00 • Text: The 8051 Microcontroller and Embedded Systems Using Assembly and C, Second Ed. , • Class notes available at A. R. Hurson 2
Introduction to Micro Controllers & Embedded System Design • Grading Policy • In class exams & Quizzes: 40% • Final Exam (Comprehensive): 35% • Home works and Projects: 20% • Active class participation 5% • Individual grade will be determined based on individual effort, individual effort relative to the class effort, and proactive class participation. A. R. Hurson 3
Introduction to Micro Controllers & Embedded System Design • Hardcopy of homeworks and Projects are collected at the beginning of the class, • It is encouraged to work as a group (at most three people per group) on homeworks/projects (grouping is fixed through out the semester), • December 1 is the deadline for filing grade corrections; no requests for grade change/update will be entertained after this deadline A. R. Hurson 4
Introduction to Micro Controllers & Embedded System Design System Class Main Frames Minicomputer Desktops Smart products Era 1950 s on 1970 s on 1980 s on 2000 s on Form Factor Multi-cabinets Multiple boards Single board Single chip Resource Type Corporate Departmental Personal Embedded Users/CPU 100 s-1000 s 10 s-100 s 1 100 s/user Cost $1 million $100, 000+ $1, 000 -$10, 000 $10 -$100 # worldwide 10, 000+ 100, 000 s+ 108 1011 Major Players IBM, CDC, GE, Boroughs, NCR Honeywell, Univac Dec, IBM, HP, Pyramid, Wang Apple, IBM, HP, Sun, Dell, SGI ? OS By manufacturer Some Unix DOS, Mac. OS, Windows A. R. Hurson ? 5
Introduction to Micro Controllers & Embedded System Design • Why this course? • What is its objective (s)? • This course attempts to study a computer in general and specifically microprocessor and microcontroller architectures. • So one has to find out what a computer is. A. R. Hurson 6
Introduction to Micro Controllers & Embedded System Design • A computer, like any other system, is a collection of interconnected entities (components) in order to perform a well defined function. This function is determined by the functions performed by its components and by the manner in which they are interconnected. • The function of the computer is a mapping of the input data to the output data: F: A B • In case of a digital system A and B are digital or discrete quantities. A. R. Hurson 7
Introduction to Micro Controllers & Embedded System Design • The study of computers is the study of its components, their interactions, and their parallel activities and cooperations. • In this course a computer is viewed as a collection of five interconnected components: • • Input Unit Output Unit Memory Unit Central Processing Unit (CPU): • • Control Unit (CU) Arithmetic Logic Unit (ALU) A. R. Hurson 8
Introduction to Micro Controllers & Embedded System Design • Input Unit: is an interface between the outside world and the internal parts. It performs two tasks: Transmission and Translation of information. • Output Unit: is an interface between the internal parts and the outside world. Its functions are the same as the Input Unit. • Memory Unit: acts as storage. It stores the instructions, data, intermediate, and final results. • Central Processor Unit: is used to: • • Interpret the instructions and initiate their executions. Perform arithmetic and logical operations on the data. A. R. Hurson 9
Introduction to Micro Controllers & Embedded System Design CPU CU ALU Information Input Unit Memory Unit Output Unit Result Data Path Control Path A. R. Hurson 10
Introduction to Micro Controllers & Embedded System Design • In general, a computer can be studied at four different levels: Electronic, Logic, Programming, and System. Though it is hard to generalize, usually: • Electronic level is the subject of physics and mathematics, • Logic level is the subject of electrical engineering, and • Programming and System levels are the subjects of computer science/computer engineering. A. R. Hurson 11
Introduction to Micro Controllers & Embedded System Design Level Electronic Logic Components Active: transistor, voltage sources Passive: resistor, capacitor combinational sequential register Programming compiler interpreter machine oriented assembly machine micro • gates, AND, OR, . . . Flip Flops, . . . register, data, operators, . . . Program Instruction Subroutine Module • • • A. R. Hurson System control, processor, . . . 12
Introduction to Micro Controllers & Embedded System Design • Conversion from Decimal to base R • A decimal number can be converted to another base, say R, by repeated division and recording the remainder, until the quotient becomes zero. A. R. Hurson 13
Introduction to Micro Controllers & Embedded System Design • Conversion from Decimal to base R • Example: Convert 72 in base 10 to a hexadecimal number (i. e. , base 16) Q R Remarks 72/16 = 4 8 Least significant digit 4/16 = 4 Most significant digit 0 • Hence (72)10 = (48)16 A. R. Hurson 14
Introduction to Micro Controllers & Embedded System Design • Conversion from Decimal to base R • Example: Convert 56 in base 10 to a binary number Q R 56/2 = 28 0 28/2 = 14 0 14/2 = 7 0 7/2 = 3 1 3/2 = 1 1 ½= 0 1 Remarks Least significant digit Most significant digit • Hence (56)10 = (111000)2 A. R. Hurson 15
Introduction to Micro Controllers & Embedded System Design • Conversion from base R to Decimal • This will be done by summing the products of each digit with its positional weight. Positional weight is the power of base starting from 0. • (121)10 = 1 2 1 • Positional weight 102 101 100 • Hence 121 = 1 * 10 + 2 * 101 + 1 * 100 A. R. Hurson 16
Introduction to Micro Controllers & Embedded System Design • Conversion from base 16 to Decimal • Example: Convert 56 in base 16 to a decimal number (56)16 = 5 * 161 + 6 * 160 = 80 + 6 = (86)10 A. R. Hurson 17
Introduction to Micro Controllers & Embedded System Design • Conversion from base 2 to Decimal • Example: Convert (110110)2 to a decimal number (110110)2 = 1 * 25 + 1 * 24 + 0 * 23 + 1 * 22 + 1 * 21 + 0 * 20 = 32 + 16 + 0 + 4 + 2 + 0 = (54)10 A. R. Hurson 18
Introduction to Micro Controllers & Embedded System Design • Conversion from base R to base Q • Convert the number from base R to base 10 • Convert the decimal number to base Q A. R. Hurson 19
Introduction to Micro Controllers & Embedded System Design • Conversion from base R to base Q • Example: Convert (57)8 to base 12 • (57)8 = 5 * 81 + 7 * 80 = 40 + 7 = (47)10 Q R Remarks 47/12 = 3 11 (B) Least significant digit 3/12 = 3 Most significant digit 0 • Hence: (57)8 = (3 B)12 A. R. Hurson 20
Introduction to Micro Controllers & Embedded System Design • Conversion from base 16 to binary • Convert each hexadecimal digit into a 4 binary digits. • Example: Convert (ABC)16 to binary A = 1010 B = 1011 C = 1100 • Hence: (ABC)16 = (101010111100)2 A. R. Hurson 21
Introduction to Micro Controllers & Embedded System Design • Conversion from binary to base 16 • Start from right to left, make groups of 4 binary digits, • Convert each group into a hexadecimal digit • Example: Convert (11001)2 to hexadecimal number • Hence: (11001)2 = (199)16 A. R. Hurson 22
Introduction to Micro Controllers & Embedded System Design • Question: conversion from binary to octal and vice versa? A. R. Hurson 23
Introduction to Micro Controllers & Embedded System Design • Conversion of decimal fraction to base R • This can be done by iterative multiplication of fraction by base R and recording the integer parts of the results. A. R. Hurson 24
Introduction to Micro Controllers & Embedded System Design • Conversion of decimal fraction to base R • Example: Convert (. 56)10 to hexadecimal Integer part Remarks . 56* 16 = 8. 96 8 1 st fraction digit . 96 * 16 = 15. 36 15 (E) 2 nd fraction digit • Hence (. 56)10 = (. 8 E)16 A. R. Hurson 25
Introduction to Micro Controllers & Embedded System Design • Conversion of decimal fraction to base R • Example: Convert (. 56)10 to binary Integer part Remarks . 56* 2 = 1. 12 1 1 st fraction digit . 12 * 2 = 0. 24 0 2 nd fraction digit . 24 * 2 =. 48 0 3 rd fraction digit . 48 * 2 =. 96 0 4 th fraction digit . 96 * 2 = 1. 92 1 5 th fraction digit . 92 * 2 = 1. 84 1 6 th fraction digit . 84 * 2 = 1. 64 1 7 th fraction digit • Hence (. 56)10 = (. 100011)2 A. R. Hurson 26
Introduction to Micro Controllers & Embedded System Design • Conversion of fraction in base R to decimal fraction • This can be done by summation of multiplication of each digit by its positional weight in base R. A. R. Hurson 27
Introduction to Micro Controllers & Embedded System Design • Conversion of fraction in base R to decimal fraction • Example: Convert (. 111011)2 to a decimal number • (. 111011)2 = 1 * 1/2 + 1 * 1/4 + 1 * 1/8 + 0 * 1/16 + 1 * 1/32 + 1 * 1/64 = 1/2 + 1/4+ 1/8 + 1/32 + 1/64 =. 5 + . 25 +. 18 + … = (. 875)10 A. R. Hurson 28
Introduction to Micro Controllers & Embedded System Design • Basic Arithmetic Operations are: • Addition • Subtraction • Multiplication • Division A. R. Hurson 29
Introduction to Micro Controllers & Embedded System Design • Basic Logic Operations are: • AND • OR • NOT A. R. Hurson 30
Introduction to Micro Controllers & Embedded System Design • Questions • What is the minimum number of arithmetic operations needed to carry out all arithmetic operations? • What is the minimum number of logic operations needed to carry out all logic operations? A. R. Hurson 31
Introduction to Micro Controllers & Embedded System Design • Addition of two binary bits is as follows: a b a+b Sum Carry 0 0 0+0 0 1 0+1 1 0 1+0 1 1 1 +1 0 1 A. R. Hurson 32
Introduction to Micro Controllers & Embedded System Design • Addition of three binary bits is as follows: a b c Sum Carry 0 0 0 0 1 1 0 0 1 0 1 1 1 0 0 1 1 1 A. R. Hurson 33
Introduction to Micro Controllers & Embedded System Design • Addition of two binary numbers can be done by using the previous two tables. • Example: perform (11001)2 + (101101)2 Carry + Sum A. R. Hurson 1 0 0 25 1 1 0 0 1 + 22 1 0 1 1 0 47 1 0 1 1 34
Introduction to Micro Controllers & Embedded System Design • Subtraction can be done by means of complement operation: A – B = A + (complement of B) A. R. Hurson 35
Introduction to Micro Controllers & Embedded System Design A • 1 1 0 Carry out A. R. Hurson + 0 0 1 0 Sum 0 0 0 1 36
Introduction to Micro Controllers & Embedded System Design A • 1 1 0 A. R. Hurson + 0 0 1 Sum 1 1 1 37
Introduction to Micro Controllers & Embedded System Design • As noted before, in general subtraction can be done using 2 s or 1 s complement addition. • Example: - 1 1 0 • 1 1 0 0 1 1 0 A. R. Hurson 1 1 0 + 1 0 0 1 1 0 Result 0 1 1 1 0 0 38
Introduction to Micro Controllers & Embedded System Design • Addition of hexadecimal numbers • Example: perform the following operation Carries 0 1 1 A B C D + 0 3 4 5 Result A E 1 2 A. R. Hurson 39
Introduction to Micro Controllers & Embedded System Design • Subtraction of hexadecimal numbers • Similarly subtraction can be done using 16 s and 15 s complement addition. • Example: perform the following operation A B C D - Carries 1 1 1 A B C D + F C B B Result A 8 8 8 0 3 4 5 A. R. Hurson 1 40
Introduction to Micro Controllers & Embedded System Design • Basic Logic • AND gate A B 0 0 1 1 1 A. R. Hurson A B 41
Introduction to Micro Controllers & Embedded System Design • Basic Logic • OR gate A B 0 0 1 1 1 0 1 1 A. R. Hurson A B 42
Introduction to Micro Controllers & Embedded System Design • Basic Logic • NOT gate A A 0 1 A 1 0 A. R. Hurson 43
Introduction to Micro Controllers & Embedded System Design • Basic Logic • NAND gate A B 0 0 1 1 1 0 A. R. Hurson A B 44
Introduction to Micro Controllers & Embedded System Design • Basic Logic • NOR gate A B 0 0 1 0 1 0 0 1 1 0 A. R. Hurson A B 45
Introduction to Micro Controllers & Embedded System Design • Basic Logic • EXOR gate A B 0 0 1 1 1 0 A. R. Hurson A B 46
Introduction to Micro Controllers & Embedded System Design • Basic Logic • EXNOR gate A B 0 0 1 0 1 0 0 1 1 1 A. R. Hurson A B 47
Introduction to Micro Controllers & Embedded System Design • Note: • The NAND and NOR are called universal functions since with either one we can generate AND, OR, and NOT gates A. R. Hurson 48
Introduction to Micro Controllers & Embedded System Design • Basic Logic A. R. Hurson 49
Introduction to Micro Controllers & Embedded System Design • Half adder • Is a logic circuit with two inputs and two outputs generating Sum and Carry A B Sum Carry 0 0 0 1 1 0 1 0 1 A. R. Hurson 50
Introduction to Micro Controllers & Embedded System Design • Full adder • Is a logic circuit with three inputs and two outputs generating Sum and Carry (a cascade of two half adders) a b cin Sum Carry 0 0 0 0 1 1 0 0 1 0 1 1 1 0 0 1 1 1 A. R. Hurson Sum 51
Introduction to Micro Controllers & Embedded System Design • Questions: • Decoder • Encoder • Flip-flops A. R. Hurson 52
Introduction to Micro Controllers & Embedded System Design • Summary • Computer: A device capable of solving problems (data manipulation) by accepting data, performing prescribed operations on the data, and supplying the results. • Microprocessor: a computer that is contained in a single integrated circuit (all peripherals are off the CPU chip). • Microcontroller: A microprocessor with a number of integrated peripherals, typically used in control-oriented applications (everything is on one chip). Central processing unit: The component of a computer system with the capability to control the interpretation and execution of the instructions. The CPU includes the arithmetic-logic unit and the control unit. • A. R. Hurson 53
Introduction to Micro Controllers & Embedded System Design • Summery • Primary Memory: Also called Main memory. It is a volatile/nonvolatile memory that holds the program and intermediate data during the course of a program execution. • Secondary Memory: A nonvolatile memory that is used to hold the program and data between the runs. A. R. Hurson 54
Introduction to Micro Controllers & Embedded System Design • Summery • Assembly Language: machine language. A symbolic representation of • Assembler: A compiler that translates assembly language to machine language. • Translation: To change information from one form of representation to another without changing the meaning. • operation: A basic operation that is executed during a clock cycle. A. R. Hurson 55
Introduction to Micro Controllers & Embedded System Design • Summery • Transmission: The act of sending information from one location and the receiving of the same information in another location. • Logic Transfer Level: A method in which a computer is studied based on its functionality. • Register Transfer Language: A tool which allows to represent, study, and analyze a computer at the Logic Transfer Level. A. R. Hurson 56
Introduction to Micro Controllers & Embedded System Design • Questions • • Why are we interested in computer? • What is the difference between assembly instruction and machine instruction? • What is the difference between the assembly instruction and the micro instruction? what is the distinction between program and data? What is a machine dependent language? What is the difference between machine dependent and machine independent languages? A. R. Hurson 57
Introduction to Micro Controllers & Embedded System Design • Questions • Define the term “Little Endian”. • Define the term “Big Endian”. • Define the term “Instruction Format”. A. R. Hurson 58
- Slides: 58