ECE 471 LAB 7 FALL 2008 PURPOSE: Practice with lookup tables, indirect addressing, and timers; more programming practice. EXERCISE: This lab will build on lab 7 which counts button presses and then blinks the LED that number of times. For this lab you will change the output so it will blink the LED in Morse code. For example one press will send 'O', 'N', 'E' in Morse code. For two digit numbers send each digit separately, e.g., 16 is sent as 'O', 'N', 'E', space, 'S', 'I', 'X'. Your program will involve three tables: A table of the Morse code for each character, a table of spellings for each number ("ZERO", "ONE", "TWO", etc.), and a table giving the starting address of each of these words. The Morse code table is given on the class web site. Each byte of this table gives the Morse code for a single character. A description of values is given at the top of the table. The word table will give the letters of each word. Each word terminates in a hex value of 0xFF; e.g., Z,E,R,O,0xFF,O,N,E,0xFF, etc. In each case the letter is actually the index for the character in the Morse code table (A=0, B=1, C=2, etc.). Your code will involve the following subroutines: Subroutine DELAYUNITs will delay the number of time units passed in the W register. For delaying one unit of time, use the rollover flag on TMR1. Preload a value into the timer (and set the prescale) so that it rolls over in 200,000 (I.e., a rate of 5 units per second). Subroutine SENDCHAR will send the character given in the W register (0=A, 1=B, 2=C, etc. I.e., W contains the index into the table). A "dot" should take one unit of time to send, and a "dash" should take three units of time to send. Turn the LED off for one unit of time between character elements (dots and dashes). (Simply delay one unit after sending each dot or dash). Delay two extra time units (total of 3) when done sending the character. Subroutine SENDWORD will send the "word" indicated by the value in the W register (0 = "ZERO", 1 = "ONE", etc.). This routine will look up the word start in the "starting address table", and point to the first character to be sent. Then in a loop: while the character pointed to is not 0xFF, send the character, then point to the next character. Delay two extra time units (total of 5) when done sending the word. Subroutine SENDNUMBER will send the number indicated by the value in the W register (called "NUM" in the following). Since we can't easily do division, the routine can operate as follows: Clear a value called "TENS", then while NUM is greater than or equal to 10, subtract 10 from NUM and increment TENS. When done, if TENS is not zero, then send TENS (using SENDWORD). Finally send NUM. Other Notes: Use labels where possible (e.g., in setting up tables). 90 points for doing just the above. Do more for more points. Turn in your listing file and a flowchart or pseudo code of your implementation. Also include anything else you think is important.