08-19-2008 03:36 PM
Hello all
I am writing a rather large program in LV8.5 and am currently writing a lot of different VI's to be put together later as the compiled project. For now I am just writing and testing each VI separately. At some point at the beginning of the compiled VI, I will prompt the user to input which "Quarter Section" is being tested (1-4).
What I would like to learn how to do is be able to take that 1-4 value, put it into a variable at the beginning of this mess, and be able to retrieve it at any arbitrary point down the line without using controls/indicators to cut down on usless wiring and unnecessary inputs/outputs in the other VIs. I basically want a global variable, but to my knowledge globals only transfer between VIs in the same project. How can I get around this?
08-20-2008 02:09 AM
Hi jaysmall,
afaik the global is automatically part of your project if you use it in your project. You can also use global functional variables to transfer data, but if it´s possible use controls and wires.
Mike
08-20-2008 07:58 AM
Mike,
How do I change the global variable type? I am trying to write a numeric constant to it to use later, but its type is void and won't let me wire a number to it.
08-20-2008 08:16 AM
08-20-2008 08:33 AM
It should be pointed out that traditional Globals are generally considered bad programming practice in LabVIEW, and you might want to replace the global with a Functional Global / Action Engine. Functional Globals aren't really globals in the normal sense, but rather subVI's that make use of some of LabVIEWs percularities to store a state between calls. They have several advantages over traditional globals as well.
http://forums.ni.com/ni/board/message?board.id=170&thread.id=240328&view=by_date_ascending&page=1
Is Ben's nugget about them.
08-20-2008 08:53 AM
Thank you for referring me to that. What a great exploit of LV functionality.
Though unless I skimmed too fast and missed something, I did not see a reason for superiority over a GV for my purpose. If there is, please let me know. I am just saving a 1-4 state.
08-20-2008 11:23 AM
08-20-2008 01:26 PM
Alright, using LV8.5 I can't seem to make this Functional Global work...
What am I doing wrong?
08-20-2008 02:06 PM
You had the input attached to the read of the left most shift register. Attached the fixed FG.
Basically, on a write you switch the input of the shift register (The right side of the register) to the input value, overwriting the earlier value. This is the value that will be read later.
08-20-2008 02:17 PM