Is there any way to make Mathematica stop for some miliseconds?
I know about the
Pause but it seems it only works with seconds.
The short answer is: no, Mathematica is simply not suitable for time-critical applications.
There are several reasons for this:
Mathematica is a slow interpreted language and the time taken by various operations can be close to your threshold of milliseconds
Mathematica's time measurement functions are simply not precise, as the underlying system calls it uses are not meant for precision applications.
$TimeUnit: this variable is supposed to give the granularity of both
Pause and time measurement functions such as
Timing. One thing to be aware here is that its value varies between operating systems (I get 1/100 on OS X and 1/1000 on Windows). Another is that it is simply not precise or reliable. For example, on Windows XP with Mathematica 8 it returns 1/1000. However the true granularity on Windows XP is 15 milliseconds, i.e. 15/1000. (On Vista and later the same system function Mathematica uses really does have a granularity of 1 ms.) On OS X / Mathematica 9, the true granularity seems to be 1 ms even though
$TimeUnit is 1/100.