Sunteți pe pagina 1din 4

In depth LED Blink with NXP LPC17xx | zembedded

http://www.zembedded.com/in-depth-led-blink-with-...

Latest Technology

Latest Gadgets

AVR Projects

Sensors

C pit falls

About Us

HOME

CONTROLLERS

EMBEDDED C

EMBED TOOLS

EMBED INTERFACE

RTOS

LINUX

Search

Home 2013 March 05 In depth LED Blink with NXP LPC17xx

Recent Post

In depth LED Blink with NXP LPC17xx


ON: MARCH 5, 2013, BY: ADMIN, IN: ARM MICROCONTROLLERS, 2 COMMENTS

Intel Galileo : Compatible with Arduino software and shields


When every one is gaga on PI, Intel introducing th... more

This is going to be a very interesting tutorial for us, as being an embedded developer we all start training with LED Share blinking, or in other words Hello Word. In this tutorial we are going to discuss in depth LED blink with NXP LPC17xx controller. I assume that you are well aware of embedded C and knowledge of microcontrollers. #include LPC17xx.h This file is common for all 17xx series controllers. In this header file, interrupts, GPIO pins, protocols definitions and the memory mappings are done here. volatileuint32_t msTicks; volatile tells the compiler not to optimize anything that has to do with the volatile variable. The main and only reason is, when we are interfacing with hardware, and then we need to use volatile keyword. uint32_t is coming from the following line. typedef unsigned long uint32_t ; If you are coming from C, then you dont need any introduction about typedef. If not, typedef is a keyword in Cwhich is used to assign alias name for any existing data type. /* SysTick_Handler **/ void SysTick_Handler(void) { msTicks++; } 1. Here we have External Interrupts and Internal Interrupts(system interrupts). For the systeminterrupts, there are already a set of handler functions also defined in our libraries. Here, SysTick_Handler is the handler function for one of the internal interrupt. 2. So, the next question is when it will be called???? Well, when you configure the systick timer, then for every reload buffer overwritten, it causes aninterrupt, thenthe handler function SysTick_Handler will be called. 3. So, if you want to see from where these handlers are getting called by interrupts?? Then go and open your startup_LPC17xx.h header file. If you observe the vector table address mapping, thereyou will find the system interrupts and external interrupts.

Thermocouple A temperature sensor


Hi Friends, first and foremost sorry for my absent... more

Whats a Compiler and Compilation?


What's a Compiler and Compilation? A compiler i... more

AVR LCD interfacing : LCD part I


Hi Guys this is my first tutorial on zemebdded sit... more

Arduino MEGA and LEONARDO Pin-Out Diagrams!


Hi Friends please check out these inspiring Ardu... more

ARM : Example Setting PLL for LPC2148


Hi friends this is Partha, this is my second tutor... more

Cortex-M3: Operation Modes & Access Levels


Thanks for the response you guys have shown in ear... more

CORTEX -M3 : Registers in depth


Thanks for the overwhelm response you show in our ... more

An intro to Cortex M3 by NXP


In this series of tutorials we take a look into th... more

In depth LED Blink with NXP LPC17xx


This is going to be a very interesting tutorial fo... more

/* System Delay **/ __INLINE static void Delay (uint32_t dlyTicks) { 8051 Microcontroller (3) Android Tutorials (3) Categories

1 de 4

17/10/13 02:26

In depth LED Blink with NXP LPC17xx | zembedded


uint32_tcurTicks; curTicks = msTicks; while ((msTicks curTicks) <dlyTicks); }

http://www.zembedded.com/in-depth-led-blink-with-...

ARM Microcontrollers (16) AVR Microcontrollers (15) AVR Projects (3) C pit falls (1) Embed Interface (6) Embed Tools (7) Embedded C (16) Latest Gadgets (12) Latest Technology (46) Linux (3) PIC microcontrollers (2) RTOS (3) Scholars Tips (3) Sensors (1)

