From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../mi2/Termin2/Termin2Aufgabe4b.c | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c (limited to 'Bachelor/Mikroprozessorsysteme2/mi2/Termin2/Termin2Aufgabe4b.c') 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 -- cgit v1.2.3