11-29-2009 08:11 PM
I apologize in advance because I know this question has been asked many times (and I'm pretty new to Labview; I did search though). I'm trying to build a data acquisition VI and I'd like to be able to stop/start recording from multiple channels independently of one another.
I just started with 2 channels merged into a single signal (to simulate a single data set that I'd want to record), and then used "write to file" within a case structure with a boolean controlling it. Write to file exists in the true case, and the false case is left empty. When I switch the boolean control on and off, write to file does not prompt me for a new file name each time (it appends instead). Only when I stop and restart the entire VI am I able to change the file name. I tried changing write to file from an Express VI to a standard VI (issue 179472), and while that helped, I still wasn't able to get the control I wanted.
Attached are JPGs of my block diagram and front panel
Thanks in advance!
11-29-2009 11:32 PM
11-30-2009 01:31 AM
I think it would be better if you used write to spread sheet.vi
Here is an example:
12-08-2009 08:16 AM
12-09-2009 11:59 AM
Hello,
You can think of the shift registers almost as local variables. They are used to store information from the previous iteration of the loop to the current iteration. In the example that srikrishnaNF posted, he has basicalyl implemented a state machine architecture to control the different options. Once the file path it set, it is saved for the next loop iterations within a shift register until it is updated with a new path. The first case structure determine whether you want to write to a file or not. The second case structure determine whether the user needs to be prompted for a new file path, or whether it is still writing to the same file. This is indicated by looking at the true and 1 case. Here, the user wants to write to a file and the file path has been selected in the true and 0 case. In the true and 0 case, the user has selected a file, the 0 has been changed to a 1, and you then enter the true and 1 case. In this case, the value is kept at 1 meaning that the user will not be prompted for a new file path as long as the write to file button remains true. Once the write to file button switched, you will enter the false case. This case resets the 1 to a 0 and will cause the user to enter the true and 0 case when the write to file button is clicked again.
-Zach