summaryrefslogtreecommitdiffstats
path: root/Bachelor/Mikroprozessorsysteme2/mi2/Termin2
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Bachelor/Mikroprozessorsysteme2/mi2/Termin2
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Bachelor/Mikroprozessorsysteme2/mi2/Termin2')
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2.pdfbin0 -> 25496 bytes
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2Aufgabe1.c12
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2Aufgabe4.c20
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/makefile122
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe1.c21
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe2.c22
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe3.c31
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/defines.h16
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2.pdfbin0 -> 8832 bytes
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe1.c12
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4.c20
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a.c58
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a1.c68
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a2.c67
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c37
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/frank_micsys2_praktikum02.zipbin0 -> 24577 bytes
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/init4.h64
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/makefile51
18 files changed, 521 insertions, 0 deletions
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2.pdf b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2.pdf
new file mode 100644
index 0000000..ca65e31
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2.pdf
Binary files differ
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2Aufgabe1.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2Aufgabe1.c
new file mode 100644
index 0000000..dec24cd
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2Aufgabe1.c
@@ -0,0 +1,12 @@
+// Lösung zu Termin2
+// Aufgabe 1
+// Namen: __________; ___________
+// Matr.: __________; ___________
+// vom : __________
+//
+
+int main(void)
+{
+
+ return 0;
+}
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2Aufgabe4.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2Aufgabe4.c
new file mode 100644
index 0000000..f2e0832
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/Termin2Aufgabe4.c
@@ -0,0 +1,20 @@
+// Lösung zu Termin2
+// Aufgabe 4
+// Namen: __________; ___________
+// Matr.: __________; ___________
+// vom : __________
+//
+
+
+void taste_irq_handler (void) __interrupt__ ((interrupt));
+
+void taste_irq_handler (void)
+{
+
+}
+
+int main(void)
+{
+
+ return 0;
+}
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/makefile1 b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/makefile1
new file mode 100644
index 0000000..4df82d6
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Aufgabe/makefile1
@@ -0,0 +1,22 @@
+FILE = Termin2Aufgabe1
+Opti = 1
+
+all:
+# Übersetzen der Quelldatei
+# arm-elf-gcc -g -Ttext 0x2000000 -O$(Opti) $(FILE).c -I ../h
+ arm-elf-gcc -g -e main -Ttext 0x2000000 -O$(Opti) $(FILE).c -o $(FILE).elf -nostdlib
+
+# Erzeugen der Assemblerdatei aus der Quelldatei
+ arm-elf-gcc -S -O$(Opti) $(FILE).c
+
+# Ereugen der Objektdateien
+# arm-elf-gcc -c -g -O$(Opti) ../boot/swi.S -o swi.o
+# arm-elf-gcc -c -g -O$(Opti) ../boot/boot.S -o boot.o
+
+# Binden für die RAM-Version
+# arm-elf-ld -Ttext 0x02000000 -O$(Opti) boot.o swi.o $(FILE).o -o $(FILE).elf
+
+# Binden für die FLASH-Version
+# arm-elf-ld -Ttext 0x01000000 -O$(Opti) boot.o swi.o $(FILE).o -o $(FILE).out
+# arm-elf-objcopy -I elf32-littlearm -O binary -x -S -N -g $(FILE).out $(FILE).rom
+
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe1.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe1.c
new file mode 100644
index 0000000..355bb20
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe1.c
@@ -0,0 +1,21 @@
+#include "defines.h"
+
+int main(void)
+{
+ *PMC_PCER = 0x4000; // Power Enable für Parallel I/O Controller B
+ *PIOB_PER = 0x100; // Pin 8: Enabled (Initialisiert) (Lämpchen)
+ *PIOB_OER = 0x100; // Pin 8: Pin als Ausgabe verwenden
+ // Lämpchen ist initialisiert und auf Output gesetzt.
+
+ int i;
+
+ while (1)
+ {
+ *PIOB_SODR = 0x100; // Pin 8: Lampe an
+ for (i=0; i<125000; i++); // Pause
+ *PIOB_CODR = 0x100; // Pin 8: Lampe aus
+ for (i=0; i<125000; i++); // Pause
+ }
+ return 0;
+}
+
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe2.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe2.c
new file mode 100644
index 0000000..000f51a
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe2.c
@@ -0,0 +1,22 @@
+#include "defines.h"
+
+int main(void)
+{
+ *PMC_PCER = 0x4000; // Power Enable für Parallel I/O Controller B
+ *PIOB_PER = 0x118; // Pin 8: Enabled (Initialisiert) (Lämpchen)
+ // *PIOB_PER = 0x100; *PIOB_PER = 0x8; *PIOB_PER = 0x10
+ *PIOB_OER = 0x100; // Pin 8: Pin als Ausgabe verwenden
+
+ // Schalter werden nicht auf Input geschaltete, da dies Default Zustand ist
+ // Lämpchen ist initialisiert und auf Output gesetzt.
+
+ while (1)
+ {
+ if (!(*PIOB_PDSR & 0X8))
+ *PIOB_SODR = 0x100; // Pin 8: Lampe an
+ if (!(*PIOB_PDSR & 0x10))
+ *PIOB_CODR = 0x100; // Pin 8: Lampe aus
+ }
+ return 0;
+}
+
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe3.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe3.c
new file mode 100644
index 0000000..21ed738
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/Termin2Aufgabe3.c
@@ -0,0 +1,31 @@
+#include "defines.h"
+
+int main(void)
+{
+ *PMC_PCER = 0x4000; // Power Enable für Parallel I/O Controller B
+ *PIOB_PER = 0x318; // Pin 8,9,3,4: Enabled (Initialisiert) (Lämpchen1,2,Schalter1,2)
+ // *PIOB_PER = 0x100; *PIOB_PER = 0x200; *PIOB_PER = 0x8; *PIOB_PER = 0x10
+ *PIOB_OER = 0x300; // Pin 8,9: Pin als Ausgabe verwenden (Lampe 1,2)
+
+ // Schalter werden nicht auf Input geschaltete, da dies Default Zustand ist
+ // Lämpchen ist initialisiert und auf Output gesetzt.
+
+ int i;
+
+ while (1)
+ {
+ *PIOB_SODR = 0x100; // Pin 8: Lampe 1 an
+ for (i=0; i<125000; i++); // Pause
+ *PIOB_CODR = 0x100; // Pin 8: Lampe 1 aus
+ for (i=0; i<125000; i++); // Pause
+
+ // PDSR wird erst geprüft nachdem Lampe 1 aus ist
+
+ if (!(*PIOB_PDSR & 0X8))
+ *PIOB_SODR = 0x200; // Pin 8: Lampe 2 an
+ if (!(*PIOB_PDSR & 0x10))
+ *PIOB_CODR = 0x200; // Pin 8: Lampe 2 aus
+ }
+ return 0;
+}
+
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/defines.h b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/defines.h
new file mode 100644
index 0000000..b325848
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Loesung/defines.h
@@ -0,0 +1,16 @@
+// Power Management Controller (Atmel Docu S. 139)
+#define PMC_PCER ((volatile unsigned int*) 0xFFFF4010) // Peripheral Clock Enable Register
+#define PCER_PIOA 0x2000 // PIOA: PIOA Clock. Enable
+#define PCER_PIOB 0x4000 // PIOB: PIOB Clock. Enable
+#define PMC_PCDR ((volatile unsigned int*) 0xFFFF4014) // Peripheral Clock Disable Register
+
+
+/*****************************************************************************/
+// Parallel I/O Controller B (Atmel Docu S. 59)
+#define PIOB_PER ((volatile unsigned int*) 0xFFFF0000) // Enable Register (Atmel Docu S. 60)
+#define PIOB_PDR ((volatile unsigned int*) 0xFFFF0004) // Disable Register (Atmel Docu S. 60)
+#define PIOB_SODR ((volatile unsigned int*) 0xFFFF0030) // Set Output Data Register (Atmel Docu S. 66)
+#define PIOB_CODR ((volatile unsigned int*) 0xFFFF0034) // Clear Output Data Register (Atmel Docu S. 66)
+#define PIOB_OER ((volatile unsigned int*) 0xFFFF0010) // Output Enable Register (Atmel Docu S. 62)
+#define PIOB_ODR ((volatile unsigned int*) 0xFFFF0014) // Output Disable Register (Atmel Docu S.62)
+#define PIOB_PDSR ((volatile unsigned int*) 0xFFFF003C) // Pin Data Status Register (Atmel Docu S.67)
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2.pdf b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2.pdf
new file mode 100644
index 0000000..f23c20c
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2.pdf
Binary files differ
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe1.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe1.c
new file mode 100644
index 0000000..c8e6468
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe1.c
@@ -0,0 +1,12 @@
+// Lösung zu Termin2
+// Aufgabe 1
+// Namen: __________; ___________
+// Matr.: __________; ___________
+// vom : __________
+//
+
+int main(void)
+{
+
+ return 0;
+}
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4.c
new file mode 100644
index 0000000..66cef14
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4.c
@@ -0,0 +1,20 @@
+// Lösung zu Termin2
+// Aufgabe 4
+// Namen: __________; ___________
+// Matr.: __________; ___________
+// vom : __________
+//
+
+
+void taste_irq_handler (void) __interrupt__ ((interrupt));
+
+void taste_irq_handler (void)
+{
+
+}
+
+int main(void)
+{
+
+ return 0;
+}
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;
+}
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a1.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a1.c
new file mode 100644
index 0000000..fb99f59
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a1.c
@@ -0,0 +1,68 @@
+// Lösung zu Termin2
+// Aufgabe 4
+// Namen: __________; ___________
+// Matr.: __________; ___________
+// vom : __________
+//
+#include "../mi2/h/pio.h"
+#include "../mi2/h/pmc.h"
+#include "../mi2/h/aic.h"
+
+StructPMC* myPMC = PMC_BASE;
+StructAIC* myAIC = AIC_BASE;
+StructPIO* myPIOB = PIOB_BASE;
+
+void taste_irq_handler (void) __attribute__ ((interrupt));
+
+void taste_irq_handler (void)
+{
+
+ volatile int keyPressed = myPIOB->PIO_ISR;
+
+ if (!(keyPressed & KEY1))
+ myPIOB->PIO_SODR = LED1;
+ //if (!(myPIOB->PIO_PDSR & KEY2))
+ if (!(keyPressed & KEY2))
+ myPIOB->PIO_CODR = LED1;
+
+ myAIC->AIC_EOICR = 0x01; // write something to register
+ // to signal end of Interrupt Service Routine
+}
+
+int main(void)
+{
+ myAIC->AIC_EOICR = myPIOB->PIO_ISR;
+ // disable all interrupt sources of pio
+ myPIOB->PIO_IDR = 0xFFFFFFFF;
+
+
+ // Initialize PIOB
+ myPIOB->PIO_PER = KEY1|KEY2|LED1; // Enable PIO for SW1,SW2,LED1,LED2
+ //myPIOB->PIO_OER = LED1|LED2; // Set LED1 and LED2 as output
+ myPIOB->PIO_OER = LED1; // Set LED1 and LED2 as output
+ myPIOB->PIO_CODR = LED1; // Clear Output Data Register
+
+
+ // Enable Interrupts in CPU
+ // done by OS
+
+ // disable PIOB Interrupt in AIC
+ myAIC->AIC_IDCR = (1<<PIOB_ID);
+ // Enable Interrupt for PIOB in AIC
+ myAIC->AIC_SMR[PIOB_ID] = AIC_SRCTYPE_EXT_LOW_LEVEL; // which register? what to put in it? 0x1 for low
+ myAIC->AIC_SVR[PIOB_ID] = (volatile unsigned int)&taste_irq_handler; // Address of Interrupt handling routine...
+
+ // enable PIOB Interrupt in AIC
+ myAIC->AIC_IECR = (1<<PIOB_ID); // Enable Interrupt for PIOB
+
+ // enable PIOB Interrupt
+ myPIOB->PIO_IER = KEY1|KEY2; // what to put here?
+
+ myPMC->PMC_PCER = (1<<PIOB_ID); // Clock PIO B
+ // loop to infinity
+ while(1)
+ {
+ }
+
+ return 0;
+}
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a2.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a2.c
new file mode 100644
index 0000000..86c839e
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4a2.c
@@ -0,0 +1,67 @@
+// Lösung zu Termin2
+// Aufgabe 4
+// Namen: __________; ___________
+// Matr.: __________; ___________
+// vom : __________
+//
+#include "../mi2/h/pio.h"
+#include "../mi2/h/pmc.h"
+#include "../mi2/h/aic.h"
+
+StructPMC* myPMC = PMC_BASE;
+StructAIC* myAIC = AIC_BASE;
+StructPIO* myPIOB = PIOB_BASE;
+
+void taste_irq_handler (void) __attribute__ ((interrupt));
+
+void taste_irq_handler (void)
+{
+
+ volatile int keyPressed = myPIOB->PIO_ISR;
+
+ if (!(keyPressed & KEY1))
+ myPIOB->PIO_SODR = 0x100;
+ //if (!(myPIOB->PIO_PDSR & KEY2))
+ if (!(keyPressed & KEY2))
+ myPIOB->PIO_CODR = 0x100;
+
+ myAIC->AIC_EOICR = 0x01;
+ // to signal end of Interrupt Service Routine
+}
+
+int main(void)
+{
+ myAIC->AIC_EOICR = myPIOB->PIO_ISR;
+ myPIOB->PIO_IDR = 0xFFFFFFFF;
+
+
+ // 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_OER = LED1; // Set LED1 and LED2 as output
+ myPIOB->PIO_CODR = 0x000000FF; // Clear Output Data Register
+
+
+ // Enable Interrupts in CPU
+ // done by OS
+
+ // disable PIOB Interrupt in AIC
+ myAIC->AIC_IDCR = (1<<PIOB_ID);
+ // Enable Interrupt for PIOB in AIC
+ myAIC->AIC_SMR[PIOB_ID] = AIC_SRCTYPE_EXT_LOW_LEVEL; // which register? what to put in it? 0x1 for low
+ myAIC->AIC_SVR[PIOB_ID] = (volatile unsigned int)&taste_irq_handler; // Address of Interrupt handling routine...
+
+ // enable PIOB Interrupt in AIC
+ myAIC->AIC_IECR = (1<<PIOB_ID); // Enable Interrupt for PIOB
+
+ // enable PIOB Interrupt
+ myPIOB->PIO_IER = KEY1|KEY2; // what to put here?
+
+ myPMC->PMC_PCER = (1<<PIOB_ID); // Clock PIO B
+ // loop to infinity
+ while(1)
+ {
+ }
+
+ return 0;
+}
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c
new file mode 100644
index 0000000..fd850c7
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c
@@ -0,0 +1,37 @@
+#include "init4.h"
+
+void taste_irq_handler (void) __attribute__ ((interrupt));
+
+void taste_irq_handler (void)
+{
+
+}
+
+int main(void)
+{
+ *pmc_PCER = 0x4000; // Enable Peripheral Clock
+
+ *pioB_PER = 0x118; // LED1=0x100; SW1=0x8; SW2=0x10 -> addieren
+
+ *pioB_OER = 0x100; // Enable Output: LED1, WICHTIG: LED1 hier an!
+
+ *aic_SVR = (int)taste_irq_handler;
+ *aic_SMR = 1;
+
+ for ( ; ; )
+ {
+ if (!(*pioB_PDSR & 0x8)) // wenn SW1 dann LED1=ON (! -> low-active)
+ {
+ *pioB_CODR = 0x100; // Clear LED DS1 -> LED = AN
+ *aic_EOICR = 1;
+ }
+
+ if (!(*pioB_PDSR & 0x10)) // wenn SW2 dann LED1=OFF (! -> low-active)
+ {
+ *pioB_SODR = 0x100; // Set LED DS1 -> LED = AUS
+ *aic_EOICR = 1;
+ }
+ }
+
+ return 0;
+} \ No newline at end of file
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/frank_micsys2_praktikum02.zip b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/frank_micsys2_praktikum02.zip
new file mode 100644
index 0000000..3c5845b
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/frank_micsys2_praktikum02.zip
Binary files differ
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/init4.h b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/init4.h
new file mode 100644
index 0000000..89a81b2
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/init4.h
@@ -0,0 +1,64 @@
+#ifndef init4_h
+#define init4_h
+
+
+// fuer AUFGABE 4:
+#define aic_IDCR ((volatile unsigned int*) 0xFFFFF124)
+//Interrupt Disable Command Register
+#define aic_ICCR ((volatile unsigned int*) 0xFFFFF128)
+// Interrupt Clear Command Register
+#define aic_SMR ((volatile unsigned int*) 0xFFFFF038)
+// Source Mode Register !!!nachfragen
+#define aic_SVR ((volatile unsigned int*) 0xFFFFF0B8)
+// Source Vector Register
+#define aic_EOICR ((volatile unsigned int*) 0xFFFFF130)
+// End of Interrupt Command Reg.
+#define aic_IECR ((volatile unsigned int*) 0xFFFFF120)
+// Interrupt Enable Command Register
+
+#define pmc_PCER ((volatile unsigned int*) 0xFFFF4010)
+// Peripheral Clock Enable Reg
+#define pmc_PCSR ((volatile unsigned int*) 0xFFFF4018)
+// Peripheral Clock Status Reg, Reset: 0x0
+
+#define pioB_PER ((volatile unsigned int*) 0xFFFF0000)
+// PIOB Port Enable Reg
+#define pioB_OER ((volatile unsigned int*) 0xFFFF0010)
+// PIOB Output Enable Reg
+#define pioB_SODR ((volatile unsigned int*) 0xFFFF0030)
+// PIOB Set Output Data Reg
+#define pioB_CODR ((volatile unsigned int*) 0xFFFF0034)
+// PIOB Clear Output Data Reg
+#define pioB_PDSR ((volatile unsigned int*) 0xFFFF003C)
+// PIOB PIN Data Status Reg
+
+
+#endif
+
+/*
+#define aic_SMR ((volatile unsigned int*) 0xFFFFF038)
+ // Source Mode Register !!!nachfragen
+#define aic_SVR ((volatile unsigned int*) 0xFFFFF0B8)
+ // Source Vector Register
+*/
+
+//in MAIN->
+//....
+//*aic_SMR = 0x1 //
+/*
+SRCTYPE: Interrupt Source Type
+Program the input to be positive- or negative-edge triggered or positive- or
+negative-level sensitive.
+The active level or edge is not programmable for the internal sources.
+----> hier haben wir den "Level Sensitive: Low-Level Sensitive" 00
+PRIOR: Priority Level
+
+Program the priority level for all sources except source 0 (FIQ).
+The priority level can be between 0 (lowest) and 7 (highest).
+The priority level is not used for the FIQ in the SMR0.
+---> also haben wir die 1
+sprich-> 0x01 -> 0x1;
+*/
+
+//*aic_SVR = (volatile unsigned int) &taste_irq_handler; //im späteren Verlauf der Praktika wird
+//hier eine Interrupt-Routine-FKT kommen, die das weitere Vorgehen veranlast und in "fast" allen SVRs hinein kommt \ No newline at end of file
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/makefile b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/makefile
new file mode 100644
index 0000000..f44a2e7
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/makefile
@@ -0,0 +1,51 @@
+FILE = Termin2Aufgabe1
+Opti = 0
+all:
+
+# Übersetzen der Quelldatei
+ arm-elf-gcc -c -g -O$(Opti) $(FILE).c -I ../h
+
+# Erzeugen der Assemblerdatei aus der Quelldatei
+ arm-elf-gcc -S -o$(Opti) $(FILE).c -I ../h
+
+# Erzeugen der benötitgen Objektdateien
+ arm-elf-gcc -c -g -O$(Opti) ../boot/swi.S -o swi.o -I ../h
+ arm-elf-gcc -c -g -O$(Opti) ../boot/boot_ice.S -o boot_ice.o -I ../h
+ arm-elf-gcc -c -g -O$(Opti) ../boot/boot_flash.S -o boot_flash.o -I ../h
+# arm-elf-gcc -c -g -O$(Opti) seriell.S -I ../h
+# arm-elf-gcc -c -g -O$(Opti) ser_io.S -I ../h
+
+# Binden für die RAM-Version
+# arm-elf-ld -Ttext 0x02000000 -O$(Opti) boot.o swi.o $(FILE).o -o $(FILE).elf /usr/gnutools/lib/gcc-lib/arm-elf/3.3.2/libgcc.a
+ arm-elf-ld -Ttext 0x02000000 -O$(Opti) boot_ice.o swi.o $(FILE).o -o $(FILE).elf
+
+# Linkerskripte noch nicht getestet
+# arm-elf-ld -T ldscript.ram boot.o swi.o seriell.o ser_io.o swi.o $(FILE).o -o $(FILE).elf /gnutools/lib/gcc-lib/arm-elf/3.2.2/libgcc.a
+
+# Binden für die FLASH-Version
+# arm-elf-ld -Ttext 0x1000000 boot.o swi.o $(FILE).o -o $(FILE).out /usr/gnutools/lib/gcc-lib/arm-elf/3.3.2/libgcc.a
+ arm-elf-ld -Ttext 0x1000000 boot_flash.o swi.o $(FILE).o -o $(FILE).out
+
+# Linkerskripte noch nicht getestet
+# arm-elf-ld -T ldscript.rom boot.o seriell.o ser_io.o swi.o $(FILE).o -o $(FILE).out /gnutools/lib/gcc-lib/arm-elf/3.2.2/libgcc.a
+
+# -I --input-target <bfdname> Assume input file is in format <bfdname>
+# -O --output-target <bfdname> Create an output file in format <bfdname>
+# -S --strip-all Remove all symbol and relocation information
+# -x --discard-all Remove all non-global symbols
+# -N --strip-symbol <name> Do not copy symbol <name>
+# -O --output-target <bfdname> Create an output file in format <bfdname>
+# -g --strip-debug Remove all debugging symbols
+ arm-elf-objcopy -I elf32-littlearm -O binary -x -S -N -g $(FILE).out $(FILE).rom
+# programm.rom nach /tftpboot/downlaod.bin kopieren <cp name.rom /tftpboot/download.bin>
+# Jumper E7 muß auf STD stecken
+# Mit <telnet 141.100.xxx.xxx> mit dem BDI2000 verbinden.
+# mit <erase 0x1100000> flash-Bereich löschen
+# mit <prog 0x1100000 download.bin bin> Programm ins flash schreiben.
+#
+#
+clean:
+ rm *.o
+ rm *.s
+ rm *.elf
+ rm *.rom \ No newline at end of file