02-10-2010 09:55 AM
Let's say I like the use of a cluster/typedef to use as a mechanism for gathering together all the variables I want to deal with in a vi. Now I create a second vi...and also use the tyepdef cluster to create a wire with the same variables in it. Are the instances of the variables in vi1 seperate from the instances in vi2....if so, would there be some mechanism for passing the values back and forth between the two vi's effeciently...would that be a (gag...) global with scanning on each end?
Hummer1
Solved! Go to Solution.
02-10-2010 09:59 AM - edited 02-10-2010 10:04 AM
"Ask and you will recieve."
I have to agree with the post that Nathnd will post shortly were he will write " or use a functional global variable (also sometimes referred to as an Action Engine, "
See here for myNugget on Action Engines.
Ben
02-10-2010 10:02 AM
02-10-2010 10:06 AM - edited 02-10-2010 10:08 AM
A typedef just defines a control as being a certain defined "type". It's basic structure can only be really changed with the control editor, but when it is changed there the changes are propogated to where ever the control is used. Now, having created this typedef'd control you can use it to pass data between vi's in a few ways. The least popular in the current thinking is the global. The reasons have been talked to death in this forum. Another method would be using a "functional global"a.k.a. "LabVIEW 2 style global", which has the advange that it is locked while any vi is accessing it. Yet another method would be to write to a queue in the one vi, and read from it in the other. There is a new "global", which has its uses, called the "shared variable" These all have advantages and disadvantages. Search on the highlighted terms to learn more.
Ben, how did you know what nathand was going to write, is he sitting near you?
02-10-2010 11:08 AM
Thanks...
(Ben knows everything...he was in the Navy.)
Would a good strategy be to use the type def to make sure that all the applications had the same variable types available to them, and then use one of the shared/or other common access methods to get to them when needed?
Hummer1
02-10-2010 11:11 AM
I attempted the shared Queue approach and had a bit of a problem. I will have to build a small sample set of vi's to investigate as the problem may (probably was) operator error. Because of the confusion (mine or LV's) I'm going to stay away from that for the moment.
Hummer1
02-10-2010 11:23 AM
Hummer1 wrote:Thanks...
(Ben knows everything...he was in the Navy.)
Would a good strategy be to use the type def to make sure that all the applications had the same variable types available to them, and then use one of the shared/or other common access methods to get to them when needed?
Hummer1
Yes, that is exactly what typdefs are used for. They are the defintion of a piece of shared data. If everything accessing specific instances of teh data use the typedef if the definition of teh data type changes all users will get the new definition.