LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time loop with faster update time then 1khz with software, possible?

Hello,
I have a question about time loop, is it possible to update faster than 1khz without additional HW?
I have only worked with Labview for a month. I’m trying to do a program with several parallel loops (While loop) and one of the loops is time critical. I have tried to read as many posts about this as possible, but not found any answer. If I must add HW can somebody give me a proposal of a NI-card that I could use? I don’t need any expensive card, I just want use the card so I can update time loops, within timing rates at 10-30Khz.
0 Kudos
Message 1 of 10
(4,689 Views)
Hi.

The only way to have a software-timed loop execute faster than 1kHz is to include code in it which will take precisely the time you need to execute, which is very very hard to determine. So, it seems like you would need LabVIEW RT to be able to use the 20MHz computer clock, or some extra hardware.

I once controlled the iteration time of a while loop by doing an analog input task and using the DAQmx Read VI inside the loop set to the correct number of samples to read at a time.

For example, if you set an analog input task to sample at 10,000 samples per second, and then you put the DAQmx Read VI inside the loop, set to read 100 samples at a time, then the loop executes every 10ms (which you could have achieved without the hardware, but is still an illustrating point).

So, if you want a loop to run at 20kHz, you might be able to achieve it by configuring an acquisition at say, 60,000 samples per second, and read 3 samples at a time with each iteration of the loop.

You must be aware though, that usually when you do such an acquisition, you read a lot more samples at a time, precisely to avoid having to execute the loop so often. Therefore, there is still a possibility that the computer might not be able to keep up at such speeds. You can test this method.

I am attaching an image with sample code of what I mean.

I think the cheapest DAQ board NI has is the PCI-6023E, which should work for this application.

Hope this helps.

Alejandro
0 Kudos
Message 2 of 10
(4,640 Views)
There is no way to do this reliably and deterministically on an OS such as windows. You need to go to LabVIEW RT or LabVIEW FPGA, depending on your timing requirements.
0 Kudos
Message 3 of 10
(4,632 Views)
good point, you'll beat your head against a wall trying to get any desktop OS to be deterministic below 1 mS, and honsetly 1 mS is a stretch given how much happens behind the scenes of a modern desktop OS. IF you are doing it on windows, you'll want to turn off all unnecesary services etc.


Sheldon
Technical geek, engineer, research scientist, biodegradable...
0 Kudos
Message 4 of 10
(4,619 Views)
Hi,
Tanks for all the info, now I understand. I have tested with an external NI-Card to clock a time loop. And my application works now good. Thanks!
0 Kudos
Message 5 of 10
(4,588 Views)

Thanks for letting me know, we will keep you updated 🙂

 

Rich

0 Kudos
Message 6 of 10
(4,109 Views)

Rich:

 

You post was very non-deterministic, maybe you should use RealTime 🙂

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 7 of 10
(4,100 Views)

Haha....looks like I had a special moment yesterday, as you can probably tell I posted on the wrong thread! Apologies.

 

Rich

Message 8 of 10
(4,077 Views)

Using a hardware timed, Timed Loop, I was able to achieve 2KHz deterministically over about an hour with no problems. I would not use it life was threatened if it failed but for acquiring data its OK.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 10
(4,068 Views)

Dear Ben , could u please share the code and connection diagram ?   I have a similar problem and needs to go < 1 ms , i.e 2 khz timed loop

 , i am using NI PCI 6229 and E series 6025, \looking fwd and really appreciate ur reply in adavance. 

regards

0 Kudos
Message 10 of 10
(3,488 Views)