This function gives the required delay for us. For every 1 msec, the global variable msTicks will get increments inSysTick_Handler function, so, until the required time gets over, the control will be in while loop which is inDelay function. /* configure LED pins **/ __INLINE static void LED_Config(void) { LPC_GPIO1->FIODIR = 0xB0000000; /* LEDs PORT1 are Output */
Share

Here, LPC_GPIO1 is a macro. The declaration is in LPC17xx.h header file. This macro consists of address location which is base address to the port 1. So, by using this structure base address, we can access port direction register, set register, clear registers. All these structures are defined in the same LPC17xx.h header file. /* Switch on LEDs **/ __INLINE static void LED_On (uint32_t led) { LPC_GPIO1->FIOPIN |= (led); /* Turn On LED */ } As we discuss in the above paragraph, FIOPIN is a structure member which is used to read the output. led is the pin number which is connected to LED. Here, when you receive the pin number, due to ORing operation that pin gets high which results the LED makes glow. /* Switch off LEDs **/ __INLINE static void LED_Off (uint32_t led) { LPC_GPIO1->FIOPIN &= ~(led); /* Turn Off LED */ } As I said above, when the function receive the pin number, that particular pin become low, so the LED will go off. To go to next page click here

Recent Posts Intel Galileo : Compatible with Arduino software and shields OCTOBER 4, 2013 Thermocouple A temperature sensor
SEPTEMBER 29, 2013

Whats a Compiler and Compilation? JUNE 2, 2013 AVR LCD interfacing : LCD part I MAY 7, 2013 Arduino MEGA and LEONARDO Pin-Out Diagrams! APRIL 10, 2013 CORTEX -M3 : Registers in depth MARCH 20, 2013 Pointers In C FEBRUARY 28, 2013 COMPLEX STRUCTURE DEFINITIONS
FEBRUARY 21, 2013

Subscribe to Blog via Email Enter your email address to subscribe to this blog and receive notifications of new posts by email. Join 46 other subscribers

Related posts:

Email Address Subscribe

GPIO ports in ARM

LED Backlight Technology

Cortex M3 SysTick Explained Part-I

An intro to Cortex M3 by NXP

Next page

Share this post:

Tweet

Like

39

2 de 4

17/10/13 02:26

In depth LED Blink with NXP LPC17xx | zembedded

http://www.zembedded.com/in-depth-led-blink-with-...

About author
This article was written by admin Admin has over twenty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles. Working presently as Development Manager in India. A firm Believer in Knowledge grows when it shared.

Related Posts
Intel Galileo : Compatible with Arduino software and shields - October 4, 2013 ARM : Example Setting PLL for LPC2148 - April 4, 2013 Cortex-M3: Operation Modes & Access Levels - March 22, 2013 CORTEX -M3 : Registers in depth - March 20, 2013 An intro to Cortex M3 by NXP - March 9, 2013
Share

Cortex M3 SysTick Explained Part II - February 26, 2013 Cortex M3 SysTick Explained Part-I - February 5, 2013 NXP offers emWin free with ARM Microcontrollers - February 3, 2013 ARM Memory Mapping - February 3, 2013 ARM Interfacing and initialization of SDRAM - December 26, 2012

Comments
tarik says - POSTED: MARCH 16, 2013

Comments (2)

hello, what do you advise me,lpcxpresso board or arduino board to begin with embedded systems and are lpcxpresso an open source hard and soft, because i want to use them free thanks Reply

jalaja says - POSTED: JULY 19, 2013


Need more information on this.. Reply

Leave a Reply

La conexin fue restablecida


La conexin con el servidor fue restablecida mientras se cargaba la pgina.
El sitio puede no estar disponible temporariamente o estar sobrecargado. Intente nuevamente en unos momentos.

3 de 4

17/10/13 02:26

In depth LED Blink with NXP LPC17xx | zembedded

http://www.zembedded.com/in-depth-led-blink-with-...

RECENT POST
Intel Galileo : Compatible with Arduino software and shields October 4, 2013 Thermocouple A temperature sensor September 29, 2013 Whats a Compiler and Compilation? June 2, 2013 AVR LCD interfacing : LCD part I May 7, 2013 Arduino MEGA and LEONARDO Pin-Out Diagrams! April 10, 2013 ARM : Example Setting PLL for LPC2148 April 4, 2013 Cortex-M3: Operation Modes & Access Levels March 22, 2013 CORTEX -M3 : Registers in depth March 20, 2013

RECENT COMMENTS
nethra on COMPLEX STRUCTURE DEFINITIONS jal on Thermocouple A temperature sensor nethra on Thermocouple A temperature sensor nethra on CORTEX -M3 : Registers in depth ankush on ARM : Example Setting PLL for LPC2148 ankush on ARM : Example Setting PLL for LPC2148

DISCLAIMERS AND NOTICES www.zembedded.com do not take any responsibility to the contents added in this site. we just search and collect data from popular article directories and use search engine to collect the best information for you. We really strict about copyright but however, if you feel that any of these contents are violating the copyright rules, please let us know. we will exclude it as soon as possible. Please contact us with your exact grievance/problem with respect to those third party links. We assure you that appropriate action will be taken immediately. Thanks Email: admin@zembedded.com

ZEMBEDDED Zembedded
Me gusta A 1015 personas les gusta Zembedded.

Plug-in social de Facebook

- Facebook Members WordPress Plugin

Share

Copyrightzembedded.com

Back to top

4 de 4

17/10/13 02:26

S-ar putea să vă placă și