LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to save data accessed through Control Refnum?

Hi,
I am controlling 4 instruments, each from its own VI. (LabVIEW 7.1)  I have built a seperate VI which calls all the instrument VIs as subVIs and displays all the readings.  I would like to save the data I am displaying in the main VI.  In the subVIs, I use loops to continuously read data, so I use Control Refnums in the main program to access and display the changing readings.  Is there a way for me to save the data from the Control Refnums in my main VI, preferably all in the same file?
 
Thanks!
Jessica
 
0 Kudos
Message 1 of 6
(2,946 Views)

Hi Jessica,

you can read the values from your controls and write it to a file. You can build a shift register or write it into a txt file, or, ...! Can you show your main vi, and explain which format you prefer?

Mike

0 Kudos
Message 2 of 6
(2,945 Views)

Mike,

Thanks for replying so quickly.  I've attached a screenshot of my block diagram. 

I've worked on it a little more since my post, and now the data is being saved, but it doesn't make sense.  I am saving it as a .lvm file and opening it in Excel.  I'm new to LabVIEW, so I may simply be struggling with the syntax and logic.  From my experience coding, it makes sense to have the data stored inside the while loop.  However, in this program, it seems that the data doesn't start saving until after I've stopped the subVIs. 

 

0 Kudos
Message 3 of 6
(2,937 Views)

Hi Jessica,

to store the data in your main vi, create shift registers on your while loop and build an array from your values. To learn more about LabView see this link
http://www.ni.com/academic/lv_training/how_learn_lv.htm there are two free courses. Smiley Happy

Mike

0 Kudos
Message 4 of 6
(2,933 Views)

Mike,

I tried using shift registers, as you suggested.  However, I think that the way I am reading data does not work with them.  I added an iteration counter to my while loop to see how it was running.  The way I am reading data from my subVIs, with the control reference, means that as soon as I start the subVI, the while loop in my main VI stops looping, and stays in the same iteration until I stop taking data.  This means I only get two data points in my measurement file: the first and the last. 

I am able to read continuously updating data this way, but I am not able to store it for some reason.  I tried feeding the control reference directly into the 'Write Measurement File' function, but I still get only the first and last data points.  I am wondering if it would be easier to save the data in arrays, the way you suggested, in the subVIs and pass those arrays to the main VI to be put in the same file.  Is this reasonable?

Thanks, Jessica

0 Kudos
Message 5 of 6
(2,892 Views)
Jessica,
 
Getting the array from the subVIs may work as you the dataflow will only proceed once the subVI stops running.
 
However, if that does't work, then would it be possible for you to post your code that acquires the data from the instruments? That would provide a clearer picture of the data being read and the point at which the subVIs finish execiting.
 
 
 
Mehak D.
0 Kudos
Message 6 of 6
(2,866 Views)