// lab5_starter.c // Fur Elise, E155 Lab 5 // Updated Spring 2019 // Pitch in Hz, duration in ms const int notes[][2] = { {659, 125}, {623, 125}, {659, 125}, {623, 125}, {659, 125}, {494, 125}, {587, 125}, {523, 125}, {440, 250}, { 0, 125}, {262, 125}, {330, 125}, {440, 125}, {494, 250}, { 0, 125}, {330, 125}, {416, 125}, {494, 125}, {523, 250}, { 0, 125}, {330, 125}, {659, 125}, {623, 125}, {659, 125}, {623, 125}, {659, 125}, {494, 125}, {587, 125}, {523, 125}, {440, 250}, { 0, 125}, {262, 125}, {330, 125}, {440, 125}, {494, 250}, { 0, 125}, {330, 125}, {523, 125}, {494, 125}, {440, 250}, { 0, 125}, {494, 125}, {523, 125}, {587, 125}, {659, 375}, {392, 125}, {699, 125}, {659, 125}, {587, 375}, {349, 125}, {659, 125}, {587, 125}, {523, 375}, {330, 125}, {587, 125}, {523, 125}, {494, 250}, { 0, 125}, {330, 125}, {659, 125}, { 0, 250}, {659, 125}, {1319, 125}, { 0, 250}, {623, 125}, {659, 125}, { 0, 250}, {623, 125}, {659, 125}, {623, 125}, {659, 125}, {623, 125}, {659, 125}, {494, 125}, {587, 125}, {523, 125}, {440, 250}, { 0, 125}, {262, 125}, {330, 125}, {440, 125}, {494, 250}, { 0, 125}, {330, 125}, {416, 125}, {494, 125}, {523, 250}, { 0, 125}, {330, 125}, {659, 125}, {623, 125}, {659, 125}, {623, 125}, {659, 125}, {494, 125}, {587, 125}, {523, 125}, {440, 250}, { 0, 125}, {262, 125}, {330, 125}, {440, 125}, {494, 250}, { 0, 125}, {330, 125}, {523, 125}, {494, 125}, {440, 500}, { 0, 0}}; volatile unsigned long* PMC_WPMR = (unsigned long*) 0x400E04E4; // Pointer to the write protect mode register volatile unsigned long* PMC_PCER0 = (unsigned long*) 0x400E0410; // Pointer to the PMC_PCER0 register volatile unsigned long* WDT_MR = (unsigned long*) 0x400E1454; // Pointer to the WDT_MR register void main(void) { *PMC_WPMR = 0x504D4300; // Writes a password to the write protect mode register *WDT_MR |= 1 << 15; // Set the WDDIS bit to 1 to disable the watchdog timer *PMC_PCER0 |= 1 << 11; // Enable PIOA *PMC_PCER0 |= 1 << 12; // Enable PIOB }