Program which demonstrates the usage of the IOCONFIG & GPIO peripherals. Program only blinks the LED based on 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

main.c

Committer:
71GA
Date:
2015-05-02
Revision:
0:2636b9dea739

File content as of revision 0:2636b9dea739:

#include "LPC4088-ioconfig.h"
#include "LPC4088-system.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);
    
    //vklop GPIO periferije (nepotrebno)
    PCONP = PCONP | (1<<15);    

    //nastavitev P1.13 kot output
    DIR1 = DIR1 | (1<<13);
    
    //nastavitev P1.13 maske
    MASK1 = MASK1 & !(1<<13);
    
    while(1){

        //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 = 10000000;
    while(stej){
        stej = stej - 1;
    }
}