Skip to content

Instantly share code, notes, and snippets.

@SaheblalBagwan
Last active March 30, 2016 03:57
Show Gist options
  • Save SaheblalBagwan/4e98f20b23fcfdb90fb0996ff492a9f1 to your computer and use it in GitHub Desktop.
Save SaheblalBagwan/4e98f20b23fcfdb90fb0996ff492a9f1 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->FIOSET = 0xffffffff; // Make all the Port pins as high
delay_ms(100);
LPC_GPIO2->FIOCLR = 0xffffffff; // 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