Skip to content

Instantly share code, notes, and snippets.

@SaheblalBagwan
Created March 30, 2016 04:04
Show Gist options
  • Save SaheblalBagwan/fb344d26c0022cb00b8946efbd8223d4 to your computer and use it in GitHub Desktop.
Save SaheblalBagwan/fb344d26c0022cb00b8946efbd8223d4 to your computer and use it in GitHub Desktop.
#include <lpc17xx.h>
void delay_ms(unsigned int ms)
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<20000;j++);
}
/* start the main program */
int main()
{
SystemInit(); //Clock and PLL configuration
LPC_PINCON->PINSEL4 = 0x000000; //Configure the PORT2 Pins as GPIO;
LPC_GPIO2->FIODIR = 0xffffffff; //Configure the PORT2 pins as OUTPUT;
while(1)
{
LPC_GPIO2->FIOPIN = 0xffffffff; // Make all the Port pins as high
delay_ms(100);
LPC_GPIO2->FIOPIN = 0x00; // Make all the Port pins as low
delay_ms(100);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment