CE 478 Microcontroller Systems Spring 2011 Prof. Dan Ernst http://www.cs.uwec.edu/~ernstdj/courses/ce478 CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Welcome • Class overview – – – – Policies etc. What are embedded systems? Why are they interesting? Why are they needed? • Note: There is no required textbook for this class! Office hours: Wednesday: 9 – 11 am Friday: 1 – 3 pm or by appointment CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Labs and Equipment • Fridays are Lab days in P 122. (not 171!) – There may be some exceptions (watch your e-mail!) • In labs you will sometimes be in groups of 2 • Equipment needs to stay in the lab area. CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Grading* Item ====== Labs/Homeworks Exams (2) Project Quizzes CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Weight ========= 30% 30% (15% midterm; 15% final) 30% 10% Dan Ernst Final Project • Final Project will involve constructing a “polished” digital system – Implement the hardware and software involved in your design – Ideas and examples of projects are/will be posted on the class website • Project will involve multiple phases – Proposal – Implementation – Presentation/Documentation CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst What we will cover* • • • • • • • • • PowerPC architecture and assembly language Bus protocols and interfacing – Including P6, PPC, and maybe others Digital design review Common I/O devices – Timers, A/D converters, serial I/O, etc. Interrupts – I/O devices demanding attention Direct Memory Access (DMA): – I/O devices talk directly to memory Memory technologies: SRAM, DRAM, Flash etc Analog to digital and back again. Error correction and other “special” topics. CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Administrivia P122 access: You’re welcome to work in P122 on 478-related projects anytime, except Weds. 2 – 4 pm and Tues. 3:30 – 5:30 pm ( CS 278 lab) If you can avoid it, don’t leave the boards out – there will be plenty of cabinet space, and other classes (CS 278) need to use the space. You will receive a key to the cabinets on the first lab day. Please don’t distribute the access code, or let in extra people! http://www.cs.uwec.edu/comdistro CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst General Purpose Computers • Microcomputers are computers based on microprocessors – General purpose microcomputers • PC’s, Macs, etc. – Generally require a large amount of support circuitry • Memory, communications, I/O, keyboard,display... CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Inside a General Purpose Computer Address Bus Data Bus Control Bus CPU PCI Bus Bridge ROM RAM Clock, Reset circuitry PCI Bus Disk Controller Video Memory Parallel Interface Serial Interface Real-time Clock Keyboard/ Mouse Controller ... Disk Interface Video Display Controller CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Does One Size Fit All? • Advantages of a general-purpose computer – Flexible - can run lots of programs and interface with lots of devices – Expandable - can be updated with new hardware – Cost-effective - the cost of adding a new program is small – Economy of scale - millions are being produced… • Disadvantages – Must be a “super” system, capable of running any program – High price – Relatively large, short battery life CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Embedded Systems • Embedded Systems are small, special-purpose computer systems • • • • Rocket guidance systems Toaster control systems Handheld electronics Toys – Only the necessary parts are included • Cheaper, smaller – Simpler --> more reliable? CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Needs of Typical Embedded Systems • Consider the following embedded systems: – – – – Programmable thermostat Blood Glucose Meter iPod Touch™ Automobile System Controller • Single-purpose • Small • Inexpensive • Reduced computation needs (most of the time) • Special interfaces • Lightweight (often hand held) CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst So… • You don't need a traditional user interface to decide which programs should be running • You don't need to dynamically load programs into your devices • You don't need to waste time waiting for the O/S to load – if one is needed, then it doesn't have baggage that make it slow to load • You don't need to load programs or data from a slow disk drive - most information needed will be in fast ROM CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Why PCs Aren’t Practical for Everything • What does it take to build a blood glucose meter using a typical PC microprocessor? • 1 Intel/AMD/other CPU • Dynamic RAM, controller • ROM (one or two chips) for program • Real-time clock • LCD panel • Serial interface ports, drivers • A/D Converter • Random support chips (five or six chips) • This is going to take around 5+ chips, use > 100 W, and cost > $400. CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst ASICs: The Other End of the Spectrum • Since consumer electronics are made to do one thing, we should just be able to hardwire a solution! • Construct an ASIC (Application-Specific Integrated Circuit) – Custom chip that does a single thing, but does it VERY well! – Very little need for software support • Downside: making a custom mask will cost you a fortune – Lots of engineering design time – At least $10,000 up front to make a mask – $$$ to reserve time in the fab (or build your own fab) CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst FPGA – a middle solution? • Could use an Field-Programmable Gate Array (FPGA) – (a la 278) • Advantages: – Programmable – Much cheaper than ASICs • (at least in small quantities) • Disadvantages: – Not as intuitive as software – Still not super-cheap – Take up a lot of space/power relative to the capability they bring CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst The Spectrum of Hardware/Software Solutions CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Why Consumer Electronics make Money • A Microcontroller is a small CPU with support devices built into the chip – Small CPU – Small ROM – RAM, EEPROM – Parallel ports – RS232 ports – A/D Converter – Timer • Typically, a microcontroller uses little power and costs $0.50 to $100.00 CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst A Generic Microcontroller Flash EEROM 2KB – 256KB Timer 16-32 Bit RAM 256B – 64KB Small CPU Core 8-32 Bits 2-40 MHz RS232/ USB I2C/SPI CS 478: Microcontroller Systems University of Wisconsin-Eau Claire ADC 8-14 Bits GPIO Memory Bus 16-24 Bits Dan Ernst Embedded Systems Definition: • Dedicated to controlling a specific real-time device or function • Self-starting, not requiring human intervention to begin. The user cannot tell if the system is controlled by a microprocessor or by dedicated hardware (or magic!) • Self-contained, with the operating program in some kind of non-volatile memory CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst How are things controlled? • • • • Switches – Switches can be used to switch things on or off e.g. lights can be on or off – They can also be used to switch between values e.g a heater can be set to a number of values Sensors – Sensors can tell if something is on or off – Sensors can tell you the value of something e.g. temperature Timers – Timers can control the duration of other activities, such as how long a light is on, or the time between ADC samples Analog controllers – Things such as voltage can be set for analog devices such as motors CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst What we will cover* • • • • • • • • • PowerPC architecture and assembly language Bus protocols and interfacing – Including P6, PPC, and maybe others Digital design review Common I/O devices – Timers, A/D converters, serial I/O, etc. Interrupts – I/O devices demanding attention Direct Memory Access (DMA): – I/O devices talk directly to memory Memory technologies: SRAM, DRAM, Flash, etc. Analog to digital and back again. Error correction or other “special” topics CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst