Program which demonstrates the usage of the IOCONFIG & GPIO peripherals. Program only blinks the LED based on the push of the button embedded on the LPC4088 QSB. Blinking is done using the primitive delay function which only makes microprocessor busy for some time. Source code is split - we keep register definitions in header files away from the main source file.

Dependencies:   mbed

Revision:
0:f527456a69f2
Child:
1:6eac03db3e22
diff -r 000000000000 -r f527456a69f2 main.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.c	Sat May 02 17:21:33 2015 +0000
@@ -0,0 +1,56 @@
+#include "LPC4088-ioconfig.h"
+#include "LPC4088-gpio.h"
+
+void delay(void);
+
+int main(){
+
+
+    
+    //nastavitev P1.13 kot GPIO, no pull-up, no hysteresis, not inverted, standard, push-pull
+    IOCON_P1_13 = IOCON_P1_13 & !(0x67F);
+    
+    //nastavitev P1.13 kot output
+    DIR1 = DIR1 | (1<<13);
+    
+    //nastavitev P1.13 maske
+    MASK1 = MASK1 & !(1<<13);
+
+    
+    
+    //nastavitev P2.10 kot GPIO, pull-down, no hysteresis, not inverted, standard, push-pull
+    IOCON_P2_10 = IOCON_P2_10 & !(0x67F);
+    
+    //nastavitev P2.10 kot input
+    DIR2 = DIR2 & !(1<<10);
+    
+    //nastavitev P2.10 maske
+    MASK2 = MASK2 & !(1<<10);
+    
+    
+    while(1){
+        
+        //preverimo, ce je tipka prizgana
+        if((PIN2 & (1<<10)) == (1<<10)){
+            
+            //prizgemo P1.13 preko celotnega porta
+            PIN1 = PIN1 | (1<<13);
+        
+            delay();
+
+            //prizgemo P1.13 preko celotnega porta
+            PIN1 = PIN1 & !(1<<13);
+        
+            delay();
+        
+        }
+    }
+}
+
+
+void delay(void){
+    volatile int stej = 1000000;
+    while(stej){
+        stej = stej - 1;
+    }
+}
\ No newline at end of file