LED Blinking LPC21xx / 32-bit

As shown in the schematic above 8 LEDs are connected to PORT1 pin number 16 to 23. 

Here comes the C Receipe (available to download at the end of page, below is an image)

 

Step by Step explanation of the above receipe... 

Line 1 : All register definitions, mapping to corresponding memory addresses are done in this header file, its a standard header source, it is added to the include path at the time of installing Keil MDK. 

Line 3-12 : Its a 1 second delay function, used to generate processor delay using inbuilt Timer0 processing. As of now you can skip the actual working of this functional abstraction. I will explain the working of Timers and also of this functional abstraction in the timer section. 

Line 16 : Instruction IODIR1 = 0x00FF0000 instructs the CPU that the current application will be using pin number 16 to 23 as generel purpose DIGITAL OUTPUT pin (IODIR => Input Output Direction Register). 

Line 18 : Instruction IOSET1 = 0x00FF0000 instructs the CPU to write a Digital HIGH logic on pin number 16 to 23 of PORT1. (IOSET => Input Output Port SET Register). 

Line 20 : Instruction IOCLR1 = 0x00FF0000 instructs the CPU to write a Digital LOW logic on pin number 16 to 23 of PORT1. (IOCLR => Input Output Port CLEAR Register). 

Overall above program blinks LEDs connected to PORT1 pin 16-23 at a rate defined by argument in function call delay_sec(integer argument). 

Comments

Popular Posts