11-10-2006 12:04 PM
Hello! I am perplexed by an error that I am getting in
All I want to do is pass data from a sub vi to a main vi, while being able to see that data execute in the sub-vi (i.e. from the main vi front panel). One way that I learned to do this is to have a control refnum object on the sub-vi wired to a property node and write the data property. I then create a reference to a control in the main vi. It is the refnum wire from the sub-vi that is then wired to the reference to the control that I wish to update. This however only works for a given VI (executing from the sub-vi and/or the main) about 50% of the time. When it does not work, I get error 1055: Object reference is invalid. This error is originating from the property node in the sub-vi. I can run the sub or main vi again, without changing anything, and it will run fine. I do, however, seem to see the error less often when running from the main vi.
I have tried changing the refnum object in the sub-vi from the generic control class (default) to the exact type of control that I am passing data into in the main vi (in this case a cluster). Both variations seem to execute with and without the error consistently.
Thanks in advance for any replies!
11-10-2006 12:41 PM
11-10-2006 01:31 PM
I assume the coercion dot is showing up because a conversion from cluster to variant is occurring. I inserted a "To Variant" function and the dot went away, but the error remains when executing from the sub-vi. The error does not occur from the main vi though.
I totally agree with the inputs on the left, outputs on the right. I chose the upper right terminal for the refnum in the sub-vi, but when I made a connection to the sub-vi in the main the connector was on top. Odd!
Regards
11-10-2006 01:49 PM
11-10-2006 02:07 PM
Also, here is a link to a resent post that goes over the same idea.
http://forums.ni.com/ni/board/message?board.id=170&message.id=214327
Check out devchander's example VI's...
11-10-2006 04:46 PM
11-13-2006 08:17 AM
If you can make it strictly typed I would use that. Then you will know if you are wiring the correct data into the value property node. I am not sure what to say about the error. It seems to me that you are doing it the way I would. One thing you could try is to test the refnum first with a comparision "not a number/path/refnum?". This wont solve the error but maybe you can catch it before it happens. Maybe your main VI is closing the control reference befor the sub VI is finished? From your pics I don't see how this would happen.
@orbit wrote:
Everything seems to work fine when running from the main vi, but still gives an error when just running the sub-vi. This behavior is fine as long as I don't get the error in the main vi as I did before!
I just re-read this part above. Are you trying to run the subVI alone? You will for sure get an error 1055 because you didn't pass in a valid reference. This valid reference is generated from the main VI (it is possible you may not get the error if the main VI was run once and still in memory because the subVI will still hold the mainVI's control refnum).
If you want to run the subVI without running from the main VI you will have to handle the invalid refnum or you will get the error.