LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data lost in VI called by reference

I have only been working with Labview for a week, which went great until I ran into a very strange problem.

I have a project with a main front panel which calls several other VIs with their own front panel using Call By Reference Node.
I noticed some data got lost somewhere and I in debugging I ran into the following strange problem. In one called VI, I pass a 2D array to the VI. The data shows up in the corresponding control of this VIs front panel. However, when I put a probe after the control terminal in the diagram, the array is empty. How is this possible? Where could the data have been lost?

Thanks to anyone who can help me out with this one.

Edwin
0 Kudos
Message 1 of 8
(3,059 Views)
It's hard to say right off hand what the problem could be, but if you post your code in V6.0 format I'll be glad to look at it for you.

Mike...

PS: sorry for requesting the VIs be resaved, but I still have major clients that are using V6.0 and so can't upgrade my work system.

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 8
(3,059 Views)
I'll have a try at taking out the a small subset of the library which demonstrates the problem and reproduces on a different machine as well.

Edwin
0 Kudos
Message 3 of 8
(3,059 Views)
I attached a zip file with two Vis and some test data. The procedure to reproduce my problem is the following:

- Start the "main test menu" VI. (and ignore the three errors for refnums of missing VIs)
- Go to "File operations"
- Unpause the breakpoint this time
- Load the the sample data file and press "Done".

The indicators on the main form should now show the size of the loaded arrays (18x3 and 18x1).

- Now go to "File operations" again.
- From the breakpoint step into the "File IO.vi"

The controls at the front panel of File IO.vi now show the two arrays again with the same size as indicated in the main menu. However, adding probes on the wires after their terminals reveil the array for the first control, but the second probe show
nothing at all.

I hope somebody as any idea about what could be wrong here.

For the record, this was all done in a basic version of LabView 6.1 (files are saved as V6.0 though) and verified on two different machines.

Thanks in advance for your help.

Edwin
0 Kudos
Message 4 of 8
(3,059 Views)
Hi Edwin,
first of all if it's really only one week you're dealing with LV, you did a great job indeed!

Your problem is that you are only opening the front panel of the sub-vis.
First you have to change the property of the sub-vi to open its front panel when called: right click on its icon, select VI properties and Window Appearance, click on customize and select Show front panel when called and Close afterwards ( I did it in the File IO.vi).
I also modified your Main test menu.vi to call the File IO.vi and pass data to it. Do the same for all the others sub-vis call.
Just one thing:
Always close the references of the sub-vis opened or they will remain in memory.
Since you have a large number of variables to pass to sub-vis, I'd suggest to boundle
them in clusters, you reduce the number of inputs/outputs and the diagram is more readable.

Good luck,

Alberto
Download All
0 Kudos
Message 5 of 8
(3,059 Views)
What are you intending to do with Displacement Data? I'm guessing that you want to append it as row(s) to Pressure Data since you're use Insert Into Array with the index wired to the row dimension of Pressure Data. If I'm correct, then you should wire to the top index of Insert Into Array (the row index), not the bottom index (the column index). As it's wired now, you're trying to insert a sub-array into the 18th column of an array that's 18 rows by 3 columns.
OK, I don't understand what's going on with your probe, but... It looks to me like the data is really there (even though the probe doesn't see it?!). E.g., if you use Array Size on Displacement Data, you'll see that the size is 18 by 1. If you wire to the top index (row index) of Insert Into Array, you'll s
ee the data added when you probe the output of Insert Into Array. It could be something I don't understand about Call By Reference. Displacement Data is not the input that a probe can't see. Hmmm...
P.S. Your VI's are pretty ambitious for someone working with LabView for one week! Good work!
0 Kudos
Message 6 of 8
(3,059 Views)
My goal was to append the displacement data columns to the pressure data columns so they can be written in one table, so the wiring to the col index was in fact correct. However, I did extract the wrong dimension. 😕

But as you noticed with your solution, the probe still doesn't the array contents. Even though the data does now appear to be correct. Strange.

Thanks! For both the help and the compliment.

Edwin
0 Kudos
Message 7 of 8
(3,059 Views)
It's one week with LV, but I've been programming all my life. So LV is basically another way of doing the same for me.

I took the panel open property from the VI server examples. I completely missed that option (I did put it on dialog)

Thanks for the heads up with closing the refnums. I completely forgot that.

The number of variables did get larger than intended. I never expected to need my own scaling factors, but was forced to when I found out LV doesn't allow scaling factors from MAX to be written back. Much more clean-up is necessary though, but learning as I go.

I'm still quite puzzled about the failure of probe to work though.

Thanks for the pointers!

Edwin
0 Kudos
Message 8 of 8
(3,059 Views)