DOC PREVIEW
Berkeley ELENG 100 - Lab 9 – PIC Input-Output (I/O)

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 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 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Summer 2007 Lab 9 EE100/EE43 University of California, Berkeley Department of EECS EECS 100/43 Lab 9 – PIC Input-Output (I/O) 1. Objective In this lab, you will simply hook up the output from the strain gauge circuit you designed the previous week to the PIC microcontroller. 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. k. YOUR STRAIN GAUGE CIRCUIT 3. Theory a. Downloading the sample project In this section, you download the digital code to your microcontroller board. Since you did not cover digital systems in lecture, all the code is already done for you. All you need to do is uncomment the A/D code for interfacing the strain gauge. 1. Download the StrainGauge project folder from the EE100 labs homepage (the same project you used for lab 8). Save this to your U: (network) drive. DO NOT SAVE THIS ONTO YOUR DESKTOP. FILES SAVED ONTO YOUR DESKTOP ARE AUTOMATICALLY DELETED WHEN YOU LOG OFF!! 2. Navigate to your folder and double-click on icon. A window similar to figure 1 will pop up. 1 Note: The microcontroller programming tools are installed in 140 Cory ONLY for ease of maintenanceSummer 2007 Lab 9 EE100/EE43 University of California, Berkeley Department of EECS Figure 1. MPLAB IDE has opened your Strain Gauge project 3. Now, double click on main.c in the StrainGaugeInterface.mcw window. The main program should pop up. Look through it. Find the line that displays VOLTMETER. Replace this with STRAIN READING: 4. Next, you need to comment out the voltmeter reading code. These are the first two lines after void main( void ) line. The default code is shown below. You should be able to use this code to figure out how to comment out those lines. void main( void ) { TRISA=0xFF; // Configure AN0 as input. This is default ADCON0=0x41; // configure ADC to receive signal from AN0 ……….. 5. Uncomment the lines for interfacing an external signal (in this case your sensor reading) to your PIC board. These are the lines immediately after the lines you commented out in 4. above. //TRISE= 0x02; //ADCON0 = 0x59; //configure ADC to receive signal from // AN6 (RE1) ………….. 6. You should debug the program before downloading it to the board. To do this: Click on Debugger→Select Tool. Make sure MPLAB ICD 2 is selected. Refer to figure 2.Summer 2007 Lab 9 EE100/EE43 University of California, Berkeley Department of EECS Figure 2. Make sure MPLAB ICD 2 is selected as the debugger 7. The debugger should ask you to download an operating system to the board. Defaults are OK for everything. Before you connect to the board, MAKE SURE THE BOARD IS POWERED ON AND CONNECTED TO THE ICD2 DEBUGGER. MAKE SURE THE DEBUGGER IS CONNECTED TO THE COMPUTER (check with a TA). Next, connect to the board: Debugger→Connect. 8. Build your program. Select Project→Build All 9. Program the board with your code: Debugger→Program. 10. Run the program: Debugger→Run. 11. If all goes well you should see the LCD screen display your strain gauge reading. 12. If you are satisfied that your program is working, you can “permanently” download code to EEPROM2. First, halt debug mode: Debugger→Halt. 13. Select Debugger→Select Tool→None. You cannot use the programmer and the debugger at the same time. 14. You pretty much repeat the same process for programming as debugging: Select Programmer→Select Tool→MPLAB ICD 2. 15. Select Programmer→Connect 16. Select Programmer→Program 2 EEPROM: Electrically Erasable Programmable Read Only MemorySummer 2007 Lab 9 EE100/EE43 University of California, Berkeley Department of EECS 17. Select Programmer→Release from Reset. 18. Power off the board and power-on again. Your code will start running again.Summer 2007 Lab 9 EE100/EE43 University of California, Berkeley Department of EECS 4. PRELAB NAME:__________________________________/SECTION____ Please turn in INDIVIDUAL COPIES of the prelab. They are due 10 MINUTES after start of lab, NO EXCEPTIONS! a. TASK 1: THOROUGHLY READ THIS DOCUMENT! (YES, THIS PRELAB IS A GIMME) PRELAB COMPLETE: _________________________________ (TA CHECKOFF)Summer 2007 Lab 9 EE100/EE43 University of California, Berkeley Department of EECS 5. REPORT NAME(S):__________________________________/SECTION____ a. TASK 1: PROJECT COMPLETE. TA Checkoff:_______ TURN IN ONE REPORT PER GROUP AT THE END OF YOUR LAB SESSION. THERE IS NO TAKE HOME REPORT. 6. REVISION HISTORY Date/Author Revision Comments Summer 2007/Bharathwaj Muthuswamy Typed up source documentation, organized lab report, typed up


View Full Document

Berkeley ELENG 100 - Lab 9 – PIC Input-Output (I/O)

Documents in this Course
Lecture

Lecture

75 pages

Load more
Download Lab 9 – PIC Input-Output (I/O)
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 9 – PIC Input-Output (I/O) 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 9 – PIC Input-Output (I/O) 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?