We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello all,
I am looking to create a software timer that does not use any of the timers supplied in the LPC1342 microcontroller. I am thinking of reading a ram, rom, or flash location a number of times in order to make up a specific time period (i.e. using the access time of these devices). Has anyone achieved this under the ARM/Thumb2 environment programmed in C?
Regards
Barry
Never tried, but you probably want to use assembly code for this purpose - not C (also for the sake of maintainability). Also, you are forced to use polling, yes?
Sorry, but dumb.
Extremely short delays - use n NOP instruction or similar. Use asm file since optimier plays with inline assembler.
For longer delays you can let a timer irq update a counter that you poll. Or poll a freerunning timer.
Per Westermark! You stole my reply :-) The exact same timestamp is no excuse :-)
Pah!
If you're seriously considering writing a delay like that then I say:
Use a bl**dy egg timer like everyone else!
Don't even think about doing this in any High-Level Language!
Precise instruction timing requires precise control of the specific instructions being executed - which is precisely what you lose when you use an HLL!!
See: www.8052.com/.../162556 (not all 8052-specific)
"Don't even think about doing this in any High-Level Language!"
For a detailed treatise on why not (specifically in 'C'), see: blog.regehr.org/.../28