;*********************************************************** ;* This is the skeleton file for Lab 5 of ECE 375 ;* ;* Author: Enter your name ;* Date: Enter Date ;* ;*********************************************************** .include "m32U4def.inc" ; Include definition file ;*********************************************************** ;* Internal Register Definitions and Constants ;*********************************************************** .def mpr = r16 ; Multipurpose register .equ WskrR = 0 ; Right Whisker Input Bit .equ WskrL = 1 ; Left Whisker Input Bit ;*********************************************************** ;* Start of Code Segment ;*********************************************************** .cseg ; Beginning of code segment ;*********************************************************** ;* Interrupt Vectors ;*********************************************************** .org $0000 ; Beginning of IVs rjmp INIT ; Reset interrupt ; Set up interrupt vectors for any interrupts being used ; This is just an example: ;.org $002E ; Analog Comparator IV ; rcall HandleAC ; Call function to handle interrupt ; reti ; Return from interrupt .org $0056 ; End of Interrupt Vectors ;*********************************************************** ;* Program Initialization ;*********************************************************** INIT: ; The initialization routine ; Initialize Stack Pointer ; Initialize Port B for output ; Initialize Port D for input ; Initialize external interrupts ; Set the Interrupt Sense Control to falling edge ; Configure the External Interrupt Mask ; Turn on interrupts ; NOTE: This must be the last thing to do in the INIT function ;*********************************************************** ;* Main Program ;*********************************************************** MAIN: ; The Main program ; TODO rjmp MAIN ; Create an infinite while loop to signify the ; end of the program. ;*********************************************************** ;* Functions and Subroutines ;*********************************************************** ;----------------------------------------------------------- ; You will probably want several functions, one to handle the ; left whisker interrupt, one to handle the right whisker ; interrupt, and maybe a wait function ;------------------------------------------------------------ ;----------------------------------------------------------- ; Func: Template function header ; Desc: Cut and paste this and fill in the info at the ; beginning of your functions ;----------------------------------------------------------- FUNC: ; Begin a function with a label ; Save variable by pushing them to the stack ; Execute the function here ; Restore variable by popping them from the stack in reverse order ret ; End a function with RET ;*********************************************************** ;* Stored Program Data ;*********************************************************** ; Enter any stored data you might need here ;*********************************************************** ;* Additional Program Includes ;*********************************************************** ; There are no additional file includes for this program