CE 478 Microcontroller Systems

23
CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst CE 478 Microcontroller Systems http://www.cs.uwec.edu/~ernstdj/ courses/ce478 Prof. Dan Ernst Spring 2011

description

CE 478 Microcontroller Systems. Spring 2011. Prof. Dan Ernst. http://www.cs.uwec.edu/~ernstdj/courses/ce478. 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: - PowerPoint PPT Presentation

Transcript of CE 478 Microcontroller Systems

Page 1: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

CE 478Microcontroller Systems

http://www.cs.uwec.edu/~ernstdj/courses/ce478

Prof. Dan Ernst

Spring 2011

Page 2: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity 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 amFriday: 1 – 3 pmor by appointment

Page 3: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Labs and EquipmentLabs 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.

Page 4: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Grading*Grading*

Item Weight ====== =========Labs/Homeworks 30%Exams (2) 30% (15% midterm; 15% final)Project 30%Quizzes 10%

Page 5: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Final ProjectFinal 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

Page 6: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

What we will cover*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.

Page 7: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

AdministriviaAdministriviaP122 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

Page 8: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Page 9: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

General Purpose ComputersGeneral 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...

Page 10: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Inside a General Purpose ComputerInside a General Purpose Computer

CPU RAM ROMPCIBusBridge

Address Bus

Data Bus

PCI Bus

Clock,Resetcircuitry

Control Bus

Real-timeClock

DiskController

DiskInterface

VideoMemory

VideoDisplayController

Serial Interface

ParallelInterface

...

Keyboard/MouseController

Page 11: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Does One Size Fit All?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

Page 12: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Embedded SystemsEmbedded 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?

Page 13: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Needs of Typical Embedded SystemsNeeds 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)

Page 14: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

So…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

Page 15: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Why PCs Aren’t Practical for EverythingWhy 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.

Page 16: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

ASICs: The Other End of the Spectrum 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)

Page 17: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

FPGA – a middle solution?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

Page 18: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

The Spectrum of Hardware/Software SolutionsThe Spectrum of Hardware/Software Solutions

Page 19: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Why Consumer Electronics make MoneyWhy 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

Page 20: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

A Generic MicrocontrollerA Generic Microcontroller

Small CPU Core8-32 Bits2-40 MHz

FlashEEROM

2KB – 256KB

RAM256B – 64KB

GPIO

ADC8-14 Bits

Timer16-32 Bit

RS232/USB

I2C/SPIMemory Bus

16-24 Bits

Page 21: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

Embedded SystemsEmbedded SystemsDefinition:

• 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

Page 22: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

How are things controlled?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

Page 23: CE 478 Microcontroller Systems

CS 478: Microcontroller SystemsUniversity of Wisconsin-Eau Claire Dan Ernst

What we will cover*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