2009-06-23 01:43 AM
Delay function using Tim
2011-05-17 04:15 AM
Hi,
I'm a Newbie using Cortex-M3 and want to define a delay function using a tim. Do you have a simple example for this issue? I'm stuck here, because I don't know how to signal my delay function, that the timer count up or down is completed. I think setting a variable in the TIMx_IRQHandler() and waiting for this setting in my delay function is not an ideal solution (do you have a better one/example code?)? thans a lot! :D2011-05-17 04:15 AM
W/o any scheduling infrastructure there's not much else to do.
You could code your delay like this, so it uses less power: void delay() { while (!timer_expired) { asm volatile (''wfi''); /* or __WFI(); or whatever equivalent */ } }