cancel
Showing results for 
Search instead for 
Did you mean: 

Getting an delay by timer interruption

david.ye
Associate II
Posted on November 13, 2017 at 17:44

Hello Everyone,

I am working on the STM8AL3166 and try to handle a timer interrupt. My need is to wait 500ms and then check again a value (not pooling)

How/Where do I write the program when the interrupt occurs? Where can I find the header file?

I did several hours of searching and can not find anything, Please Help !

Thank,

David

#timer-interrupts #delay
11 REPLIES 11
Posted on November 29, 2017 at 12:37

Hello Vyacheslav,

Just to give an answer, the RIDE7 give a timer for debugging.

Also, to use a timer with STM there is 5steps :

-Enable timer to get the clock with CLK_PCKENR1 register

-Configure the timer by setting prescaler, ARR and IER to enable TIM interrupt

-Enable general interrupt with the function _rim()_; from intrins.h file

-enable the timer by setting the first timer CR1 register to 1

It will go then to the interrupt handler created in function of the vector interrupt table.

Thank for the help.

Kind regards,

David

Posted on November 29, 2017 at 16:25

Hello David,

Unfortunately I do not use Raisonnance tools. And my hopes for using stm8 are not very come true. For a long time, I can not find answers to questions about the behavior of the interrupt system. This can change all my plans and preferences. Although from me, no longer does big business depend, I will not be able to implement my technical solutions and offer them to customers. As for the initialize the CLK_PCKENRx registers, I was considered this as a matter of course.