Skip to content

Instantly share code, notes, and snippets.

@SaheblalBagwan
Created March 20, 2016 11:33
Show Gist options
  • Save SaheblalBagwan/f8d0d23dc5ad283f9e46 to your computer and use it in GitHub Desktop.
Save SaheblalBagwan/f8d0d23dc5ad283f9e46 to your computer and use it in GitHub Desktop.
#include <lpc17xx.h>
void delay(unsigned int count)
{
unsigned int i,j;
for(i=0;i<count;i++)
{
for(j=0;j<5000;j++);
}
}
/* start the main program */
void main()
{
SystemInit(); //Clock and PLL configuration
LPC_PINCON->PINSEL4 = 0x000000; //Configure the Pins for GPIO;
LPC_GPIO2->FIODIR = 0xffffffff; //Configure the PORT pins as OUTPUT;
while(1)
{
/* Turn ON all the leds and wait for one second */
LPC_GPIO2->FIOPIN = 0xffffffff; // Make all the Port pins as high
delay(1000);
/* Turn OFF all the LEDs and wait for one second */
LPC_GPIO2->FIOPIN = 0x00; // Make all the Port pins as low
delay(1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment