LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Object Oriented Programming

Solved!
Go to solution

Hi,

 

Please see my 2 attachments. In this, you will see my class programming of LabVIEW which I am new to. Here the class name is Keithley 2600 since this class is used to run a Keithley 2600 SMU. So for connecting with the SMU, we use a VISA in which is the VISA_resource name which is connected with the Keithley 2600 in and I will select the connected instrument using the VISA function. Now VISA_resource name 2 is the output by unbundling the Keithley 2600 out. Now when I run the program I expect the VISA_resource name 2 be updated as the VISA_resource name I selected for the Keithley 2600 in. But the output shows nothing. This is where I don't what is the problem. Because I was hoping to initialize this here and then use it another vi. But it's not working since the output here doesn't have the VISA details. What is the problem and how can I fix the problem. Thanking you. 

 

Govind

Download All
0 Kudos
Message 1 of 5
(2,684 Views)
Solution
Accepted by topic author govindsankar

Classes are by value in LabVIEW and not by reference. This means when you split the class wire, both paths are separate data copies. For the VISA resource to be what you expect it to be, you would need to wire the output of the bundle to the class output.

 

Just from looking at what you have shown us though I would really suggest breaking up a lot of this functionality into different class methods to get more use out of the object.

Matt J | National Instruments | CLA
Message 2 of 5
(2,670 Views)

Dear Mr. Matt J

 

Thank you for your kind reply. It did work like you explained. But now the problem is different. The vi I showed was the initialize VI which is supposed to initialize the visa function and other some functions of the Keithley 2600. Next I create another dynamic VI under the same class and unbundle the Keithley 2600 in and take the output of the VISA from that and I hope to get the same as when I did in the initialize but here it's showing nothing in the visa section and is giving an error as if the instrument is not connected. The reason I am asking is that I have used both this vis as subvis in another program where I use 2 different states. The first state is the initialize state and the second subvi is this vi which is the output on/off that turns on this Keithley 2600. If I have initialized in one state then why is it not working in the second state and also not working separately?  If my explanation is not clear enough for you, I have uploaded all VIs that is the main program and the subvis which are initialize and output on/off

Download All
0 Kudos
Message 3 of 5
(2,651 Views)
Solution
Accepted by topic author govindsankar

Again, remember that objects are by value and will follow the same rules as if you bundled up the VISA resource within a cluster. This means that in your top level VI you would need to put the object into a shift register so that any updates to the object state within the message handler loop will be used i the next iteration. Your message handler loop is currently set up to use the default object data each iteration.

 

As a side note it's much more helpful to upload the entire project as a .zip, especially if you are dealing with classes, because I'm not able to see any of your object data or inheritance structure.

Matt J | National Instruments | CLA
Message 4 of 5
(2,638 Views)

Thank you for your kind reply, that is exactly what I did. I have used visa as a shift register. I have also uploaded the whole project as a zip folder if you need tó chek it out.

0 Kudos
Message 5 of 5
(2,596 Views)