From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop timing

I started trying to vary the rate at which data is written to a file. I thought a loop would be used for this with a variable delay which worked from a file write perspective, but when I use longer delays, the loop seems to execute but other parts of my UI don’t update anymore. I’ve tried the loop inside and out of the while loop. I was going to include calculations inside the loop to store a new file every 24hours, but I have since discovered the VI already has the functionality in the dialog configuration.

What is the basic thing I’m missing about parallel operation and loops? I have other tasks where I will want to vary a duty cycle on an activity and I’m obviously doing it wrong.

 21942iCA6CF1995AA76D89

 

0 Kudos
Message 1 of 3
(2,275 Views)

The write operation would need to be in the data acquisition while loop.  You can have logic so that the data acquisition while loop times out at 24 hrs...which I think is what you are doing with the N terminal on the for loop.  Additional logic within the data acquisition while loop to write the data several times per hour.   You might also try continuously writing the binary data with the TDMS VIs.

 

Otherwise if you want the write operation outside of the while loop. You could use a Master/Slave pattern (see examples) and either Queues or Notifiers.  But there are a myriad of other ways to skin this cat.

 

 

0 Kudos
Message 2 of 3
(2,267 Views)

What you are missing is that your loops are not parallel.  The wire from the left loop to the right loop causes the right loop to execute after the left loop.  To separate them, as already mentioned, you need to use a producer/consumer architecture.  The easiest way to do this is with a queue.  Look up producer/consumer in the LabVIEW help or on these discussion forums and you will get a plethora of examples.

0 Kudos
Message 3 of 3
(2,249 Views)