LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared Variable and classes

Hi friends,

 

 

1.can you tell me the Disadvantages of Shared Variables?

2.What is classes ,how to make it?

Raj
0 Kudos
Message 1 of 4
(2,486 Views)

Hi! Raj

 

Shared Variables

shared variables share data between loops on a single diagram or between VIs across the network. For doing that they break the LabVIEW dataflow paradigm.

Disadvantages:

 

1. Using variables allows for race conditions and incurs more overhead than passing the data by wire(break the LabVIEW dataflow paradigm).

Race conditions happen when you, for example, write data to a shared resource from multiple operations faster than you read data from the same shared resource.

 

 

 

2.You must have a project open to create a shared variable

 

You can also read more about shared variables at http://zone.ni.com/devzone/cda/tut/p/id/4679

0 Kudos
Message 2 of 4
(2,463 Views)

Classes

 

A LabVIEW class is a special type of project library where the member VIs collectively define a new data type.

Consider classes as a more powerful cluster type.

 

It consists of:

- A data control(cluster)

- Member VIs to access that data.

 

To create a LabVIEW class: 

1.Open a new LabVIEW Project.

2.Right-click My Computer and select New»Class.

3.In the New Class dialog box, name the class Example Class. Click OK.

4.In the Project Explorer Window, double-click Example Class.ctl.

5.Add string and numeric controls to Cluster of class private data. Use the default control names, Stringand Numeric.

6.Save Example Class Class.ctl. You will be prompted to save the class.

7.In the Project Explorer Window, right-click Example Class.lvclass And select New»VI for Data Member Access.

8.In the Create Accessor dialog box, select both Stringand Numeric In the Data member of Example Class.lvclass list box.

9.Leave the Access parameter as Read. This creates VIs for reading each data member of the class.

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

Raj, please let us know if you require any other assistance.

 

Samrat Sah

Applications engineer

National Instruments

0 Kudos
Message 4 of 4
(2,460 Views)