|  |   | 
| (74 intermediate revisions by 3 users not shown) | 
| Line 1: | Line 1: | 
| − | [[category:ARM Tutorials]] | + | #REDIRECT [[LPC1768: Led Blinking]] | 
| − | [[User:Amruta|Amruta]] ([[User talk:Amruta|talk]]) 11:24, 17 March 2015 (IST)
 | + |  | 
| − | -----
 | + |  | 
| − |   | + |  | 
| − | =Basics=
 | + |  | 
| − | =Schematic=
 | + |  | 
| − | =Code=
 | + |  | 
| − |   | + |  | 
| − | <syntaxhighlight>
 | + |  | 
| − |   | + |  | 
| − |   | + |  | 
| − | #include "lpc17xx.h"   // NXP Library containing all port abd register definations
 | + |  | 
| − | #include "stdutils.h"  // Explore Embedded library
 | + |  | 
| − |   | + |  | 
| − | #define LED		29	 //P1.29
 | + |  | 
| − | #define SWITCH         28	 //P1.28
 | + |  | 
| − | int main()
 | + |  | 
| − | {
 | + |  | 
| − |         SystemInit();
 | + |  | 
| − |   | + |  | 
| − | 	LPC_PINCON->PINSEL3 = 0x00;			   // Configure Pin as GPIO
 | + |  | 
| − | 	util_BitSet(LPC_GPIO1->FIODIR,LED);	   	   // Set pin direction as output
 | + |  | 
| − | 	util_BitClear (LPC_GPIO1->FIODIR,SWITCH);	   // Set pin direction as input
 | + |  | 
| − |   | + |  | 
| − | 	while(1)
 | + |  | 
| − | 	{		
 | + |  | 
| − | 		if (util_IsBitCleared (LPC_GPIO1->FIOPIN,SWITCH))	// check if switch is pressed
 | + |  | 
| − | 			util_BitSet (LPC_GPIO1->FIOSET,LED);	   // turn on LED	
 | + |  | 
| − | 		else
 | + |  | 
| − | 			util_BitSet (LPC_GPIO1->FIOCLR,LED);	// turn off LED	
 | + |  | 
| − | 	}
 | + |  | 
| − | }
 | + |  |