2Introduction to Microcontrollers Parts of computer: CPU, memory, I/OCPU: Control and data pathMemory: Stores instruction and dataInput/output: Interact with the outside of computers
3Why Study Microprocessor Design? Examples of why you want low-power solutions.Here are two wristwatches, one from IBM which runs Linux and one from Samsung which is the world’s smallest cellphone. It is voice-controlled and also works as a watch!Here are two prototype devices for helping blind people to see. The upper one is a system which converts visual data into sounds. The special glasses contain a miniature camera and the computer in the backpack convert the visual images into a sound picture which enable the wearer to see in a very useful way. In this example, the lady is able to pinpoint the location of her stick and pick it up purely by interpreting the sound signals she receives.Below is a more sophisticated and altogether more scary system. This one also builds a camera into a special pair of glasses but them feeds the signals directly into an implant in the visual cortex in the brain. I didn’t include the pictures of that bit because they made me a bit queasy!Finally, a research project which is currently going on at MIT in the States to build a complete wearable computing platform, complete with wireless connections, optical sensors and displays and so on. It doesn’t look up to much and you wouldn’t win any fashion awards in it but they do say that it looks very nice when built into a smart blue shirt.
4Why Study Microprocessor Design? Sony Playstation 2000(as reported in Microprocessor Report, Vol 13, No. 5)Emotion Engine: 6.2 GFLOPS, 75 million polygons per secondGraphics Synthesizer: 2.4 Billion pixels per secondClaim: Toy Story realism brought to games!
5Why Study Microprocessor Design? Wireless Sensor Networks PlatformPower Metering Application
6Microcontrollers vs Microprocessors A microprocessor is a CPU on a single chip.If a microprocessor, its associated support circuitry, memory and peripheral I/O components are implemented on a single chip, it is a microcontroller.
7What is an Embedded System? A combination of computer hardware and software, and perhaps additional mechanical or other parts, designed to perform a dedicated function.In some cases, embedded systems are part of a larger system or product, as is the case of an anti-lock braking system in a car. Contrast with general-purpose computer.Examples range from washing machines, cellular phones to missiles and space shuttles.
8Microcontroller (MCU) Embedded SystemsOperations managed behind the scenes by a microcontrollerMicrocontroller (MCU)An integrated electronic computing device that includes three major components on a single chipMicroprocessor (MPU)MemoryI/O (Input/Output) ports
9What is an Embedded System? Electronic devices that incorporate a computer (usually a microprocessor) within their implementation.A computer is used in such devices primarily as a means to simplify the system design and to provide flexibility.Often the user of the device is not even aware that a computer is present.
11Where are the embedded devices? Mention the ubiquity of handheld devices and things that run on one battery
12Instrumentations: Data collection, oscilloscopes, signal generators, signal analyzers, power supplies.Industrial: Elevator controls, surveillance systems, robots.Home: Dishwashers, microwave ovens, VCRs, televisions, stereos, fire/security alarm systems, lawn sprinkler controls, thermostats, cameras, clock radios, answering machines.Printers, scanners, keyboards, displays, modems, hard disk drives, CD-ROM drives.
13Embedded Rocks!Embedded processors account for 100% of worldwide microprocessor production!Embedded:desktop = 100:1
14Embedded Systems is a big, fast growing industry $ 40 billions in 2000 $92.0 billion in 2008 $112.5 billion (estimated) by the end of 2013Embedded hardware was worth $89.8 billion in 2008 and is expected to reach $109.6 billion in 2013Embedded software generated $2.2 billion in This should increase to $2.9 billion in 2013Microprocessors/Microcontrollers are the core of embedded systems.
16Computer Technology Dramatic Change Processor2X in speed every 1.5 years; 100X performance in last decadeMemoryDRAM capacity: 2X / 2 years; 64X size in last decadeCost per bit: improves about 25% per yearDiskcapacity: > 2X in size every 1.0 yearsCost per bit: improves about 100% per year250X size in last decade
19Microcontroller Components – Memory Each memory location has a specific addressWe must supply an address to access the corresponding locationR/W allows us to select reading or writingVarious types of memory for different functions and speedsMemory location 0Memory location 1addressdataMemory location n-2Memory location n-1r/w
20Microcontroller Components – Memory Read Only Memory - Memory that can only be readHolds the program code for a microprocessor used in an embedded system where the code is always the same and is executed every time the system is switched onComputer BIOS, boot-up informationOther types of Read Only MemoryErasable Programmable Read Only Memory (EPROM) – Similar to ROM but can be erased (exposure to ultraviolet light) and reprogrammedElectrically Erasable Programmable Read Only Memory (EEPROM) – more common that EPROM because it can be erased by the microprocessorFlash Memory, Ferroelectric RAM (FRAM), Magnetic Random Access Memory (MRAM)
21Microcontroller Components – Memory Random Access Memory – used to store dynamic data when processor is runningHolds program code and data during executionCan be accesses in any random order – unlike takes or disksSome types of RAMStatic RAM (SRAM) – Uses transistors to store bits, fast SRAM is used for cacheDynamic RAM (DRAM) – Uses capacitors to store bits, must be refreshed, smaller and cheaper than SRAMFast Page Mode (FPM), Extended Data Out (EDO)Synchrounous DRAM (SDRAM) – introduced in 1997 and replaced most DRAM in computers by 2000Double Data Rate (DDR SDRAM) – uses both clock edges found today in most computersDirect Rambus DRAM (RDRAM) – somewhat of a flop
22Microcontroller Components – CPU Smart partProcesses instructions and dataAll the parts of a microprocessorRegisters – fast memory used to store operands and other informationCondition register – positive/negative resultException register – overflow conditionLoop count registerLoad-store architectureRegister 0dataaddressRegister 1r/wRegister n-1instALUCPU
23Microcontroller Components – I/O Connection to the outside worldExamplesAnalog to Digital ConverterTemperature SensorDisplayCommunications Circuit
24Microcontroller Components – BUS Group of wires used to transport informationCPU to MemoryAddress busData busCPU to I/OPort mapped I/O – used when address space is limited, special instructions are needed for I/OMemory mapped I/O – I/O looks like memory locations, easier to use and common in Reduced Instruction Set Computing (RISC)
25MPU-Based Systems System hardware System software Discrete components Microprocessor, Memory, and I/OComponents connected by busesAddress, Data, and ControlSystem softwareA group of programs that monitors the functions of the entire system
27MCU-Based SystemsIncludes microprocessor, memory, I/O ports, and support devices (such as timers) on a single semiconductor chipBuses are generally not available to a system designerI/O ports are generally multiplexed and can be programmed to perform different functions
29Read -- Computer Architectures Princeton versus Harvard ArchitectureCISC versus RISC processorsMicroprocessors and MicrocontrollersELEC 330
30Processor Performance CPU Time= # Cycles × Cycle Time= # Instructions × CPI × Cycle TimeCPI: Cycles per instruction
31Embedded System Programming Key factors in embedded programmingSpeed – timing constraints, limited processing powerCode size – limited memory, powerProgramming methodsMachine Code – bitsLow level language – assemblyHigh level language – C, C++, JavaApplication level language – Visual Basic, AccessLevels of abstraction – factor out details to focus on few concepts at a time
32Embedded System Programming Why use C in embedded programming?Ease of management of large embedded projectsProvides an additional level above assembly programmingFairly efficientSupports access to I/OWhy use assembly?High speed, low code sizeHowever, difficult to do a large project in assembly