summaryrefslogtreecommitdiffstats
path: root/Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c
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/Termin2Aufgabe4b.c
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c')
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c37
1 files changed, 37 insertions, 0 deletions
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