08-19-2010 07:36 PM
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.
08-19-2010 08:21 PM
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.
08-20-2010 07:32 AM
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.