Digital Systems Design lab Report

// Piano.c // This software configures the off-board piano keys // Runs on TM4C123 // Program written by: put your names here // Date Created: // Last Modified: // // Lab number: 4 // Hardware connections #include "tm4c123gh6pm.h" #include "Piano.h" // put code definitions for the software (actual C code) // this file explains how the module works // **************Piano_Init********************* // Initialize piano key inputs, called once // Input: none // Output: none void Piano_Init(void){ unsigned int delay; SYSCTL_RCGC2_R |= 0x10; delay=0x4; GPIO_PORTE_DIR_R &= 0xF0; GPIO_PORTE_AMSEL_R &= 0xF0; GPIO_PORTE_DEN_R |= 0x0F; GPIO_PORTE_AFSEL_R &= 0xF0; GPIO_PORTE_PCTL_R &= 0xF0; GPIO_PORTE_IS_R &= 0xF0; //Pins 0-3 are not edge sensitive GPIO_PORTE_IBE_R |= 0x0F; //Pins 0-3 are both edges GPIO_PORTE_IEV_R &= 0xF0; //Pins 0-3 are not a falling edge event GPIO_PORTE_ICR_R &= 0xF0; //Clear flags pins 0-3 GPIO_PORTE_IM_R |= 0x0F; //Arms interrupts on pins 0-3 NVIC_PRI1_R = (NVIC_PRI1_R &0xFFFFFF1F) | 0x000000E0; //Priority of 7 NVIC_EN0_R |= 0x00000010; } // **************Piano_In********************* // Input from piano key inputs // Input: none // Output: // 0x01 is just Key0, 0x02 is just Key1, 0x04 is just Key2 and 0x08 is just key3 unsigned long Piano_In(void){ int Value; Value = GPIO_PORTE_DATA_R; return Value; } // Insert the Handler for key input according to your output choice // refer to start.s for ISR names