diff options
Diffstat (limited to 'Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c')
| -rw-r--r-- | Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c | 37 |
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 |
