LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed loop with daq timing source

Hi,

 

I want to create a timed loop which runs 60 seconds with a frequency higher than 1kHz. A classic while loop doesn't work because it runs to fast or to slow depending on the content of the loop. (Less operations in the loop: array storage is to small, more operations in the loop: Strong dependence on the windows system)

 

I thought about the following (see attachment):

A DAQ timing source is used to create a frequency for the loop. If I just run the loop for 5 seconds instead of 60 it works quite well indeed I'm not sure if the frequency fits. Otherwise the array is not updated despite no error is thrown.

 

Does anybody have an idea how to fix the issue? Or maybe a completely different solution?

 

 

LabView 2016

NI USB-6343

0 Kudos
Message 1 of 2
(2,509 Views)
  • Please don't post code fragments as pictures, but make a VI out of them and attach the VI.  This lets us "experiment with" and study your code without having to "guess" if we've got exactly what you posted.
  • The Timed Loop structure works best (and I think is meant for) LabVIEW Real-Time systems running on a Real-Time OS with guaranteed Time Response.  On a Windows PC, the functions in the Timing Palette are easier to use and make more sense.
  • Having said that, a good way to get accurate loop timing on a PC is to use a hardware device as your "clock".  For example, if you have a DAQ device that you configure to give you 1 sample every millisecond and put that in a While Loop, you can expect that your loop will run at almost exactly 1KHz.

[Note -- I won't be "shocked" to find people who disagree with that last point.  I've not seen this said explicitly, but it seems to work for me in a number of routines I've written].

 

Bob Schor

0 Kudos
Message 2 of 2
(2,464 Views)