On Thu, Dec 2, 2010 at 3:47 PM, <arcarlini at iee.org> wrote:
He wouldn't believe that the FORTRAN compiler had
helpfully turned the
loop into a simple assignment until I showed him exactly what it had done in
the listing file.
I've done that "slowdown" trick in embedded code and had it optimized
down to a simple assignment. I've found that rather than tweak the
compilier, tweaking the code this much...
for (i=0; i < 100; i++) {
a=i;
}
(i.e. - putting something active in the loop)
... was enough to leave the loop in and generate a few cycles for the
delay. If I'm in an environment where C and assembler are mixed (not
uncommon with microcontroller programming), a #asm/NOP construct
works, too.
-ethan