05-10-2006 06:46 AM
05-10-2006 07:22 AM
That is the way Globals work in LabVIEW. Use a cluster to create multiple variables within on Global VI.
Matt
05-10-2006 07:29 AM
Hi Risoto,
You do not have to have a seperate "VI" for each global variable - when you create a global, you can put any number of control/indicators on its front panel (and add or delete more later), and of any mix of data type.
When you drop a global onto the block diagram, if there are multiple items on its front panel then you select the value you wish to read/write by clicking on the global terminal/icon and select the particular variable from the pop up list.
Tip: If you ever feel the need to rearrange the order of the items in the global's pop up list - select "Set Tabbing Order..." in the global VI's window menu (it's under the "Edit" menu in LV 7.0).
Advise: Try not to use globals as an easy alternative to passing variable values - personaly, I only ever use globals for setting "global constants".
Mark.
05-10-2006 07:39 AM
Hi Matt,
There is no need to use a cluster to have multiple variables on a global - although, if you wanted to access all/several of the variables without the use of multiple copies of the global terminal, then you could use a cluster data type to acheive effect.
I will most often use a single "Global Data.vi" VI with all my globals on the one panel, some values are simple numerics/strings, and some may be arrays or clusters.
I would not bundle items (cluster) on the global just for the sake of it - I would only bundle data items together if there was a logical connection/relation of the items.
Mark.
05-10-2006 07:40 AM
Saving a global variable into a .llb is not a problem if you do it immediately.
Otherwise, if you move the global, the link between the global and the calling vi may be lost, and the global will appear with a black border and a check mark. Right clicking the broken global and browsing from the select... popup menu to the proper global folder restablish the link and the vi functionnality.
05-10-2006 09:48 AM
05-10-2006 01:02 PM - edited 05-10-2006 01:02 PM
Do you mean the new Shared Variable in LabVIEW 8? You mention the type is "single process", which is one of the shared variable modes of operation.
@Risotto wrote:All the variables are of variable type "single process".
Message Edited by Ed Dickens on 05-10-2006 01:02 PM
05-11-2006 06:20 AM
05-11-2006 07:35 AM - edited 05-11-2006 07:35 AM
Message Edited by Risotto on 05-11-2006 07:37 AM
05-11-2006 07:36 AM
Hi everybody,
Thank you for your answers, I get a lot of informations.
Yes, I use the new shared variables in LabVIEW8, which I am using like sort of global constants. Now I am understanding what guys are telling me all this about global variables in LabVIEW7.1. Sorry, I forgot to say I was using LabvVIEW8.
I will have a look on the tutorial too.
But yet one point about the library collecting all the shared variables in the windows explorer and in the project explorer: When I create a shared variable in my LabVIEW project - for example "test1" as double/single process - the variable doesn't appear in my file directory, but it appears in the project explorer in a library (.lvlib).
When I drag/paste my shared variable on the block diagramm of my VI, then a file "Math_test1.vi" appears in my file directory. There is no extra .llb created to contain my shared variable vi.
If I drag/paste the file "Math_test1.vi" in the Math.llb (see picture), then the file is moved in the llb and disapeared from the directory.
If I created another shared variable "test2" as double/single process and put it on the VI, then LabVIEW creates2 files in the directory: "Math_test1.vi" and "Math_test2.vi". So that I get 2 vi for the "test1" variable now (one in the llb and one in the directory).
I use several library in the project explorer. But the library in the project explorer seems to create file with other extension (.lvlib) than the sdtandard LabVIEW library (.llb).
Cheers,
Risotto