LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

delay less than 1 milli second

I wanted a delay for less than 1 milli second is it possible.
0 Kudos
Message 1 of 18
(6,119 Views)
I think widnows OS does not support delays less than 1 mS. Its limitation of OS.
just curious, why do you need delay less than 1 mS? (i.e. no delay :))

Sheetal
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 2 of 18
(6,103 Views)
hey
i dont think its a OS limitation.
i have generated delays of less than 1m using C
0 Kudos
Message 3 of 18
(6,088 Views)
Hi Bhaskar

Please could you share how you achived with the possible code.

Thanks
Murali
0 Kudos
Message 4 of 18
(6,082 Views)
I think it depends on what you need.... that is to say, if you're trying to have, say, a delay of 20 microseconds to implement this way a low-speed bus, it's not a good idea to use delay.....

Anyway, you can use FOR cicles, to generate time delay. The problem, in this case is that the delays you create are architecture-dependent, so you need a routine to measure the delay you create.....

For example, you can put a clock() function call (in the proper way, of course...), at the beginning and at the end of (for example), 1000 calls to a for() cicle you use as unit delay, so you can measure (in a way that is not "metrologically" correct, of course) your unit delay.

example

int measur_time;
*
*
*
measure_time = clock();

for(i=0; i<1000; i++) { //1000 unit delays...
for( n=0; n<100; n++) {
//this is an elementary delay
}
}

measure_time = clock() - measure_time;
0 Kudos
Message 5 of 18
(6,079 Views)
the code in c was done exactly the way Graziano has summed it up.
but im not sure if it will work for labview, would share the code , if am able to get that delay using labview:)
Message 6 of 18
(6,077 Views)
i think the funda of a timed loop may be helpful to implement this in labview.
can be found at the following url, i hope it helps
http://zone.ni.com/devzone/conceptd.nsf/webmain/ACF47016EB2F369D86256E3700560052?opendocument


Bhaskar
0 Kudos
Message 7 of 18
(6,073 Views)
The issue is Windows, not CVI. CVI timer functions use the Windows timers. I believe Sheetal is right: the highest resolution Windows timers are 1 mS. The default timer in Windows 2000 and XP is 10 mS (earlier versions had 55 mS). The multimedia and performance timer resolutions are 1 mS.
For more info, you can search CVI help for useDefaultTimer or click here to learn more from Microsoft. Note: you don't have to call SDK code to use the high resolution timers, CVI does that automatically.
Putting a delay in a for loop can give you a delay of less than 1 mS, but, under Windows multi-tasking, that delay will not be predictable. Depending on what else Windows is doing at the time, the execution time of a for loop delay can vary greatly.
Message 8 of 18
(6,067 Views)
Dear All

Actually my problem is

I have a digital channel which i have to use for generating a PWM signal of 500Hz,variying duty cycle.

for example
1/500 = 2 milliseconds if i take 10%Dutycycle i have to have to the channel ON for 0.2 milliseconds and OFF for 1.8 milliseconds

so how do i acheive this.


Thanks
Murali
0 Kudos
Message 9 of 18
(6,057 Views)
You are far from the solution, if you use delays....

What you should do is take a look at the example shipping with LabWindows:

< your NI folder... > \samples\DAQmx\Digital\Generate Values\Write Digital Channel

Anyway, you should become familiar withcreating tasks, assigning sampling rate, and so on...

Hope it helps!

Bye
Message 10 of 18
(5,712 Views)