Presentation on theme: "Dr. Izzeldin Ibrahim Mohamed"— Presentation transcript:
1 Dr. Izzeldin Ibrahim Mohamed SEE 3223: MicroprocessorsDr. Izzeldin Ibrahim MohamedP08-117/ VeCAD LABExt.: 36117, HP:Department of Microelectronics and Computer Engineering (MiCE)Faculty of Electrical EngineeringUniversiti Teknologi MalaysiaConsultation:Tuesday 11:00 – 12:55 a.m.Thursday 11:00 – 12:55 a.m.
3 Microprocessor SEE3223 Aim Learning Outcomes This subject introduces the principle and the usage of microprocessor. Few topics that are emphasized are processor architecture, assembly language and basic interfacing in a microprocessor-based systems.Learning OutcomesAt the end of this course, students will be able to :Describe and differentiate all the component of microprocessor- based systems.Analyze and design AVR Atmega32 assembly language programs.Analyze and design AVR Atmega32 microprocessor systems.Work with AVR Studio and communicate effectively in a team to solve complex AVR Atmega32 design problems.
4 SEE3223 Microprocessor Systems What’s in this course:Assembly language programmingMicroprocessor conceptsHardware interfacingPre-RequisitesNumber representation, coding, registers, state machinesRealization of simple logic circuitsIntegrated circuit technologiesDesigning with MSI componentsFlip-FlopsCounters and sequential MSI componentsRegister transfer logic
5 Course Policy Punctuality is expected. Attendance is compulsory. You are responsible for whatever is taught in the lecture. If you miss a class, it is your responsibility to find out about assignment, quizzes and exam from elearning.Punctuality is expected.Makeup quizzes will not be given except in the case of actual emergencies with written evidence.You are encouraged to collaborate (not copy) on assignment problems with your "study buddies.”
6 Grading Policy Assessment Breakdown: 4 Quizzes x 10% = 30% 1 Group Assignment = 20%Final = 50%
7 Material Will be posted Lecture notesWill be postedTextbooksMuhammad Ali Mazidi and, Sarmad Naimi and Sepehr Naimi (2010), The AVR Microcontroller and Embedded Systems: Using Assembly and C, 1st Ed., Prentice Hall.
8 Microprocessor-Based Systems Module 1Objektif:Komponen-komponen komputerKitar SuruhanJenis-jenis komputerEvolusi mikropemprosesPengenalan mikropemproses 68000Microprocessor-Based Systems
9 Microprocessor-Based Systems AimsTo review the main elements of a microprocessor system.Intended Learning OutcomesAt the end of this module, students should be able to:Define and explain important terms associated with both hardware and software elements of a microprocessor systemTell the difference between general purpose computing and embedded computingList down the major components inside a computer & processorTell the difference between computer, processor, microprocessor and microcontrollerExplain instruction execution cycles of a generic microprocessor
10 What is Computer ?Data ProcessingComputerData Storage
11 Basic Functions of Computer Data ProcessingData StorageData MovementControl
12 Microprocessor-Based Systems Whenever the word microprocessor is mentioned, it conjures up a picture of a desktop or laptop PC running an application such as a word processor or a spreadsheet.While this is a popular application for microprocessors, it is not the only one and the fact is most people use them indirectly in common objects and appliances without realizing it. Without the microprocessor, these products would not be as sophisticated or cheap as they are today.I
13 Microprocessor-Based Systems Computing systems are everywhere. Its probably no surprise that millions of computing systems are built every year destined for desktop computers (Personal Computers, or PCs), workstations, mainframes and servers. What may be surprising is that billions of computing systems are built every year for a very different purpose: they are embedded within larger electronic devices, repeatedly carrying out a particular function, often going completely unrecognized by the devices user. Creating a precise definition of such embedded computing systems, or simply embedded systems, is not an easy task.I
14 Computer Classifications Classification of computers:Servers:Big, expensive, available 24x7 (read “24 by 7” or 24 hours a day, 7 days a week. Mainframes are old servers made by IBM.Desktops:computers on your deskLaptops:computers you carry in your bagPDA (personal digital assistants):computers you carry in your pocketEmbedded systems:computers that don’t look like computers!An embedded system is a type of computer
15 What is an Embedded System? An embedded system is a microprocessor-based system that is built to control a function or range of functions and is not designed to be programmed by the end user in the same way that a PC is.An embedded system is a special-purpose computer system designed to perform certain dedicated functions. It is usually embedded as part of a complete device including hardware and mechanical partsI
16 Embedded System: Example Embedded microprocessors are more deeply ingrained into everyday life than any other electronic circuit that is made. A car may have over 50 microprocessors controlling functions such as the engine through engine management systems, brakes with electronic anti-lock brakes, transmission with traction control and electronically controlled gearboxes, safety with airbag systems, electric windows, air-conditioning and so on.I
17 Other Processors in Embedded Systems Embedded Controllers:More powerful (32 bits) than microcontrollers (8 bits)Normally contains only processor and input/output, memory is externalDigital Signal Processors:Embedded processors optimized for digital signal processingCommonly found in hand-phones, modems, communications systemsGraphics Processors:Very powerful processors found in graphics cards of workstationsProgrammable Logic Controllers:Microprocessor boards usually found in industrial applicationsAdvantages of Microcontrollers:Pin count downDesign time down, Board layout size downUpgrade path easier – matching between peripheralsCost down – bulk purchasesReliability upCommon software / hardware design available from manufacturer
18 General Purpose Computing vs Embedded Systems Intended to run a fully general set of applicationsRuns a few applications often known at design timeEnd-user programmableNot end-user programmableFaster is always betterOperates in fixed run-time constraints, additional performance may not be useful/valuableDifferentiating features:Speed (need not be fully predictable)Software compatibilityCost (eg RM3k vs RM5k per laptop)PowerCost (eg RM2 vs RM2.50)SizeSpeed (must be predictable)
19 To design a µP System, we must know… Fundamentals:What’s inside a computerWhat’s inside a processorProgramming:What happens in the processor when it’s running a programWhat do we need to write a programHow to create a programHow to run a programHow to fix a program errorHardware design:Timing diagramsInterfacing with other chips
21 A Computer System – Simplified View Stores and retrieves dataMoves data between the computerand its external environmentCPUMemoryInput/OutputProcessor:The brain of the computerAs known as the CPU (central processor unit)MemoryStores informationInput/Output Devices:Gets information in & out of the computerBuses:Links all componentsControls the operation of the computerPerforms its data processing functionsAddress busProvides communicationamong CPU, main memory and I/OData busControl busAn embedded system also has the same structure but at a smaller size
22 What is Microprocessor ? Central Processing Unit (CPU): Control the operation of the computer and performs its data processing functions; often simply referred to as PROCESSPRCPU
23 Processor or Central Processing Unit (CPU) The Processor consists of …Registers:Small high speed memory to store the currently needed dataALU (Arithmetic & Logic Unit)Manipulate information using arithmetic and logic operationsControl Unit:Control the operation of the processor
24 Processor (CPU): Control Unit (CU) The Central Processing Unit (or P)To synchronize and control the overall operation of the P systemTo decode instruction and pass the necessary control signals to CUControl Unit & Instruction DecoderTo perform the arithmetic and logical operations within the CPUArithmetic/Logic UnitA set of internal storagelocations within the CPURegisters
26 Microprocessor – Basic concept CPU16-bit / 32-bit / 64-bit wideAddress busbidirectional 8-bit / 16-bit / 32-bit / 128-bitData busTiming signals, ready signals, interrupts etcControl busMicroprocessor, by-itself, completely useless – must have external peripherals toInteract with outside world
27 Microprocessor – Basic concept CPUAddressControlBoot ROMUsed at startupInstruction (program) ROMDataRAMTrans-ducersKeyboard Screen UART Parallel interfaceetcDataMicroprocessor, by-itself, completely useless – must have external peripherals toInteract with outside world
28 Number of addresses 2N (where N is an integer) MemoryMemory Address-1 Memory Address-2 Memory Location-nMemory Address-n Memory Location-1Memory Location-2567812341 byte = 8-bit data1 word= 2 bytes1 double = 2 wordsNumber of addresses 2N (where N is an integer)
29 Memory Devices Read-Only Memory Random Access Memory Non-volatile memory: contents is retained even without powerIn embedded systems, used to store application programs and test routinesContents can be set by fixing it during manufacturing or “burning” it using a programming deviceCommon types include MROM, PROM, EPROM and flash memoryErasable types can only be rewritten a fixed number of timesRandom Access MemoryContents lost without power (volatile memory)Used to store temporary data. In embedded system, very little RAM is required. Some systems don’t even have RAM at all!No limit to number of writes the device can handleFast writes (unlike EPROM/EEPROM)Two major types are SRAM and DRAMDaftar Istilah:BM BIMeruap volatileTak meruap non-volatileIngatan capaian rawak random access memory (RAM)Ingatan baca sahaja read-only memory (ROM)MROM masked ROMPROM programmable ROMEPROM erasable programmable ROMEEPROM electrically-erasable programmable ROMOTPROM one-time programmable ROMNOVRAM non-volatile RAM
30 Data & Address BusesSmallest transferable amount of data from memory to CPU (and vice versa) is one byte.Each byte has a unique location or address.The address of each byte is written in hexadecimal (hex). For AVR, the prefix ‘0x’ means a hex value.The range of addresses accessible by the processor is the memory space. (Limited by the size of the address bus).The Atmega32 (and many other AVR models) does not have direct support for an external memory interface.24-bit address bus16-bit data busData bus 16 bitsCPUMemory15224-1=8M locationsAddress bus 24 bits0x0000000xFFFFFF
32 Microcontroller – Basic concept CPUAddressControlBootROMProgramROMDataRAMTrans-ducersSome I/ODataMicrocontroller - put a limited amount of most commonly used resources inside one chip
33 Microprocessor vs Microcontroller A chip that contains only the processorNeed other chips to make a working systemMore flexibleCan have very few I/O or many I/O devices using the same processor chipMicrocontroller:A chip that contains all the components of a computer – processor, memory and input/outputLess flexibilityLess component count in systemLess powerfulAdvantages of Microcontrollers:Pin count downDesign time down, Board layout size downUpgrade path easier – matching between peripheralsCost down – bulk purchasesReliability upCommon software / hardware design available from manufacturerNo matter what is the system size, the most important component is still the processor.
34 Software Computer software Program: Instruction: Computer programs are known as softwareProgram:Sequence of instructions that perform a taskInstruction:The simplest operation performed by the processorThink of it as a note coming from a musical instrumentHow the computer works:Fetch an instruction from memoryDecode the instructionExecute the instructionRepeatProgramming is like choosing the correct note coming from the a musical instrument to make beautiful musicDaftar Istilah:BM BISuruhan instructionAturcara programPerkakasn hardwarePerisian software
35 Machine & Assembly Language Machine instructionA sequence of binary digits which can be executed by the processor, e.gHard to understand for human beingAssembly languageAn assembly program consists of assembly instructionsAn assembly instruction is a mnemonic representation of a machine instruction e.g. MUL may stand for “multiply”Assembly programs must be translated into object code before it can be executed -- translated by an assembler.Assemblers can be of two types: cross assembler and native assembler.Cross assembler runs on one computer and generates machine instructions that will be executed by another computer that has different instruction set, e.g. freeware ASM68K.Native assembler runs and generates instructions for the same computer.Drawbacks of assembly programs are:dependent on hardware organization, difficult to understand long programs, low programmer productivity
36 High-level language (HLL) Syntax of a high-level language is similar to EnglishA translator is required to translate the program written in a high-level language into object code -- done by a compiler.There are cross compilers that run on one computer but translate programs into machine instructions to be executed on a computer with a different instruction set.Main drawback is slower execution speed of the machine code obtained after compiling an HLL program.However, C language has been extensively used in microcontroller programming in industry.
37 Instruction Cycle (Fetch-Execute) The processor executes instructions one-by-one according to the sequence found in memoryEverything is controlled by, what else, the control unit in the CPU.To execute an instruction, the processor must fetch it from memory.The complete steps the processor takes to execute one instruction is the instruction cycle or the fetch-execute cycleKenapakah langkah 0 hanya dilakukan sekali sahaja?FetchExecute
38 Instruction Cycle Details On program start:0. Load the program counter (PC) with the address of the first instructionFetch phase:1. Read the instruction and put it into the instruction register (IR)2. Control unit decodes the instruction; updates the PC for the next instructionExecute phase:3. Find the data required by the instruction.4. Perform the required operation.5. Store the results.6. Repeat from Step 1.What’s a PC?A register that contains the address of the NEXT instruction.What’s an IR?An internal register that’s invisible to the programmer.Why repeat from Step 1?Step 0 is required only once; to locate the address of the first instruction.Address of subsequent instructions are based on the address of the current instruction
40 CPU How computers work Address bus Data bus Control bus A ALU B PC: C B AA AA+BA123456731hC4h26h81hEAh0h5hCPULogic circuitAddress busData busControl busWriteReadALUBADCregistersPC:1I/O 16I/O 17I/O 18I/O nInst. Dec.
41 CPU How computers work SEE3223 Mikropemproses 17 Address bus Data bus B AA AA+BA123456731hC4h26h81hEAh0h5hCPU17Logic circuitAddress busData busControl busWriteReadALUBADCregistersPC:19I/O 16I/O 17I/O 18I/O nInst. Dec.31Pengenalan
42 CPU How computers work 17 Address bus Data bus Control bus A ALU B PC: C4h26h81hEAh0h5hA B AA AA+BA1234567C4265CPU176Logic circuitAddress busData busControl busWriteRead99ALUBADCregistersPC:32121I/O 16I/O 17I/O 18I/O nInst. Dec.
43 CPU How computers work Address bus Data bus Control bus ALU B A D C 123456731hC4h26h81hEAh0h5hA B AA AA+BA81EACPU7Logic circuitAddress busEhData busControl busWriteRead5E5ALUBADCregisters+E99PC:54343I/O 16I/O 17I/O 18I/O nInst. Dec.
47 Selecting a Microprocessor Choose the right one for your applicationPrimary criteria: Cost, Power, Size, SpeedOthers: package options, integrated peripherals, potential for future growthChoose one with good software development supportdevelopment environment - good compiler and debugger availabilityevaluation boardsin-circuit emulators for those with deep pocketsOperating system availabilityOther considerationsCode density: affects power consumption, performance and system costHardware availability: make sure you can actually purchase the microcontroller before designing it inPrior expertise, licensing, etc
48 SummaryMicroprocessors and embedded controllers are a ubiquitous part of life todayConcept of a microprocessor & microcontrollerUnderstand how a µP worksHeadhunters report that EEs familiar with µC, µP design are in the highest possible demandWeb Resources:How Microprocessors Work:Great Microprocessors of the Past and Present:Great Moments in Microprocessor History: