LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop a data acquisition if I press Cancel button for a file save?

I have a continuous DAQ and I save the data in a binary file.
When I start the vi it waits for my click on a START button. After I press on the START button a file dialog appears and if I select a file name and "SAVE" everything works fine - data is saved correctly in the file.
NOW, if I select "CANCEL" the vi continues to run and I get some errors and I have to select 'stop'. I would like that when I press CANCEL I return to initial running state of the vi (before pressing the START button).
Did anybody have similar situation. Any suggestions/examples?

Thank you.
RP
0 Kudos
Message 1 of 5
(2,303 Views)
Use the File Dialog (from the advanced file I/O palette, upper left).

It provides you with the selected path to be fed to your save operation and also a "cancelled" boolean output. Use this boolean to select the proper action you want if the dialog is cancelled (e.g. with a case structure).
0 Kudos
Message 2 of 5
(2,299 Views)
Thank you.

I already did this. I took the 'cancel' output to the case diagram that allows me to start or stop the data acquisition. The problem is, even if I cancel, the DAQ is already started and some data goes 'down the pipe' triggering some filter complaints... I will have to program better I guess. I was just hoping there is a simpler way out of this.

Thanks - Radu
0 Kudos
Message 3 of 5
(2,297 Views)
OK, I guess you just need a bigger case structure then. 🙂
0 Kudos
Message 4 of 5
(2,293 Views)
As a veteran, did you run into cases where you had to write a comment in the same binary file where you would have to send some dynamic data also? How about reading it back?
0 Kudos
Message 5 of 5
(2,289 Views)