LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing data to main vi's and error 1055

Hello! I am perplexed by an error that I am getting in LV 8.2 and I would certainly appreciate any insight as to why this might be occurring. I have searched through this forum, but did not find any answers that seemed to be particular to this problem.

 

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!

Download All
0 Kudos
Message 1 of 7
(3,564 Views)
In your main vi you may want to check to see why there is a corersion dot on your channels reference.  Also, is the "Hardware Channels" reference connecting to an input to your subVI or an output.  From you example pics I am not sure but from the coding standard I follow, the inputs are on the left side of the connector pane and the outputs are on the right.
0 Kudos
Message 2 of 7
(3,554 Views)

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

0 Kudos
Message 3 of 7
(3,534 Views)
Make your sub VI's control refnum the same type as your main VI.  Then you don't have to work with variants.
Do a 'create control' on your "Hardware Controls" reference and cut and past that control to your sub VI's (this should replace the control ref that is there).  Then when you wire your property node it will know the type of control and it wont need to convert to and form variant data.  The coersion dot should go away too.  Hopefully this will also solve your error problem.
0 Kudos
Message 4 of 7
(3,530 Views)

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...

0 Kudos
Message 5 of 7
(3,522 Views)
I appreciate the help!
 
The issue with variants has to do with strict vs. weakly-typed control refnums. When I created my cluster refnum the right-clicking option of "Include data type" was disabled. When following your suggestion of right clicking on the reference, creating a control (refnum), then pasting that on the front panel of the sub-vi allows the "Include data type" to be checked (yet it is still disabled). Wiring this new cluster control refnum to a property node shows that it is strictly-typed (i.e. the value property is the correct type).
 
The process of creating the refnum and references in the resent post is exactly what I had done, but for some reason I could not make the refnum control cluster strictly-typed.
 
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!
 
Regards
0 Kudos
Message 6 of 7
(3,512 Views)

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. 

0 Kudos
Message 7 of 7
(3,480 Views)