QUOTE(baskapteijn @ 3 May, 2009 - 11:32 PM)

Dear reader,
I am a near beginner in c# (visual studio). I've written myself a PWM generator which controlls the parallel port. I can change frequency, dutycycle and stepsize. The problem is as follows:
I'm generating PWM in a while(true) loop in a second threat. This is the only way i know how to generate accurate PWM cycles. The only problem here is that i don't effectively use CPU time(im burning 50% time). I want the following:
/pseudo code on/
tell windows or some eventwatcher that i want to wait X cpu ticks
IF they passed, give an interrupt or jump to some codeloop
(without endlessly waiting and burning cpu cycles)
/pseudo code off/
In fact, system.timer or so has a timer that jumps on every set timertick to a loop. This is exactly what i want but more precisie than 1 ms. I want microsecond accuracy with autojumps to a function after a given time. Can anyone tell me how to do this in code? I will paste my code if you guys want it but this is all there is to it.
Thanks,
Bas Kapteijn
dear writter:
There is no possible way of doing such thing under any windows... I have face this problem my self. I suggest you do it by other means, such as hardware... my solution was interfacing an ATMEGA162 an DAC and C# best of luck!