Unformatted text preview:

PIC Lab Intro Spring 2009.pdfPic Lab PartA_Programming Spring 2009.pdfPIC Lab Part B Spring 2009.pdfPIC Lab Part C Spring 2009.pdfChemistry 628 University of Wisconsin-Madison LABORATORY UNIT ON MICROCONTROLLERS** AND FEEDBACK: AN INTRODUCTION A microcontroller is a mini-computer on a single, highly-integrated chip. It contains many of the parts that typically make up a computer – a CPU, ROM for program storage, RAM for data storage, timers, and I/O ports for peripherals – all on one chip. It is different from a microprocessor, also a highly-integrated chip, which serves as just the CPU, the heart of any computer. Memory and peripherals are external to a microprocessor. A microcontroller has less memory and a much slower CPU than your desktop computer, but it is also much less expensive. They cost about $5 to $10. Microcontrollers don't need all the speed and memory that your computer has. They are designed and programmed to perform a specific well-defined task, as opposed to the myriad of tasks that your computer performs. Microcontrollers are ubiquitous. They are found in countless consumer products such as automobiles, digital cameras, cell phones, microwave ovens, and digital clocks, to name a few. They are typically embedded in these larger systems to control something, such as anti-lock breaks in an automobile or an alarm on a digital clock. As scientists we are interested in what they can do for us in the laboratory – such as controlling the temperature of an incubator or adjusting the flow of reactants to a process. Look around in your laboratory and you will probably see various instruments with push buttons and digital displays, all with embedded microcontrollers. Complex scientific instruments or consumer products may contain several microcontrollers, each with a different function. Figure 1 shows a few products that contain some kind of embedded controller. Figure 1. Consumer products and scientific instruments that use embedded microcontrollers.This Laboratory Unit on Microcontrollers and Feedback is designed to help you learn about the various features of microcontrollers and how to program them to provide feed-back and control in a real experiment. It is hoped that, by the end of our three week unit, you will become comfortable enough with microcontrollers to use them in designing experiments for your own research. To help you get started, this Introduction provides background information on using and programming the PICmicro® series brand of microcontrollers manufactured by Microchip, which you will use in lab. Specifically, some of the various features of the PICmicro® devices are discussed first. Familiarity with these features will help you later when reading data sheets and other document-tation related to these devices. The development process and tools that will be used in lab are discussed next. Development tools include both hardware and software that enable you to write and test your application programs on the microcontroller. Programming a PIC can be done in Assembly Language, C, or BASIC. You will use PicBasic Pro™, a modified version of the BASIC programming language. Information about PicBasic Pro™ is provided in the final section of this Introduction to the Laboratory Unit on Microcontrollers and Feedback. The remainder of the Laboratory Unit on Microcontrollers and Feedback is divided into three parts or labs. Procedures for these labs are provided in separate documents. In the first lab you will obtain practice in programming the microcontroller. You will interface simple circuits to the device and learn how to establish serial communication between it and the outside world (such as an LCD or your computer terminal). In the second lab you will use the microcontroller to monitor temperature by interfacing it to a thermocouple and an external A/D converter. Monitoring an experimental variable is one part of a control process that uses feed-back. In the third and final lab of this unit, you will complete the feed-back loop by using the microcontroller to control the temperature of an aluminum block. You will program the device to adjust the amount of time the heater is on and off depending on how close the block is to a set temperature. PICMICRO® DEVICE FEATURES The number and variety of microcontrollers on the market is enormous. A search on the Digi-Key website alone yields over 3,300 possibilities. Most of the major semiconductor manufactures (such as Intel and Motorola) produce their own series of microcontrollers. You will be using a PIC16F877A from Microchip's PICmicro® series of devices. Even within the PICmicro® series of devices – or PICs*, as they are commonly called – the number of choices can be overwhelming. They differ in the type and size of memory, in number of I/O ports, and what special features – such as comparators and A/D converters – are built into the chip. They come in a variety of packages, such as plastic or ceramic, surface mount or through-hole, with anywhere from 6 to 80 pins. Some of these different devices are shown in Figure 2. * PIC is an acronym that stands for Programmable Interface Controller. It is a programmable controller that can be interfaced to various peripheral devices and/or experiments. 2(a)(b)(c)(d)(e) (f)(a)(b)(c)(d)(e) (f) Figure 2. Various PicMicro® devices: (a) PIC16F648A in an 18-pin plastic dual-in-line package (DIP); (b) PIC16F624 in an 18-pin small outline IC (SOIC) package; (c) an 18-pin device with a UV transparent window; (d) PIC16F877 in 40 pin DIP; (e) PIC16F877A in plastic leaded chip carrier (PLCC); and (f) an 80-pin device in a thin quad flat pack (TQFP) package. Packages in (a), (c) and (d) are all for through hole mounting, while the other packages are for surface mounting. I. Memory Microchip produces microcontrollers with three different types of field-programmable program memory – Flash, EPROM, and OTP. Flash memory is similar to EEPROM memory – Electrically Erasable Programmable Read Only Memory. Devices with this type of memory are the best choice for a research laboratory because both erasing and programming can be done quickly. Flash devices can be reprogrammed thousands of times. In lab you will use a PIC16F877A device, where the "F" in the middle of the name denotes Flash memory. EPROM (Electrically Programmable ROM) devices can also be programmed multiple times electrically but they must first be


View Full Document

UW-Madison CHEM 628 - Lab 3 Microcontroller

Documents in this Course
Load more
Download Lab 3 Microcontroller
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab 3 Microcontroller and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab 3 Microcontroller 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?