Lab 10 Week of November 29 Interrupts This lab requires a combination of your Fibonacci (or Fib & Sum Squares) program with external and real-time interrupts. If your Fibonacci program is not running, now is your chance to get it going to get a few extra points. Alternatively, you can run a simpler program at the same time as real-time interrupts. The idea this program is to have your basic program doing some calculation based on the switch inputs. Whenever an appropriate interrupt comes through, the interrupt routine will be called to update the LEDs. The two interrupts that we will be using are: 1. The external interrupt request To use this, you need to change the jump address at location ISR_JUMP15 to be a jump to your own routine. You can do this by writing the address of your routine to ISR_JUMP15 and ISR_JUMP15+1 when your program starts up. (ISR_JUMP-1 has the jump opcode, which is why the table addresses go up by 3 bytes each entry.) Because the HC 11 hardware takes care of pushing all registers onto the stack during an interrupt, there's very little to worry about during interrupt processing. Whenever the external interrupt request is pressed, you must change sequences going out to the LED. There must be more variation between the sequences than just the initial configuration (i.e., the two sequences cannot be running an identical sequence of instructions during each update). 2. The pulse accumulator input The pulse accumulator can be used to count clock cycles from the timer (which is reserved for the system use, for example in updating USERTICK). The pulses from the timer occur in 4.096ms increments. The pulse accumulate or will provide even interrupt either during each count, or whenever a certain number (up to 256) have occurred, or both (see page 11-6). Both interrupt sources have entries in the jump table that you can also modify. To use the pulse accumulator, you must write to the PACTL control register a bit configuration that sets Port A bit 7 to output, turns on the pulse accumulator, and sets external event accounting. The two RTR1 and RTR0 fields should be unchanged, so read the register, change the bits that you wish to change, and write the register back. Also, you'll need to decide whether you want interrupts during each pulse or for each group of pulses, and set TMSK2 and TFLG2 appropriately. Notes carefully the sentences that start "Before leaving the interrupt service routine..." The interrupt service routines 1. During an external interrupt, you'll need to change some state (memory location) to indicate which LED output routine you are using. You may also need to do the first iteration of that routine, or load the appropriate starting values into the LEDs. 2. During each pulse accumulator interrupt, you will cycle to the next LED configuration. While all of this is running, you will also be executing the Fibonacci program based on the input from the switches. Reviced Grading: ++: Fully working during checkoff, with really neat light patterns, features, and Fibonacci program. Great readme and code on submit. +: Excellent light pattern, reasonable Fibonacci or other program, and great readme and code on submit. x: Good light patterns, reasonable Fibonacci or other program, and good readme and code on submit. -or, without real-time interrupts- A more complicated and creative interaction between external interrupt button and lights than a check-, with an excellent readme. For example, switch bit 7 is not used for fib, but instead to indicate which of 2 patters should be used, and external interrupt steps the pattern while fib program is running, and the external interrupt switch is debounced as discussed in class. -: Passable demo, working submitted code, and good readme. External interrupt used to cycle between patterns or to step a single pattern. Submit: by 9pm, Friday December 3. README: 1. A description of your interrupt procedures 2. How you achieved the time steps that you decided to use 3. A complete discussion of any differences between the code that you are submitting and the code that you had checked off. 3. Any general comments on the lab intr.asm Checkoff in your lab section on Wednesday or Thursday.