Timeline for STM32F103 simple countdown timer (with no interrupts)
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 1, 2015 at 11:35 | answer | added | Multisync | timeline score: 1 | |
Sep 2, 2014 at 11:10 | vote | accept | Jon Mills | ||
Aug 8, 2014 at 9:21 | vote | accept | Jon Mills | ||
Sep 2, 2014 at 11:10 | |||||
Aug 6, 2014 at 11:31 | comment | added | Tut | If you don't get a good answer here, you might try the STM32 Forum. There are some good experts over there. | |
Aug 6, 2014 at 11:15 | answer | added | Jon Mills | timeline score: 2 | |
Aug 6, 2014 at 11:09 | comment | added | Jon Mills | I've initially implemented it as a busy loop, but I'd like to have more accuracy, so I wanted to implement it using a timer. I have got it working, so I'll add my solution as the answer, although someone may have a better solution. | |
Aug 6, 2014 at 10:48 | comment | added | JimmyB |
Why use a timer then? What about the good old busy loop to delay for some time? Even less complex/risky. - How fast should your timer tick? Can it be slowed down so that you will never miss a tick? Or can you check the underflow, like if (timer == 0 || timer > START_VALUE) { ...} ?
|
|
Aug 6, 2014 at 8:45 | comment | added | Jon Mills | This is a piece of code that I'm running at startup, and I want it to be as "safe" as possible - check a pin for a period and then carry on, or go back to sleep. I'd rather not use an interrupt for this as it adds complexity and "risk". I'd just like the counter to start from a value, count down to zero and then stop (without reloading). I've done this sort of thing on other micros before. The STM timers are very powerful - sometimes that's great, but in this case, I'm finding it hard to make them do something very simple. Thx. | |
Aug 6, 2014 at 8:39 | comment | added | user17592 | Why exactly don't you want to use an interrupt? It would be great to use an interrupt to have the timer stop at 0 - otherwise the other code in the while loop may be so long that he doesn't check while the timer is at 0 and then it proceeded to 255 already. | |
Aug 6, 2014 at 8:09 | review | First posts | |||
Aug 6, 2014 at 8:40 | |||||
Aug 6, 2014 at 8:09 | history | asked | Jon Mills | CC BY-SA 3.0 |