cancel
Showing results for 
Search instead for 
Did you mean: 

need to have time separate from main loop_stm32f407

mohamad_armoon
Associate III
Posted on September 19, 2014 at 15:30

hi every body 

in my program i need to do somethings in specific time , this ''time'' is not equal all the time.

for example for doing first job i need to do it 5 sec after a flag become set. and after that i need to make it zero and after that doing second  job when this timer is more than 3sec

this timer has not stop ever . it has to count separately from the any other part of cpu.

and it should be as much accurate as counting milisecond.

note in this case i cant use Systick because i using it for something else.

thanks in advance 
4 REPLIES 4
Posted on September 19, 2014 at 17:09

And why can't you use an RTOS, or schedule it with the SysTick, or another timer? All the clocks here are synchronous, and clocking at sub-microsecond granularity.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mohamad_armoon
Associate III
Posted on September 19, 2014 at 18:41

i know it would be ok if i use RTOS , but i don't know any thing about RTOS, and somehow i fear of ROTS because the lack of knowledge. i don't know how should i compile my code beside RTOS .

as much as i go deep on my code i feeling  lack of threads. if it was in computer i just used threads , semaphore and ..... i know that these problems has solved by RTOS. but i don't know about them
Andrew Neil
Evangelist III
Posted on September 19, 2014 at 21:40

''i don't know any thing about RTOS''

Time to start learning, then...?!

Or just do it on a timer - as clive1 also suggested...
Andrew Neil
Evangelist III
Posted on September 19, 2014 at 21:44

''i cant use Systick because i using it for something else''

But one of the key applications of SysTick is as the timebase for the entire system - so perhaps you have a poor design if this one use of SysTick precludes all else?

Anyhow, other timers are also available...