summaryrefslogtreecommitdiffstats
path: root/Bachelor/Mikroprozessorsysteme2/mi2/h/Termin2Aufgabe2.c
diff options
context:
space:
mode:
Diffstat (limited to 'Bachelor/Mikroprozessorsysteme2/mi2/h/Termin2Aufgabe2.c')
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/h/Termin2Aufgabe2.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/h/Termin2Aufgabe2.c b/Bachelor/Mikroprozessorsysteme2/mi2/h/Termin2Aufgabe2.c
new file mode 100644
index 0000000..24171af
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/h/Termin2Aufgabe2.c
@@ -0,0 +1,35 @@
+// Lösung zu Termin2
+// Aufgabe 1
+// von: Manfred Pester
+// vom: 27.07.2003
+//
+
+#define PIOB_PER ((volatile unsigned int *) 0xFFFF0000)
+#define PIOB_OER ((volatile unsigned int *) 0xFFFF0010)
+#define PIOB_SODR ((volatile unsigned int *) 0xFFFF0030)
+#define PIOB_CODR ((volatile unsigned int *) 0xFFFF0034)
+
+#define PMC_SCER ((volatile unsigned int *) 0xFFFF4000)
+#define PMC_SCDR ((volatile unsigned int *) 0xFFFF4004)
+#define PMC_SCSR ((volatile unsigned int *) 0xFFFF4008)
+#define PMC_PCER ((volatile unsigned int *) 0xFFFF4010)
+#define PMC_PCDR ((volatile unsigned int *) 0xFFFF4014)
+#define PMC_PCSR ((volatile unsigned int *) 0xFFFF4018)
+
+
+int main(void)
+{
+
+ *PMC_PCER = 0x4000; // Peripheral Clock für PIOB einschalten
+
+ *PIOB_PER = 0x0100; // Enable Register 8 LED's und Taster an PB3
+ *PIOB_OER = 0x0100; // Output Enable Register 8 LED's sind aus
+
+ while(1)
+ {
+ *PIOB_SODR = 0x0100; // Set Output Data Register LED's sind aus
+ *PIOB_CODR = 0x0100; // Clear Output Data Register LED's leuchten
+ }
+
+ return 0;
+}