cancel
Showing results for 
Search instead for 
Did you mean: 

help understanding simple timer and led blink app

tre2020067
Associate II
Posted on September 11, 2011 at 05:01

The original post was too long to process during our migration. Please click on the attachment to read the original post.
3 REPLIES 3
munk2k
Associate II
Posted on September 11, 2011 at 11:52

1. how is the timer configured to work with specific pins.

Its not as such, its just configure to run ''void Timer1IntrHandler (void)'' every-time its event is triggered, you will need to look into the function called within this function to see what its doing to the LED's

2. how does this app keep looping if there is a empty while(1) at the end?

It will keep looping within the while(1) forever but when the timer event is triggered it will ''jump'' out of the loop to execute the code from within the time handler function then once finished it will jump back into the while.

3. why does only PE.6 flash and PE.5 solid?

Again look inside the function being called by the timer function

4.how does the timer cause an interrupt?

 

Erm...its an interrupt timer?? don't really know how to explain this one simpler..

Perhaps you should play around with Systick first as its much easier to understand.

Darren.

tre2020067
Associate II
Posted on September 12, 2011 at 01:04

thanks!!!

Andrew Neil
Evangelist III
Posted on September 12, 2011 at 08:28

''how does this app keep looping if there is a empty while(1) at the end?''

This is fundamental to the concept of interrupts in any processor (not just STM32):

An interrupt, as the name suggests, interrupts the current flow of execution to execute its ''handler'' or ''service routine'' (aka ''Interrupt Service Routine'', or ''ISR'' for short).

Once the ISR is complete, normal execution resumes from the point at which it was interrupted...

In your case, ''the current flow of execution'' is the empty 'while' loop.

http://en.wikipedia.org/wiki/Interrupt

http://en.wikipedia.org/wiki/Interrupt_handler

Keil has a useful booklist here:

http://www.keil.com/books

 - they aren't (all) specific to Keil...