LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass .Net constructor reference to subvi by cluster

Hi,

 

I have an issue passing a .net constructor reference using clusters.  I am communicating with a Futek IPM650 using the suppiled .Net assembiles from Futek.  My test code consits of a subvi which initializes the Futek device and passes the reference and DeviceHandle to a subiv utilizing a cluster.  The image below shows my initialization subvi:

Futek_Initialize.jpg

 

As shown in the image, the code is able to load the .Net assembly and retrieve the IPM650's DeviceHandle.  The next image shows the cluster being passed to the "Get_Values" subvi with the correct reference and DeviceHandle values:

Futek_Standalone.jpg

 

The next image shows the initialization case of my state machine inside the "Futek Get Values" subvi:

Futek_Get_Values_1.jpg

 

The values of the .Net reference and DeviceHandle are correctly read into the subvi.  The next image shows the "Futek_Get_Offset_value" case:

Futek_Get_Values_2.jpg

 

The values for Futek_Reference and DeviceHandle are both read correctly from the cluster.  When I make the call to "Get_Offset_Value", LabVIEW returns the error shown above.  Now, if I put all the code into one subvi and use clusters, it will still generate an error.  If I use Shift Registers, the code will operate just fine.  The above code worked fine in LabVIEW 2012, but since I have upgraded to LabVIEW 2014, the code keeps generating an error.  An interesting thing to note is that when the "new reference" value of 88400000 is put into the cluster, the value is converted from hex to decimal (88400000 in hex is 2285895680 in decimal).  Is this a bug with 2014 or am I doing something wrong?  Is LV2014 unable to pass .Net references into subvis using clusters?

 

Cheers,

Shivels   

0 Kudos
Message 1 of 4
(3,227 Views)

Sorry, but it's very difficult to understand what you're asking, particularly the following:


shivels wrote:

The values for Futek_Reference and DeviceHandle are both read correctly from the cluster.  When I make the call to "Get_Offset_Value", LabVIEW returns the error shown above.  Now, if I put all the code into one subvi and use clusters, it will still generate an error.  If I use Shift Registers, the code will operate just fine.  The above code worked fine in LabVIEW 2012, but since I have upgraded to LabVIEW 2014, the code keeps generating an error.  An interesting thing to note is that when the "new reference" value of 88400000 is put into the cluster, the value is converted from hex to decimal (88400000 in hex is 2285895680 in decimal).  Is this a bug with 2014 or am I doing something wrong?  Is LV2014 unable to pass .Net references into subvis using clusters?


What do you mean by "if I put all the code into one subVI and use clusters"? All which code? Same thing with "If I use Shift Registers" - shift registers where? Containing what values? Does it work in LabVIEW 2014 or only LabVIEW 2012? It might help if you upload your code, instead of just screenshots. What's the full text of the error that occurs?

 

From your screenshots, you may want to consider redesigning some of your code. In particular, you shouldn't use a stacked sequence structure, and you probably don't need the local variable. Especially with local variables, it's possible that you have a race condition where you don't know what happens first - reading or writing the local variable - and the order has changed between LabVIEW 2012 and 2014 due to a compiler optimization.

0 Kudos
Message 2 of 4
(3,167 Views)

Hi nathand,

 

Thank you for the reply. I'm not sure posting the code will help, because the .Net assemblies used by the code have to be installed in the GAL. What I meant by "putting all the code into one subvi" was when I put the code into a single *.vi file without sequence structures or state machines, the reference from the .Net constructor will be correctly passed to the invoke nodes. The "if I use shift registers" part was meant to explain that if I use a state machine and attach a shift register to the while loop, the reference will be passed correctly between states using the shift register. I looked over my code again and did not see any local variables in the code. The issue with the error appears to happen somewhere in LabVIEW's handling of clusters. Before I upgraded to LV 2014, I was able to use clusters to pass the reference value from a .Net constructor to a subvi or another state in a state machine by using clusters. I have searched the forums and have not found any documentation suggesting any changes to cluster handling in LV2014. Is it possible this is a bug in LV2014?

 

Cheers,

Shivels

0 Kudos
Message 3 of 4
(2,979 Views)
Shivels My Brother (or Sister as the case may be)!

You are not crazy. I have seen the same thing working with a .net dll written by another division of my company, and I have little by little gotten to the same solution you are describing. That is the good news. The bad news is that it is unlikely we'll ever find a small repeatable example -- so calling NI will be a waste of time.

Mike...

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 4 of 4
(2,950 Views)