Hi,
but we calculate the count by using frequency only
counts of for...while loops is unprecise..
with C you usually don´t know the exact number of clock cycles for a loop (you could do this by a simulator or go through ASM code)
So you have tor try this.
but after every new compilation ths value may vary, it is not stable
... and if there is any interrupt running, or anything else is within the while loop this will influence the timing also
... and the next hardware generation maybe needs less clock cycles than the one before
... then you get the "packman" effect. Do you know about this mature game? Written without interrupts the game speed was dependent of processor speed. If you started the game even with a 386 processor you just saw a flicker in screen and game was over...
********
why not writing 5 lines of code for setting up a timer interrupt that absolute precisely gives you 100ms ticks?
Independent of compiler, of prcessing load, processing power, other interrupts....
Once you used it you will never loose it.
Klaus