guide lines for writing a data acq app

Where can I look for guide lines to write an app that makes i/o calls to
acquire data every 10 ms, with at least 1 ms accuracy. That is, I cannot call
win32 Sleep(10) in a loop and expect this to give an accurate 100 HZ sample rate.

thanks,

I’d get a measurement card / instrument that has a settable sample rate & drain its sample buffer as much as needed.  You can try to get windows to schedule tasks at precise intervals, but it’s not a real-time OS.  Inevitably, you’ll get sample jitter.

----- Original Message -----
From: xxxxx@yahoo.com
To: “Windows System Software Devs Interest List”
Sent: Tuesday, September 14, 2010 3:21:36 PM
Subject: [ntdev] guide lines for writing a data acq app

Where can I look for guide lines to write an app that makes i/o calls to
acquire data every 10 ms, with at least 1 ms accuracy. That is, I cannot call
win32 Sleep(10) in a loop and expect this to give an accurate 100 HZ sample rate.

thanks,


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thank you John. Your solution will be pretty fool proof. But all I need is a proof of concetp app.
I hadn’t tried win32 Sleep() for a long time. I just wrote a simple app
like

do
{
Sleep(delayms);
GetSystemTime(&st);
printf(" ms delay is %d %d, %d, %d, \n", delayms, st.wMinute, st.wSecond, st.wMilliseconds);
}
while(loop–);

and now, on an i5 core machine with win7, I get good 1 ms accuracy in my app.
In the past, Sleep() would sleep at least 10 to 25 ms, but now it seems to honor a 1 ms accuracy.

thanks,

xxxxx@yahoo.com wrote:

Thank you John. Your solution will be pretty fool proof. But all I need is a proof of concetp app.
I hadn’t tried win32 Sleep() for a long time. I just wrote a simple app
like

do
{
Sleep(delayms);
GetSystemTime(&st);
printf(" ms delay is %d %d, %d, %d, \n", delayms, st.wMinute, st.wSecond, st.wMilliseconds);
}
while(loop–);

and now, on an i5 core machine with win7, I get good 1 ms accuracy in my app.
In the past, Sleep() would sleep at least 10 to 25 ms, but now it seems to honor a 1 ms accuracy.

You must have had a multimedia app in the background, like Media Player
or iTunes. Those applications modify the clock interrupt rate. That
results in higher accuracy, but also much higher system overhead. A
stock system has latency in the 10-20ms range.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

>and now, on an i5 core machine with win7, I get good 1 ms accuracy in my app. In the past, >Sleep() would sleep at least 10 to 25 ms, but now it seems to honor a 1 ms accuracy.
Try to run in parallel any application which doing a large number of I/O operations, for example disk I/O. I am curious if you could get the same number.

Igor Sharovar

> Where can I look for guide lines to write an app that makes i/o calls to

acquire data every 10 ms, with at least 1 ms accuracy.

Write the full realtime wrapper around the Windows kernel (with hooks to IDT etc), and write your code inside this wrapper.

Or - purchase some existing solution to make Windows realtime.

Windows is not a realtime OS, and what you ask for just cannot be achieved by other means.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com