LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

Having trouble using global variables!

We have a two part program.   In the first phase we run a configuration program that lets us calibrate our light sensors against the conditions they will be seeing in the real program.  We save that data in some small files that reside on the NXT Brick.

 

In our main program, we read in the configuration values and use them in all of our sub-Vi's to make decisions.   The problem is we have four configuration values that we are having to define and pass in to each Vi and it's sub Vi's.    It would be a lot cleaner if we could just read these configuration values from the files where they are stored and keep them in global variables that every Vi can access.

 

We know it is possible, be we keep hitting the wall when we try to do this.   The documentation on actually creating and using a global variable isn't clear enough for us to figure it out.   Is there a tutorial available on how to do this?   Or alternatively, can somebody give us a step by step instructions on how to store these values into a global variables and how to access them from the sub-VI's ???    I know this is something that should be obvious and easy, but we can't get over the hump and get this figured out and implemented.

 

 

0 Kudos
Message 1 of 3
(6,006 Views)

Argh!!!   We have been trying and trying to get Global Variables to work...   We certainly understand more than we did this morning when we made the first post.   But now we have a problem we don't have a chance of understanding.   We have created a control panel for each of our 4 global variables.  (We would really like to get them all on a single control panel but I guess we will do that later if we can get this other problem figured out.)

 

Attached are all the files for our project.   They sit in a directory called 'Work'.   The main program is: Main.vi    If you bring up LabVIEW with the Main.vi program you should be able to see the problem we are fighting.   The problem is, once we target the code generator to the NXT Brick, we get some errors.   But it won't tell us what the errors are. 

 

For example, it complains about Read_State_Of_Light_Sensors.vi not being executable, but it won't tell us what is wrong with it.   Can somebody figure out how to get our code to compile?   We are close, but we don't know which direction to go.   What ever is wrong, it can't be much...   But we don't have a clue what to do!

 

Thanks so much in advance!

 

0 Kudos
Message 2 of 3
(6,001 Views)

Hi EDNEDN,

 

If you are not already, I recommend that you use a project for your application.  Once you are using a project, you can create shared variables that multiple VIs can read and write to.  Here are some resources to learn more:

 

Information about the LabVIEW Project:

http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/using_labview_projects/

http://www.ni.com/white-paper/5787/en

http://www.ni.com/white-paper/7197/en

 

Information about shared variables in LabVIEW:

http://www.ni.com/white-paper/4679/en

http://www.ni.com/white-paper/7585/en

 

Hope this helps!

 

Regards,

 

Dayna P.

Applications Engineer

National Instruments

0 Kudos
Message 3 of 3
(5,979 Views)