lab3_s10 - University of Florida Department of Electrical...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: University of Florida Department of Electrical and Computer Engineering EEL 4744 Spring 2010 Dr. Gugel 1/21/10 - 16:01 A1/P1 Page 1/2 Lab #3: Assembly Programming & Elementary Wiring Purpose This lab is an exercise in elementary assembly programming and basic wiring. It requires students to write short assembly code routines for elementary mathematical calculations on a sample population and to wire an LED display and switches to the F28335. If you do not have your F28335 development board headers mounted and the board tested, do so at an earlier lab to be ready for the hardware added in this lab. Part I. Program Description We would like to find the maximum and minimum grade in a vector of student grades. 1. Assume that your TA will give you a vector of student test grades. The starting address for the vector will be denoted as score_addr and an equate (.set) statement should be used at the top of your program to set where this vector will be placed in memory. The vector of grades will then be placed starting at this address and the .word assembler directive can be used to create the scores. 2. The length or number of elements in the vector will be stored as a single byte at address score_vector_len which will also be given to you in lab. Use a .set statement at the top of your program to create this address. 3. The test scores or elements of the vector are unsigned words that range from 0 to 100. 4. Use a loop to go through the loop and find a maximum score and then store it at max_addr which will also be given to you by your TA. 5. Repeat with another loop to go through and find the minimum score which will be stored at min_addr (again given to you at lab time by your TA). 6. Use a loop to go through the loop and find a zero score and then store it at zero_addr which will also be given to you by your TA. If no zero is found, then store -1 at zero_addr. 7. As mentioned earlier, your TA will give you all required input/output addresses in lab. Thus Part I. Pre-Lab Work 1. Create a program flow chart for your program. Print them both out and bring them to lab as a hard copy and also on a memory stick. 2. Code each block in your flow chart in F28335 assembly. 3. Assemble and simulate your code outside of lab to verify proper function. Part I. In-Lab 1. Your TA will not allow you in unless you have the pre-lab materials specified above. 2. A vector containing test scores will be given to you as well as the vector length. Re-assemble and test your code with this new information. 3. Verify your computed results with your TA. 4. Answer any questions they have regarding your code & program operation. you should use assembler .set statements for all constants in your program. You should also use equate .set statements to define origins for the program and data sections. This will enable your code to be easily moved (re-located) in memory. 8. Create a dummy score vector and length and test your program at home. Don’t try to write the code in lab… you won’t have time! Your TA will also be asking you questions on how your program works to see if you are the original author. Part II. Adding a 4 Bit LED Display in Lab We would like to connect an 8 LED display in a DIP style package (LED Bar) to GPIO11:4 on the F28335. This will enable us to write out binary values for visual information feedback during program execution. While this sounds quite elementary, it will turn out to be an extremely beneficial debug tool during run-time. University of Florida Department of Electrical and Computer Engineering EEL 4744 Spring 2010 Dr. Gugel 1/21/10 - 16:01 A1/P1 Page 2/2 Lab #3: Assembly Programming & Elementary Wiring 1. Connect the LED Bar using wire-wrap wires to eight series current limiting resistors (where the resistance should be in the range of ~220-680 ohms). See our website for instructions on the physical location of the components & wiring. We will connect GPIO11:4 to the eight anodes on the eight LEDs and then attach the cathodes to eight resistors in a SIP pack with the common pin going to ground. In this configuration, the LEDs will turn on when a particular GPIO11:4 bit is high (high true LEDs). Note: The least significant bit (LSB) of your display should be rightmost LED. You should be able to therefore read the binary number from the lighted LEDs when you look at your dev board facing up (text on the board is NOT upside down). 2. Once your binary display is connected write ones and zeros to DPIO11:4 to test each individual LED. You will have to write an assembly program to perform this and then load & step through it using the CC4 debugger. This ASM program will need to enable protected register write mode, to disable the watchdog timer as well as the basic GPIO pin control that involves setting the GPAMUX1, GPADIR and GPADAT registers. These will be discussed in detail in lecture. Note: Upon stepping your code, if the proper LEDs do not light, check your wiring. If you find no errors, check the voltages at the actual F28335 GPIO11:4 pins on the GPIO header. Pin definitions for the dev board headers can be found in our online documentation near the link for this lab. Part III. Adding an Input Switch in Lab We will now add a 4 bit DIP switch (using an 8 or 4 bit SPST DIP switch) to GPIO3:0. This will enable us to manually input information (4 bits) to the F28335 while it is executing code. 1. Connect 4 DIP switches to pins GPIO3:0 on the GPIO header. Note1: The DIP switch should be placed in a DIP Breakout Island on top of the board with the header pins used for wire-wrapping pins facing down. See our website for instructions on the physical location of the components & wiring and ask questions in class if this is unclear. Note2: The rightmost switch from the top view of your dev board should be connected to the GPIO0 (LSB). 2. Connect the other side of the four DIP switches to GND. 3. Next, connect a SIP pull-up RPACK to the side of the 4 switches that are connected to GPIO3:0. Connect the common node of the RPACK to +5V. The physical layout is shown in the last page of this document. 4. Create a test program (assembly code) that reads GPIO3:0 (inputs) and echoes it to GPIO7:4 (outputs). The program should continuously scan the switches so that any change in the binary switches are reflected on the LEDs. 5. Load the program into the development board and demo to your TA. Point Break-Down Pre-Lab Materials (follow pre-lab guideline) A. Program description, Problems Encountered (what you learned) and Applications 5% B. Flowcharts Part I flow chart, 5% Part II flow chart, 5% Part III flow chart, 5% C. ASM files, 5% In-Lab Participation A. ability to debug and find errors, 10% B. modular code and relocatable variables ( clear concise program function, extensive use of .set and .word statements) 10% C. Part I, correct results for outputs from data given by TA & questions answered correctly, 25% D. Part II, functional LED output port, 10% E. Part III, functional input switches, 10% F Part III, program that echoes input switches to output display, 10% ...
View Full Document

This document was uploaded on 11/24/2010.

Ask a homework question - tutors are online