LED blinking using LPC1768
LED blinking using LPC1768:
code:
code:
#include
<LPC17xx.h>
int main( void
)
{
int i, n=10000000;
SystemInit(); // System initialization
SystemCoreClockUpdate(); //
Clock initialization
//
Function Selection as GPIO
LPC_PINCON->PINSEL4 =
0X00000000; // PORT 2, 12th bit as zero,
P2.12 as GPIO
// set Direction of 12th
pin as output by passing 1
LPC_GPIO2->FIODIR = 0x1000;
while( 1 )
{
LPC_GPIO2->FIOCLR = 0X1000;
// 1 Turn on LED
for( i = 0; i
< n; i++ ); //
delay
LPC_GPIO2->FIOSET = 0X1000; // 1
Turn OFF LED
for( i = 0; i
< n; i++ ); // delay
}
}
Comments
Post a Comment