Lab5_f10 - University of Florida ECE Dept Page 1/2 EEL 4744 Dr Gugel 5:56 PM Lab#5 Software Switch Debounce& Adding an 8 Bit External Output

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 ECE Dept. Page 1/2 EEL 4744 Dr. Gugel 9/23/10 - 5:56 PM Lab #5: Software Switch Debounce & Adding an 8 Bit External Output Port Purpose This lab consists of two parts. The first is to create de-bounce software for the keypad added in Lab #4 to use the keypad as a counter. The second part is to add an external port to the DSP using an 8 bit latch (74HC574). In order to add this latch, we will need to place it in the memory map of the DSP and modify the CPLD to implement the required decode equation. Both the de-bounce software and external port must be complete by the end of this lab. Part I. De-boucing a Switch via Software In Lab #4, you added a keypad to your DSP development board and wrote software to display the key pressed on your LED binary display. We will now use the same hardware as before and only modify the software to do the following: 1. Check when the "1", "2" or "3" keys are pressed on your keypad (one at a time). 2. Every time the "1" key is pressed, increment a once counter and display on your LED display. Every time the "2" key is pressed, increment your counter value by 2 and display. Every time the "3" key is pressed, increment your counter by 3 and display. The counter/display should be an eight bit value. 3. If a "0" is pressed, zero out the counter value. Because we are now counting the number of keystrokes, we will need to de-bounce the keypad switches. This step is necessary because when a key is pressed or released, the contacts of the switch bounce between the switch being open and closed repeatedly for several milliseconds (typically 1-25 mSec). This in turn causes your input relating to this switch to bounce between L (switch is closed and shorted to ground) and H (switch is open and pull-up resistor pulls input high). Because we only want to count the key being pressed one time every time a key is pressed and released, we will need to put in a short delay after the key is pressed and released to ignore the bounce effect. To remove switch bounce via software, we simply put in a time delay to allow the switch to settle after it has been pressed and after it has been released. Therefore, you should: 1. Test for a key pressed. 2. If pressed, delay 25 mSec and then update or clear the counter. 3. Check when the key is released and again delay before going back to #1. Part II. Adding an 8 Bit Output Port In your parts kit you should have a 74574 latch that you will use to create an output port. See the following TI data sheet for more info: 74574 Pin-out - Check and search for a 74ABT574 and look for a DIP package. Add an external port in the following manner: 1. Attach a 574 to the data bus on your DSP. See our board manual for the proper XD7:0 header pins. 2. Ground the 574 ~OE pin so that the output is always enabled and never tri-stated. 3. Attach the 574 clock (CLK) input to one of your open I/O pins on your CPLD. 4. Create a decode equation in the CPLD and assign the equation output to the CPLD I/O pin you selected in #3. Note: It is recommended that you place the 574 at 0x004000 (Zone 0) in the DSP memory map. 5. Create some short assembly code to write 0x55, 0xAA, 0x0 and 0xFF to the latch and step through it using the Code Composer debugger. Very Important => Make sure no data bits are Grounded or tied to +3.3V before powering on your board. Use your multi-meter and check all data bus signals wired to headers. University of Florida ECE Dept. Page 2/2 EEL 4744 Dr. Gugel 9/23/10 - 5:56 PM Lab #5: Software Switch Debounce & Adding an 8 Bit External Output Port Wiring mistakes at this point can destroy your DSP ($$ for a replacement board)! Attend a workshop to pick up your CPLD from a TA and have them review your Quartus schematic before programming the CPLD in your board. 2. Show the TA a Quartus generated print-out of your schematic design that corresponds to the decode circuitry found in the CPLD. 3. Using your voltage meter, show your TA that you can send out known patterns to your port. Point Breakdown: Part I. In-Lab Requirements: 1. Upon entering the lab, show error-free ASM and list files to your TA for Part I (de-bounce software). This is pre-lab material. 2. Disable your delay in your software and use the Logic State Analyzer (LSA) to trigger when the "1" key is pressed. Observe the switch bounce on the LSA. Measure the duration of the bounce. 3. Next trigger the LSA when the key is released and again observe and measure the bounce. 4. Run your code with the delay and show that your program debounces the switch, counts properly, and clears when required. 5. Now use the LSA to precisely measure the duration of your delay routine: Select an open pin from one of the available port pins and configure it for output. Set the debug output pin low before a key is pressed. Set the output high immediately before entering the delay routine. Set the output pin low after leaving the delay routine.Add this debug output signal to your LSA and measure how long it is high once a pressed key triggers the analyzer. 6. Show the TA that your other keys "2" and "3" are incrementing the display as required by this lab. Part II. In-Lab Requirements: 1. Show your TA a hand drawn schematic of the latch with pin numbers and draw how it attaches to the board headers with pin numbers also denoted. Part I. Pre-lab materials (35%) Part II. Pre-lab materials (15%) Show working de-bounce switch counter (25%) Show working output port (25%) Additional Helpful Hints: 1. The signal used to latch data into the 74574 is derived from a CPLD output. This signal only requires the chip select from Zone 0 (xZCS0) and external read/write (xR/-W) as inputs. 2. CS0 and R/-W must be selected as outputs in GPBMUX1. The power-up default is to use these DSP pins as GPIO signals. We must override this default setting and instead select CS0 and R/-W for output. 3. Similarly, we have to select external data7:0 (xD7:0) for output in GPCMUX1. These pins again default power-up as GPIO signals. 4. You must set XINTFENCLK = 1 in the PCLKCR3 register. This enables CS0 to act as a low true data strobe. If you don't enable this, you won't see CS0 strobe on a write to Zone 0. 5. Finally, if you are going to use 32 bit move commands (i.e. MOV *AR0,ACC) to write to GPCMUX1, you must include the code SETC OBJMODE at the top of your program. Another option is to just use 16 bit moves as we have in previous labs and write to GPCMUX1 (lower word of the register) and then GPCMUX1+1 (upper word of the register) to access the upper 16 bits in the GPCMUX1 register. ...
View Full Document

This document was uploaded on 07/11/2011.

Ask a homework question - tutors are online