10-20-2005 08:32 AM
10-20-2005 09:57 AM - edited 10-20-2005 09:57 AM
I guess I'm not understanding what you are looking for that can't be done with the regular global in LabVIEW? You can make them using type def controls, can have them preloaded with values early in your program, and with LabVIEW 8.0 there is a new "global" that is truely global, being able to be called from vi's running on other machines. The overhead should be also minimal, you could probably even have the initialization vi loaded and unloaded dynamically.
(I also don't know why someone gives a single star for a valid question!)
P.M.
Message Edited by LV_Pro on 10-20-2005 11:04 AM
10-20-2005 12:28 PM
10-21-2005 07:57 AM
Hi Paul,
If I follow you then take a look at the attached zip for an example of how I have handled this situation.
The "auto-growing" type-def'd constant are in a sub-VI so they do not "auto-destroy" my diagram.
The sub-VI's do "bundle by names" to give me different version of the same type def.
This does take a little more work than just dropping a constant but
1) it make my code easier to read and
2) the sub-VI's do what my defined constants used to do back when I used to "C".
I hope this helps,
Ben
10-24-2005 07:12 AM
10-24-2005 08:16 AM
Hi Paul,
If I rember corectly the "#define" was a pre-proccessor command that let us establish a translation between a symbolic string and the syntaxically (sp?) correct string used by the compiler.
The big thing I see that is missing in the approach I suggested is the "conditional" defines. I believe with LV8 and the new project window, this short-coming is now addressed.
Ben
10-25-2005 09:39 AM
I look forward to the new LV8 features, I hope to begin the migration process this winter when work slows down a little. The only advantage to a preprocessed directive is that is will replace the code before processing (like cutting and pasting the value in place of the constant, with no function call overhead. This could only be a problem with CPU intensive code. See the following "toy" example.
//haven't been programming in c lately so don't jump on my syntax.
#define PI 3.14
void calculateManyCircleAreas()
{
float area = 0.0;
for (r=0;r<10000000;r++){area = (PI*r*r);
void calculateManyCircleAreas2()
{
float area = 0.0;
for (r=0;r<10000000;r++){area = (getPI()*r*r);}