diff options
Diffstat (limited to 'Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a.c')
| -rw-r--r-- | Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a.c new file mode 100644 index 0000000..4bf8235 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a.c @@ -0,0 +1,58 @@ +// 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; +} |
