views:

250

answers:

2

I am trying to run the following pseudocode at a rate of 10 microseconds or faster on a host computer (512 mb RAM, Intel 2.5 GHz Pentium 4 processor, etc.) running on a Windows XP operating system:

int main(void)
{
    while(1){};
}

Interrupt service routine:
every 10 microseconds, printf("Hello World");

I'm aware that there are MFC timers, but they are not functional if the timers need to trigger faster than 1 ms. What would be the easiest method to accomplish what the goals of my pseudocode? Thanks in advance.

A: 

Ignore this - I mis-read micro as milli in the question Sorry:

As you say you are on Windows, the MultiMedia Timer is the way to go.

Or the newer TimerQueue TimerQueue

You may be able to get 1ms resolution, depending on your hardware.

Good Luck

sdg
It may help for other readers if you delete this post.
stanigator
+1  A: 

I'm not sure you can get that kind of performance out of Windows XP, at least not reliably from userland. You might have to run your code as a kernel driver, or better yet investigate using a real-time OS like Xenomai instead.

Jeremy Friesner