DOC PREVIEW
Berkeley ELENG 100 - Lab 8 – Introduction to the PIC Microcontroller

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Summer 2007 Lab 8 EE100/EE43 University of California, Berkeley Department of EECS EECS 100/43 Lab 8 – Introduction to the PIC Microcontroller 1. Objective In this lab, you will learn about how to use your PIC Microcontroller. This lab is the first lab for the digital component of the EE100 project. The goal of the project is to simply display the strain gauge measurement from your Strain Gauge lab on the LCD display on your PICDEM 2 Plus demo board. 2. Equipment a. Breadboard b. Wire cutters c. Wires d. Oscilloscope e. Function Generator f. Power supply g. PICDEM 2 Plus demo board h. MPLAB ICD 2 (Incircuit Debugger) i. MPLAB IDE installed on lab computer1 j. Various connectors for power supply, function generator and oscilloscope. 3. Theory a. Introduction to microcontrollers [1] You have all heard of the Intel and AMD microprocessors. These little devices are the brains of your computers. However, there is another very important CPU (Central Processing Unit) in the digital world: the microcontroller. Microcontroller differs from a microprocessor in many ways. First and the most important is functionality. In order for a microprocessor to be used, other components such as memory, or components for receiving and sending data must be added to it. On the other hand, microcontroller is designed with most of the components above built-in. Very few external components are needed for its application. Thus, we save the time and space needed to construct devices. You will learn in lecture how digital electronics and systems are a beautiful abstraction of the analog world. You will also learn how you can construct computational circuits and memory units using digital electronics2. In lab, you will learn how to use a very popular microcontroller – the PIC from Microchip corporation. 1 Note: The microcontroller programming tools are installed in 140 Cory ONLY for ease of maintenance 2 EE100 Summer 2007 lectures at the University of California, BerkeleySummer 2007 Lab 8 EE100/EE43 University of California, Berkeley Department of EECS Be advised that we will view the microcontroller from a very high level perspective. That is, we will not go into the nitty-gritty details of designing microcontrollers because it is beyond the scope of this lab. However, the aim of this lab (and the project) is to give you a working idea behind PIC microcontrollers so that you may build useful circuits and continue to explore the microcontroller world on your own. We will explore the most important components of the microcontroller unit in this section. i. The CPU You will see how memory can be understood using the concept of digital feedback in the EE100 Summer 2007 lectures. For now, an abstract view of memory will suffice, refer to Figure 1. Figure 1. Simplified view of a memory unit You will also see how you can build simple circuits that add, subtract and compare: the Arithmetic Logic Unit (ALU). The CPU simply consists of the ALU along with internal memory locations called registers, refer to figure 2. Figure 2. A simplified CPUSummer 2007 Lab 8 EE100/EE43 University of California, Berkeley Department of EECS ii. The Bus We now have two independent entities (memory and CPU). Thus any exchange of data is hindered, as well as its functionality. If, for example, we wish to add the contents of two memory locations and return the result again back to memory, we would need a connection between memory and CPU. Simply stated, we must have some "way" through data goes from one block to another. Enter the concept of a bus. Physically, a bus represents a group of 8, 16, or more wires. There are two types of buses: address and data bus. The first one consists of as many lines as the amount of memory we wish to address and the other one is as wide as data, in our case 8 bits or the connection line. First one serves to transmit address from CPU memory, and the second to connect all blocks inside the microcontroller. Figure 3 shows the new situation. Figure 3. Connecting memory and CPU using instruction and data bus iii. Input Output unit As far as functionality, the situation has improved. But a new problem has appeared: we have a unit that is capable of working by itself, but it does not have any contact with the outside world! In order to remove this deficiency, let's add a block which contains several memory locations. One end of this block is connected to the data bus and the other has connection with the output lines on the microcontroller. These output lines can be seen outside the microcontroller as output pins (just like the output pin of your op-amp). Refer to figure 4.Summer 2007 Lab 8 EE100/EE43 University of California, Berkeley Department of EECS Figure 4. Example of a simplified input-output (I/O) unit that provides communication with the real-world A pin on the microcontroller chip that lets you talk to the outside world is called as a port. There are several types of ports – input, output or bidirectional (input and output). When working with ports, it is necessary to choose which port we need to work with and then send data to or receive data from the port. Notice also from figure 4 that working with a port is like reading and writing to a memory location. This is accomplished using registers. A register is a memory location mapped to a port. When you write to or read from the register, you are reading or writing from the corresponding port. iv. Serial communication We can now communicate with the outside world, but what if we wanted to communicate kilobytes of data? Lets make a quick calculation on how many lines we would need. 1 kilobyte = 1024 bytes. 1 byte = 8 bits. Thus, we would need: 1024 bytes x 8 bits/byte = 8192 bits. If a port carries 1-bit of data, then we would need 8192 ports or 8192 pins! What if we wanted to carry a megabyte (1024 kilobytes) of data? You would need 8,388,608 lines! Thus it is obvious that if you want to communicate large amounts of data with the outside world, a port is very inefficient. Ports are useful only for carry a bit of data. In order to overcome this problem, we have to come up with a way to reduce the number of lines and not lose functionality. Suppose we are working with three lines only and one line is used for sending data, other for receiving, and the third is used as a reference line for both the input and the output. In order for this to


View Full Document

Berkeley ELENG 100 - Lab 8 – Introduction to the PIC Microcontroller

Documents in this Course
Lecture

Lecture

75 pages

Load more
Download Lab 8 – Introduction to the PIC 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 8 – Introduction to the PIC 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 8 – Introduction to the PIC 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?