08-14-2014 03:37 AM
Hello,
i have three measurement-vis running parallel in a loop
The three results are continuously saved in global-array and also in a text-file.
The global-arrays has always all data but in the text-file is some data missing.
I think this is because the file is locked from one vi while the other vi wants to write his data.
What can i do here?
Something like writing data in a queue and another vi reads the queue and writes the file?
Or is there something like a "check if file is in use"-property? Then i could loop until unused before executing write?
Thanks
Solved! Go to Solution.
08-14-2014 03:47 AM
Try LabVIEW synchronization VIs. "Semaphores" would help you for prioritize the events.
You can find examples along with LabVIEW which will help in how to use it.
08-14-2014 03:59 AM
Yes, writing data to a queue is the perfect solution. Quick for the sender, the writer writes in it's own pace and no data missing.
/Y
08-14-2014 04:03 AM
I am not sure if using the semaphores would slow down my measuring.
If loop1 in the example would be my measure-vi1 and WriteToFile and If loop2 would be my measure-vi2 and WriteToFile .
Then loop2 is not exeuting while loop1 has locked the semaphore.
I can put the semaphore only around my WriteToFile-vi perhaps...
Or is this so fast that it will not be noticeable?
08-14-2014 04:07 AM
08-14-2014 04:11 AM
Sempaphores can slow down the measuring, as the loops will have to wait to get the semaphores, go with the queue. 🙂
/Y