// Lösung zu Termin2 // Aufgabe 4 // Namen: __________; ___________ // Matr.: __________; ___________ // vom : __________ // #include "pio.h" #include "pmc.h" #include "aic.h" StructPMC* myPMC = PMC_BASE; StructAIC* myAIC = AIC_BASE; StructPIO* myPIOB = PIOB_BASE; void taste_irq_handler (void) __interrupt__ ((interrupt)); void taste_irq_handler (void) { // do the things here // necessary?? //myPIOB->PIO_ISR; // Read Interrupt Status Register to enable // Interrupt again // switch LED1 myAIC->AIC_EOICR = 0x00000000; // Write to End of Interrupt Command Register // to signal end of Interrupt Service Routine } int main(void) { myPMC->PMC_PCER = 0x14; // Clock PIO B // Initialize PIOB myPIOB->PIO_PER = KEY1|KEY2|LED1|LED2; // Enable PIO for SW1,SW2,LED1,LED2 myPIOB->PIO_OER = LED1|LED2; // Set LED1 and LED2 as output myPIOB->PIO_CODR = 0x000000FF; // Clear Output Data Register // Enable Interrupts in CPU // done by OS // Enable Interrupt for PIOB in AIC //myAIC->AIC_SMR[] = ; // which register? what to put in it? //myAIC->AIC_SVR[]= taste_irq_handler // Address of Interrupt handling routine... myAIC->AIC_IECR = PIOB_ID; // Enable Interrupt for PIOB // enable PIOB Interrupt //myPIOB->PIO_IER = ; // what to put here? // loop to infinity while(1) { } return 0; }