This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: UC Berkeley, EECS Department B. E. Boser EECS 40 Lab LAB6: Microcontroller Input/Output UID: Enter the names and SIDs for you and your lab partner into the boxes below. Name 1 SID 1 Name 2 SID 2 Be sure to come very well prepared to this laboratory to complete in three hours (or finish the following week). Type in your code ahead of time (store on the server or a USB key). Microcontrollers Microcontrollers are very much slimmed down computers. No disks, no virtual memory, no operating system. Think of them just like other circuit components with the added benefit of being configurable with a program. Because of this microcontrollers can be coaxed to do all sorts of things simply that otherwise would require a large number of parts. Simple microcontrollers cost less than a dollar and hence can be used in almost any project. Indeed they can be found in toys, electric tooth brushes, appliances, cars, phones, electronic keys, you name it. Being programmable also means that they must be programmed. In this lab we concentrate on the electrical interface of microcontrollers and their use as electronic components. The programs we use are very simple and consist to a large part of pasting snippets of code together. In fact, much like checking the application notes of electronic components for circuits that do what we need, its always a good idea to search the web for code that performs the job we need or is at least a good starting point. Most of the code snippets shown in these lab guides are copies of code from the manufacturers website. Feel free to improve on the example programs. Microcontrollers are available from many manufacturers, all with their own advantages (and quirks). In this course we use the MSP430 from Texas Instruments whose strength are low power dissipation and a regular in- struction set. Figure 1 shows the architecture of the MSP430 (specifically the model MSP430F2012). The CPU block is the part that actually performs computations (e.g. additions). Note that microcontrollers usually lack hardware for multiplication or division. These operations can be emulated in software, albeit at the price of low execution speed. The clock system sets the operating speed (16MHz maximum for the controller we are using, compare this to 2GHz or so for present day laptops). A 555-timer like clock is built right into the chip; alternatively an external oscillator can be used if higher precision is required. Flash is a nonvolatile memory for storing programs and configuration data. RAM is where temporary variables go. Note again the contrast to full blown computers: microcontroller memory is typically a few kBytes flash and a few hundred Bytes RAM. Most laptops today have at least a GByte RAM, a million kBytes. You dont need this in an electrical tooth brush. JTAG and Spy-Bi Wire are nifty interfaces for programming and debugging (the microcontroller has no keyboard or LCD display). We will use this interface to talk to the controller though USBmicrocontroller has no keyboard or LCD display)....
View Full Document
- Fall '07