Jump to content

File dialog suspends other unrelated file operations.


Recommended Posts

I have two loops. One for data taking and logging, one for loading a parameter file. I notice that when I click the "browse" button on the "load file" field, the data taking and logging loop freezes.

Attached is an example which demonstrates the problem.

Thank you in advance!

Raymond

suspend.vi

Link to comment

I have two loops. One for data taking and logging, one for loading a parameter file. I notice that when I click the "browse" button on the "load file" field, the data taking and logging loop freezes.

Attached is an example which demonstrates the problem.

Thank you in advance!

Raymond

So I found a couple of interesting things. First, I downloaded your VI and opened it up with LV2010 and could not reproduce the problem. Then I noticed your signature says LV8.5 - I don't have 8.5 loaded, so I opened it up in 8.6 and then the problem was just as you described. So, one fix would be to update to LV2010 :) But the crux of the problem seems to be the fact that the Write To Spreadsheet File VI opens and closes the target file on every write. When the File Dialog is open, the Open/Create/Replace file function seems to be blocking and can't open the data file on the read loop until the dialog closes. Take a look at the attached VI where I open the file outside the data loop and then append to it on every iteration and close the file when the loop exits. This is better practice. Best practice would be to separate the data read loop and the data write loop (see the producer/consumer template that ships w/LV). This creates a buffer so that the data taken gets stacked in a queue until the loop that writes to file can service it.

Mark

suspend-3.vi

Link to comment

So I found a couple of interesting things. First, I downloaded your VI and opened it up with LV2010 and could not reproduce the problem. Then I noticed your signature says LV8.5 - I don't have 8.5 loaded, so I opened it up in 8.6 and then the problem was just as you described. So, one fix would be to update to LV2010 :) But the crux of the problem seems to be the fact that the Write To Spreadsheet File VI opens and closes the target file on every write. When the File Dialog is open, the Open/Create/Replace file function seems to be blocking and can't open the data file on the read loop until the dialog closes. Take a look at the attached VI where I open the file outside the data loop and then append to it on every iteration and close the file when the loop exits. This is better practice. Best practice would be to separate the data read loop and the data write loop (see the producer/consumer template that ships w/LV). This creates a buffer so that the data taken gets stacked in a queue until the loop that writes to file can service it.

Mark

Thanks Mark, it works. I'll definitely try to apply this to my project.

Another slight complication is that I need to create a new file for data logging at midnight every day. I suppose if I do not open the file dialog at midnight, I'll be fine?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.