|
From: Per W. <pw...@ia...> - 2006-09-22 07:15:42
|
I don't know what problem yuor are trying to solve, so I don't know how important the delay time is. However, there are no normal delay available that will allow you to generate a 2.5ms delay. In most operating systems, the delay functions only take a parameter sepcifying the shortest allowed delay. They never guarantee that the appliaction will be waked up immediately at the end of the delay. If that is a necessity, you either have to use a RTOS, or you have to write a hardware driver that will interface directly with the hardware. Even if you use one of the existing sleep functions, and specify a 3 ms delay, you might get a delay of one or more time slizes - normally 16 or 32 ms. It is possible to measure time very exactly using the performane timers available. These can - together with a busy loop - be used to implement short sleeps of reasonably high precision. However, it can not be guaranteed that the application isn't preempted, even if it runs at a very high priority. There are also a couple of multimedia functions available that works with reasonably high-resolution timing. /Per W On Fri, 22 Sep 2006, [UTF-8] Eren Ezg=C3=BC wrote: > i need to make time delays of 0.5 ms precision. for example i need to del= ay > 2.5 ms. i can delay 1 ms precision with sleep and clock functions but tha= ts > not enough for me. if there's a way of dividing a ms to two parts that wo= uld > be fine. > > how can i do this? > > -- > www.cprogramlama.net > |