Introduction to Microcontrollers Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff 1 Microcontrollers • Single-chip computer, with memory and I/O – Used for embedded systems • Embedded means – Designed for a specific task – May need to control hardware in real-time – Often is built into the device it is controlling – May have little or no user interface The average person interacts with 150 microcontrollers per day! Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff 2 A “short list” of embedded systems Anti-lock brakes Auto-focus cameras Automatic teller machines Automatic toll systems Automatic transmission Avionic systems Battery chargers Camcorders Cell phones Cell-phone base stations Cordless phones Cruise control Curbside check-in systems Digital cameras Disk drives Electronic card readers Electronic instruments Electronic toys/games Factory control Fax machines Fingerprint identifiers Home security systems Life-support systems Medical testing systems Modems MPEG decoders Network cards Network switches/routers On-board navigation Pagers Photocopiers Point-of-sale systems Portable video games Printers Satellite phones Scanners Smart ovens/dishwashers Speech recognizers Stereo systems Teleconferencing systems Televisions Temperature controllers Theft tracking systems TV set-top boxes VCR’s, DVD players Video game consoles Video phones Washers and dryers And the list goes on and on Microcomputer Architecture and Interfacing Colorado School of Mines From: Embedded System Design: A Unified Hardware/Software Introduction, by Vahid and Givargis, Wiley 2002. Professor William Hoff 3 An embedded system example -- a digital camera Digital camera chip CCD CCD preprocessor Pixel coprocessor D2A A2D lens JPEG codec Microcontroller Multiplier/Accum DMA controller Memory controller • • • Display ctrl ISA bus interface UART Single-functioned -- always a digital camera Tightly-constrained -- Low cost, low power, small, fast Reactive and real-time -- only to a small extent Microcomputer Architecture and Interfacing Colorado School of Mines LCD ctrl From: Embedded System Design: A Unified Hardware/Software Introduction, by Vahid and Givargis, Wiley 2002. Professor William Hoff 4 Microcontroller vs Microprocessor Evolution • Moore’s Law - # transistors / chip doubles every 1.5 to 2 years • Trends in general purpose microprocessors • • • Larger data word sizes Parallelism – pipelining, multiple processor cores Larger arithmetic logic units with floating point capability • Trends in microcontrollers • More built-in capability : – – – • More I/O ports Communications interfaces such as USB and CAN-bus More timer functions The idea is to decrease the number of chips needed to implement an embedded system Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff 5 HCS12 Microcontroller • Serial communications • Pulse-width modulation outputs • A/D, D/A • Timers • Pulse counters • CAN bus, IIC bus Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff Embedded System Design • Functionality may be implemented in hardware (circuit), or software (microcontroller), or both ... which to use? – Example: a multiply-accumulate circuit • Tradeoffs and metrics – Unit cost • The monetary cost of manufacturing each copy of the system – NRE cost (Non-Recurring Engineering cost) • The one-time monetary cost of designing the system – Performance • The execution time or throughput of the system – Size, power – Flexibility • The ability to change the functionality of the system without incurring heavy NRE cost Others? Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff 7 Summary • A microcontroller is a single chip computer, used in embedded systems • It includes hardware elements to make it easy to interface to devices • Microcontrollers are very common and are used in many products • They are a good design alternative to implementing functionality in in hardware (i.e., a circuit) Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff 8