Addition of new global variables

I change code that uses one or more global variables in a global folder of vi. I would like to add a few variables more and potentially change what exists and ask them to be in the same globals vi. I can easily add a variable of the same type by copying and pasting a variable of the same type on the Panel before the globals vi, but I can't add variables of different types.

This post comes closest: http://forums.ni.com/t5/LabVIEW/how-to-associate-existing-global-variables/m-p/1079535/highlight/tru... but I did not understand this line:

  • Add FP (there may be several elements in a global variable VI)

I read some of the warnings against the use of global variables as it can cause race conditions / lead to General illegibility. I'm curious what is recommended if global variables are used as the constants that are defined at the beginning of the program. In general, my LabVIEW code gets pretty unreadable if I have a lot of threads for all of these constants. Is there something better?

Thank you!

Kristen

Hello kllurie,

The scenario you mentioned (using globals to replace duplicate constants) is probably the best use cases for them - conditions of race etc. problems arise when they are used to the stream or in several scenarios of the writer.  Readability is perhaps a matter of concern, because it is not immediately clear what could be reading from or writing to a global when a thread would suffice.

With regard to the modification of the globals vi, all you need to do is drop objects on the front of the range of controls (right click).

Kind regards

Tags: NI Software

Similar Questions

  • Package global Variable - Collection - Associative Aray

    All,

    What we are doing is...
    (1) fill us tab_emp_sal_comm with big collect and browse in a loop.
    (2) check if the deptno success is available in the tab_emp_sal_comm collection.
    (3) if it is available to fill a collection called tab_emp_sal_comm_1 and push corresponding only files inside.
    (4) of the corresponding collection, we want to fill at the table of global collection of package which is again of the same type.
    (5) by default for each new call old values are replaced, but I want to add the global variable at each call and finally do a big update to the corresponding tables.
    (6) l_deptno will be a parameter and values will change at each call of this procedure in the code in real-time.

    For the sake of ease, given an example simulated the EMP table. Goal is to add the global table in the package. Because each call, the previously loaded values are replaced. I want them to be available and additional calls should only add the values in the next set of lines instead of over writing.

    How to achieve it, please discuss.
    CREATE OR REPLACE PACKAGE employees_pkg
    IS
      type rec_sal_comm is record(esal emp.sal%type, ecomm emp.comm%type,edeptno emp.deptno%type);
      type at_emp_sal_comm is table of rec_sal_comm index by pls_integer;
      pkg_tab_emp  at_emp_sal_comm;
      pkg_tab_emp_1 at_emp_sal_comm;
    END;
    /
    -- Block Starts 
     declare
      -- Local variables here
      type emp_sal_comm is record(
        esal    emp.sal%type,
        ecomm   emp.comm%type,
        edeptno emp.deptno%type);
      type at_emp_sal_comm is table of emp_sal_comm index by pls_integer;
      tab_emp_sal_comm  at_emp_sal_comm;
      tab_emp_sal_comm1 at_emp_sal_comm;
      l_deptno          dept.deptno%type := 30;
      l_comm            number(7, 2) := 0;
      M_CNTR            NUMBER(7, 2) := 0;
    begin
    
      select sal, comm, deptno bulk collect into tab_emp_sal_comm from emp;
      for indx in 1 .. tab_emp_sal_comm.count loop
        if tab_emp_sal_comm(indx).edeptno = l_deptno then
          tab_emp_sal_comm1(indx).ecomm := tab_emp_sal_comm(indx).ecomm * 0.5;
          tab_emp_sal_comm1(indx).esal  := tab_emp_sal_comm(indx).esal * 0.75;
        end if;
      end loop;
      dbms_output.put_line(tab_emp_sal_comm1.count);
      dbms_output.put_line('**');
    
      m_cntr := tab_emp_sal_comm1.FIRST;
      loop
        exit when M_CNTR is null;
    --    dbms_output.put_line(M_CNTR || ' ** ' ||nvl(tab_emp_sal_comm1(M_CNTR).ecomm, 0));
        employees_pkg.pkg_tab_emp(m_cntr).ecomm := tab_emp_sal_comm1(M_CNTR)
                                                        .ecomm;
        employees_pkg.pkg_tab_emp(m_cntr).edeptno := tab_emp_sal_comm1(M_CNTR)
                                                          .edeptno;
        employees_pkg.pkg_tab_emp(m_cntr).esal := tab_emp_sal_comm1(M_CNTR).esal;
        m_cntr := tab_emp_sal_comm1.next(m_cntr);
    ---  other computations and calculations made based on the matched records
      end loop;
    
      employees_pkg.pkg_tab_emp_1 := employees_pkg.pkg_tab_emp;
     -- dbms_output.put_line('**');
    --  dbms_output.put_line(employees_pkg.pkg_tab_emp_1.count);
    end;
    -- Code will work in a Scott Schema with Emp Table.

    Hi Ramarun,

    (1) operator MULTISET, AFAIK, is to always give a dense nested table. To create a sparse nested table, the only way is to delete some items with the DELETE method.

    (2) using the 1... NesTableVar.count is valid only when the collection is dense. With the release of MULTISET UNION you won't have a problem. But if you have a loop in a rare collection, you must use another method.
    Below is an example:

    declare
      type  t_set is table of number;
      set1  t_set := t_set(1,2,3,4,5,6,7,8,9,10);
      idx   integer; 
    
    begin
      -- make collection sparse
      set1.delete(3);
      set1.delete(7);
    
      idx := set1.first;
      while idx is not null
      loop
         dbms_output.put_line('Set('||idx||'): '||set1(idx));
         idx := set1.next(idx);
      end loop;
    end;
    / 
    
    Output:
    Set(1): 1
    Set(2): 2
    Set(4): 4
    Set(5): 5
    Set(6): 6
    Set(8): 8
    Set(9): 9
    Set(10): 10
    

    (3) you can use FORALL update/insert/Delete with the help of a nested table. It is dense, you can use 1... NesTableVar.count, if it is rare, then you must use another method as explained here.

    Kind regards.
    Al

    Published by: Alberto Faenza on 2 December 2012 13:35

  • To access the Global Variables in the functions/methods

    Which of the following statements is better in terms of performance and efficiency?

    public var a: int = 0;


    public void add (): void {}

    a += 5;

    }

    Addition();

    OR

    public var a: int = 0;

    public void Addition(b:int):int {}
    b += 5;
    Back to b;
    }

    a = (a) Addition;

    I saw a lot of guides discourages the use of global variables in the functions/methods, but I just don't understand why anyone would create a copy of the variable, modify this copy and to grant this value to another variable and throw.

    You must create an instance to pass to your function.  the parameter (for example, mov) does not create a separate instance and creates only a temporary pointer to the passed object.

    If an instance is prepared for gc, having spent this instance to any number of methods (as a parameter) delay / will not interfere with ca.

    and Yes.

    MOV ['x'] = mov.x,

    MOV ["rotation"] = MOV.rotation,

    MOV [anypropertystring] = MC.anyproperty

    Flash uses array notation to solve strings into objects:

    var var1:ClassType = new ClassType();

    This ['var1'] = this.var1

  • DLL and global variables

    OK, here's a strange problem.  I am very new to create the dll, so I don't know that I have just an installation problem.

    But I'm trying to pass a global variable of a host program to its attached DLL.  I got this job when I was the CVI 2014. I recently upgraded to 2015 and then started getting "undefined symbols" errors.  With some struggle I managed to compile again, but broke the variable connection in the process.

    I have compiled my DLL in debug mode so that I walk in from the test project.  Right now, my global variable exists in the test project, as well as in the DLL.

    Can I export the variable and the use of DLLIMPORT/DLLEXPORT?  Confused and curiously not to find anyone quite like this on the forums.

    EDIT: this post stack overflow described pretty well from my experience.  I am linking statically.

    Well, what do you know?  I found my problem.  This draft article and example WERE vital to the solution.  This article called, "using the Export method qualifier"was also useful.  I'll cut to the Chase...

    If you use a qualifier of export on the definition and the import on the declaration, LabWindows/CVI identifier export symbol.

    This is the right key.

    So in my example, it should look like this:

    DLL fichier.c

    int DLLEXPORT varName = 0;

    Header.h DLL

    int DLLIMPORT varName;

    Project that uses DLL.c

    #include "header.h DLL.

    varName! = 1 ;  a method to change this variable for local use

    Pretty easy, huh?  But wow, it took some time to find.

  • How to extract file with LabVIEW Teststand global variables

    Hello

    My goal here is to extract all the contents of the global variables for file (names and the value of any types) in a sequence of my LabVIEW UI file.

    For now, I can only open a file of sequence of LabVIEW and get the number and the names of the variables (cf. vi) attached.

    But if my variable is a container, I would like to know all the contents of this container (and so on) and I don't know how to do it.

    In addition, I have to extract the value of variables that I don't know the type in advance...

    Can you help me?

    Thank you.

    Well I finally used the method "GetNthSubProperty" to work on each variable and I use the property 'Type' to know if it's a number, string, boolean, or a container. If it is a container, I repeat the process at a lower level... (see attached vi)

  • How to create a Global Variable through the Project Explorer

    Hello world!

    I know how to create a global variable (in a vi through the range of functions...).

    but I'm missing a way to create one via the Project Explorer.

    It's a missing feature or just this documentation (and the intuition of myself) are missing?

    It would be very convenient.

    THX for your time and hope that answers.

    jwscs

    Right click on my computer > new > new... > select Global Variable.

    EDIT: although I agree with Gerd (he probably wondering why you need so we can recommend a better way ), I rarely use them in easy to write once - read many applications such as security levels overall program at initialization (VER) to read later, but NOT modified.  I know it would be better to make a good class, functional Global Variable (FGV) or a motor Action (AE) but globals ARE practical and safe IF used wisely.

  • global variable functional to read and write data from and to the parallel loops

    Hello!

    Here is the following situation: I have 3 parallel while loops. I have the fire at the same time. The first loop reads the data from GPIB instruments. Second readers PID powered analog output card (software waveform static timed, cc. Update 3 seconds interval) with DAQmx features. The third argument stores the data in the case of certain conditions to the PDM file.

    I create a functional global variable (FGV) with write and read options containing the measured data (30 double CC in cluster). So when I get a new reading of the GPIB loop, I put the new values in the FGV.

    In parallel loops, I read the FGV when necessary. I know that, I just create a race condition, because when one of the loops reads or writes data in the FGV, no other loops can access, while they hold their race until the loop of winner completed his reading or writing on it.

    In my case, it is not a problem of losing data measured, and also a few short drapes in some loops are okey. (data measured, including the temperature values, used in the loop of PID and the loop to save file, the system also has constants for a significant period, is not a problem if the PID loop reads sometimes on values previous to the FGV in case if he won the race)

    What is a "barbarian way" to make such a code? (later, I want to give a good GUI to my code, so probably I would have to use some sort of event management,...)

    If you recommend something more elegant, please give me some links where I can learn more.

    I started to read and learn to try to expand my little knowledge in LabView, but to me, it seems I can find examples really pro and documents (http://expressionflow.com/2007/10/01/labview-queued-state-machine-architecture/ , http://forums.ni.com/t5/LabVIEW/Community-Nugget-2009-03-13-An-Event-based-messageing-framework/m-p/... ) and really simple, but not in the "middle range". This forum and other sources of NEITHER are really good, but I want to swim in a huge "info-ocean", without guidance...

    I'm after course 1 Core and Core 2, do you know that some free educational material that is based on these? (to say something 'intermediary'...)

    Thank you very much!

    I would use queues instead of a FGV in this particular case.

    A driving force that would provide a signal saying that the data is ready, you can change your FGV readme...  And maybe have an array of clusters to hold values more waiting to be read, etc...  Things get complicated...

    A queue however will do nicely.  You may have an understanding of producer/consumer.  You will need to do maybe not this 3rd loop.  If install you a state machine, which has (among other States): wait for the data (that is where the queue is read), writing to a file, disk PID.

    Your state of inactivity would be the "waiting for data".

    The PID is dependent on the data?  Otherwise it must operate its own, and Yes, you may have a loop for it.  Should run at a different rate from the loop reading data, you may have a different queue or other means for transmitting data to this loop.

    Another tip would be to define the State of PID as the default state and check for new data at regular intervals, thus reducing to 2 loops (producer / consumer).  The new data would be shared on the wires using a shift register.

    There are many tricks.  However, I would not recommend using a basic FGV as your solution.  An Action Engine, would be okay if it includes a mechanism to flag what data has been read (ie index, etc) or once the data has been read, it is deleted from the AE. 

    There are many ways to implement a solution, you just have to pick the right one that will avoid loosing data.

  • Global variables or shared unique process variables?

    Normal
    0
    21

    fake
    fake
    fake

    MicrosoftInternetExplorer4

    / * Style definitions * /.
    table. MsoNormalTable
    {mso-style-name: "Table Normal";}
    MSO-knew-rowband-size: 0;
    MSO-knew-colband-size: 0;
    MSO-style - noshow:yes;
    "mso-style-parent:" ";" "
    MSO-padding-alt: 0 cm 0 cm 5.4pt 5.4pt;
    MSO-para-margin: 0 cm;
    MSO-para-margin-bottom: .0001pt;
    MSO-pagination: widow-orphan;
    do-size: 10.0pt;
    do-family: "Times New Roman";
    MSO-ansi-language: #0400;
    mso-fareast-language: #0400;
    mso-bidi-language: #0400 ;}

    Given that the
    introduction of shared variables, whenever I needed a global variable, I have
    use shared unique process variables. But I started now return to
    using the old global variable because I think that there are some significant drawbacks
    to the single shared variable. Here is the ability to search for
    case of variables and also the ability to view or change the value of
    the variable (OK, we have the variable Manager, but I found slow and)
    unstable). My question is, are there reasons to use the new single
    process variable actions on old global variables?

    Dear Terje,

    As you use only the variables on a single system. There is no advantage to the use of unique process shared on Globals variables.

    Infact a global variable uses a little less processing power that a global variable as the implementation of a shared variable single-pocess effect is a global variable with the timestamp feature.
    If you use a shared variable single process, if you don't need the timestamp feature, then disable it to use less processing power.

  • static reference with the global variable

    Hi, I used a static reference to a Subvi where I change a global variable before (3-4 years ago) and do not remember how I did it.

    It was something like these attachments, but now I'm using LabView 2013 instead of LV 8.6.

    The change in the overall operating system sees only not in the main vi (looks like the invoke node run vi does not work with globals).

    In addition the vi close with the invoke node close vi but not if I put the custom in the Subvi properties to automatically close.

    dkfire wrote:

    Why not call the sub vi as usual, just with the setting to display the front panel, when it is called?

    Use the connector pane to transfer the value of the sub vi Ok button when done.

    That's what I recommend.  If this is not possible for some reason, then you will need to use a flat Structure of the sequence to force the reading of the global variable after the Subvi is complete.

  • How to change a global variable in a function?

    Hello

    I want to change a globalvariable in a function, as a first step I made in this way:

    class Global_output_class
    
    GlobalDim("Correlation_Status,fail_part,End_Exp")
    dim pouet
    
    Correlation_Status = 12
    Call Correlation()
    pouet = Correlation_Status
    
    Function Correlation()
      Dim Global_output_class_sub
      Set Global_output_class_sub = new Global_output_class
    
      Correlation_Status = 1
      fail_part = 2
      End_Exp = 3
    
      Global_output_class_sub.CorrelationStatus = Correlation_Status
      Global_output_class_sub.failpart = fail_part
      Global_output_class_sub.EndExp = End_Exp
      set Correlation = Global_output_class_sub
    End function
    

    In this case: correlation_status receives a value of 12, then I go to my correlationn() function where it became 1

    Then he comes out of the Sub-function and takes the previous value of the program (12) (I hate that)

    To solve the problem I did it this way:

    class Global_output_class
    public CorrelationStatus
    public failpart
    public EndExp
    end class 
    
    GlobalDim("Correlation_Status,fail_part,End_Exp")
    
    Correlation_Status = 12
    Set Global_Output = Correlation()
    Correlation_Status = Global_Output.CorrelationStatus
    fail_part = Global_Output.failpart
    End_Exp = Global_Output.EndExp
    pouet = Correlation_Status
    
    Function Correlation()
      Dim Global_output_class_sub
      Set Global_output_class_sub = new Global_output_class
    
      Correlation_Status = 1
      fail_part = 2
      End_Exp = 3
    
      Global_output_class_sub.CorrelationStatus = Correlation_Status
      Global_output_class_sub.failpart = fail_part
      Global_output_class_sub.EndExp = End_Exp
      set Correlation = Global_output_class_sub
    End function
    

    This way my global value are copied in themselves after leaving the subprogramme

    I had a lot of variables, is there an easier way for the global variable in a function of change keep the value after you leave the service?

    Thanks for the help,

    Fred

    Hi Fred,.

    It is possible to use a global variable defined, but the best way is to use a function call (or procedure call) with parameters. Please first find the right solution for a function call with parameter and the suboptimal way with a comprehensive valiable:

    dim oParameter
    set oParameter = new cGlobal_output_class
    
    oParameter.Correlation_Status = 12
    
    msgbox "Correlation_Status before Call Correlation: " & oParameter.Correlation_Status
    Call Correlation(oParameter)
    msgbox "Correlation_Status after Call Correlation: " & oParameter.Correlation_Status
    
    '-------------------------------------------------------------------------------
    Function Correlation(oPara)
      msgbox "Correlation_Status in the FUNCTION before change: " & oPara.Correlation_Status
      oPara.Correlation_Status = 1
      oPara.fail_part = 2
      oPara.End_Exp = 3
      msgbox "Correlation_Status in the FUNCTION after change: " & oPara.Correlation_Status
    End function
    
    '-------------------------------------------------------------------------------
    class cGlobal_output_class
      dim Correlation_Status,fail_part,End_Exp
    end class
    
    call GlobalDim("oPouet")
    
    dim oPouet
    set oPouet = new cGlobal_output_class
    
    oPouet.Correlation_Status = 12
    
    msgbox "Correlation_Status before Call Correlation: " & oPouet.Correlation_Status
    Call Correlation()
    msgbox "Correlation_Status before Call Correlation: " & oPouet.Correlation_Status
    
    '-------------------------------------------------------------------------------
    Function Correlation()
      msgbox "Correlation_Status in the FUNCTION before change: " & oPouet.Correlation_Status
      oPouet.Correlation_Status = 1
      oPouet.fail_part = 2
      oPouet.End_Exp = 3
      msgbox "Correlation_Status in the FUNCTION after change: " & oPouet.Correlation_Status
    End function
    
    '-------------------------------------------------------------------------------
    class cGlobal_output_class
      dim Correlation_Status,fail_part,End_Exp
    end class
    

    Greetings

    Walter

  • Retrieve the label of a cluster in a global variable

    Hi guys!

    In my application I was using a bunch of Boolean values for the different types of errors that I could have in my Subvi.

    It was not really practical manage all of these clusters, so I decided to create a world.

    Now the problem is I can't extract the labels and values of this cluster. Before I spent as the thesis reference values, but I think there is no way to create a reference directly from my global variable (cluster).

    As you can see in this printscreen so I created a new table indicator in my VI. But if I add a new Boolean value into my global cluster, I need to create the cluster once again and it is not really practical.

    The goal is to list the errors in a string only if the value is true.

    I don't know if I'm clear, otherwise I can explain more.

    Hi remvu,

    have you tried to insert a "to a more specific class" before the node property-ctl?

    Because you always want to know the names of the Boolean, you really should give it a shot to typedefinitions...

  • global variables for the XML plugin problem

    Hello world

    recently I started working on a dialog box SOUTH, where the user can load the *.xml files in DIAdem.So much my code for the button looks like this:

    ....

    Call the FileNameGet ('ALL', 'FileRead","*.xml")
    Call DataFileLoad (FileDlgName, "XML_Plugin", "Load")

    ....

    And I must say that it works very well! I am able to load all listed in the devices file. BUT when I tried a number of loading devices, I used a global variable, that I defined in the vbscript file that I load the SOUTH since, I've noticed that global variables, I've defined with GlobalDim are not defined in the vbs.:mansurprised of XML_Pluging:

    Then I started to experiment and so far without success, no matter where I define global variables, in my plugin *.xml all not defined! The native commands even and DIAdem functrions does not work. If I run the script in tiara, it shows no errors, but when I use the plugin to open a file, then it gives an error. For example, MsgBox is not allowed.

    I used the plugin example for *.xml, which was published on the Web site of NOR, and I made a few changes. But overall I have it has not corrupted and I kept the same structure:

    Void ReadStore (File)

    Dim XmlFile: xmlFile = File.Info.FullPath
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    'open the file '.
    OpenXMLFile xmlFile

    End Sub

    Void OpenXMLFile (xmlFile)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' Open MS - Xml Parser
    'Create the ActiveX object for the Microsoft XML parser.
    Dim XDoc: set xDoc = CreateObject ("MSXML2. DOMDocument.3.0")

    "Try to load the XML document
    If xDoc.Load (xmlFile) = False Then
    "Failed to load the document XML.
    RaiseError ' unable to load XML document!
    End If

    protected originalLocale: originalLocale = Getlocalte
    "SetLocale" en - us ".

    "The XML document loaded successfully!
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    '----------------------------------------------
    "Read the header information.
    '----------------------------------------------

    Here, I have read some values of the header and then I loop on all devices present in the file!

    So basically I have two subroutines and that's all.

    SetLocale originalLocale

    End Sub

    So what I am doing wrong? Why global variables and other functions do not work. Is it because there is xml code in the script this way or it's a version problem?

    I use DIAdem 10.2. If I use global variables in other vbscripts, I use to draw curves for example I have no problem. Now I'm no *.xml code and no subroutines.

    I'd appreciate any solution that will make my *.xml plugin to work.

    Hi fscommand.

    It is expected all behavior.  Use XML, as all VBScript DataPlugins, runs in a separate VBScript host of the DIAdem VBScript host.  DIAdem VBScript host adds all global variables green and Red controls global to host Microsoft VBScript standard.  Use VBScript host has its own special abilities (file object, root object), but there is NO access to Globals green or red blanket orders in the reception of DIAdem VBScript.  Your SUDialog runs in a third host VBScript, which is separated from the other two and the other two are not capabilities (command SUDialog callback functions), but the SUDialog VBScript host and VBScript tiara share all global variables green and Red orders overall.

    Normally all blue VBScript commands are allowed in all 3 VBScripts hosts, but in the case of the DataPlugins MsgBox and InputBox functions were especially restrained because the dialogues could cause a lot of trouble with the DataFinder.  In fact, they have been allowed to 9.1 tiara which was the latest version of tiara for the DataFinder appear.

    So, why do you want to pass information between the XML use and tiara?  If you want to use to share information with DIAdem, then you should just expose every piece of information as a new property in the data portal, which can read and use the code VBScript DIAdem.  The path of the XML file is already available inside the use of XML.  What other information in the call VBScript DIAdem do you need to share with the use?

    Brad Turpin

    Tiara Product Support Engineer
    National Instruments

  • Global variables are accessible from the local computer

    While he was trying to use RT project, I can deploy the file to the RT target and communicate with the host using a shared variable.

    But the host VI file returns an error stating that the shared in the pattern-block VI host variable is illegal.

    (RT.lvib\Link reqd\ 'shared variable' node is illegal)

    It also gives a description mentioning that global variables are accessible only to local machines.

    What is the cure?

    Hi Shan21,

    I think your problem with communication between the aim of RT and the host PC might be caused by how your deployment of your variables. Please take a look at the following and let me know what you think,

    Kind regards

    ******************************************************************************************************************************************

    When you make the executable of a project using shared variables, you must have a local copy of the variables on the deployment computer that are then linked to the 'real' shared variables stored on the target - cRIO, in this case.

    This means that the display of your project should look like this:

    Note: Two libraries, which can have variables with the same name because they aren't both on the local computer.

    The steps required are:

    1. create variables shared in the normal Manor on the cRIO:

    a. right click on the target
    b. new > Variable
    c. properties of the variables enter the name (stop); Data type (Boolean) and the Variable type (always in network-published).

    2. create variables shared on the host PC:
    a. follow the steps 1 a - c
    b. right click on the box to enable anti-aliasing

    c. linking to the URL of the PSP, click on Browse - and select variable on the target:

    d. click Ok.

    Note: Remember also to deploy the shared manually variable llb. See the related links for more information.

    It's from a base of knowledge to write soon.

    Note:3UCBHM8T knowledge base: how to deploy network Variables shared a compiled executable

  • How to associate existing global variables

    It's probably something stupid that I'm missing.

    I created a global variable and there is a string.  I put it in a file called XML_Global.vi I then proceeded to make an another global var and would assign to the same variable.  However, the IDE shows me an another façade Globals 4.  How can I associate the existing façade of XML_Global.vi with the global variable I PLOPPED down there?  I looked everywhere on how to proceed in the properties and others, but couldn't find it.

    Have you read through this document?

    http://zone.NI.com/reference/en-XX/help/371361F-01/lvhowto/creating_global_variables/

    There may be some confusion about what is happening... When I add a global variable for the rough process, I followed the block diagram is:

    • Open the front panel to the global variable
    • Add FP (there may be several elements in a global variable VI)
    • Save the global variable VI
    • Then drag + drop of my project on a diagram VI
    • Select the variable I want by double clicking on the overall and will select an element > name Variable

    If this clears it for you? Looks like you try to simply place another instance of global variable in the palette of functions and then select the variable to assign this instance to (similar to what you would do with a local variable)? With globals, a new instance of a global VI is created when you drop the global BD... you want to place the world you have edited/saved (drag + drop of project or use the "Select" VI in the range of functions).

    I hope this helps...

  • Why LabVIEW example projects using Global Variables?

    I'm puzzled.  I've been pretty good programmers LabVIEW talks (including some who work for the OR) and came away with the impression that Global Variables should, as a general rule, be avoided, with functional Global Variables (alias VI Globals) generally preferred for "local memory".

    I have studied some of the example distributed with LabVIEW, 2012 and 2013, in particular the proposed acquisition in real time and am struck by the use of Global Variables, where I'd be inclined to use instead a FGV.  For examples, to stop all the loops on the RT target, the overall "All the RT loop Stop" is defined; 'Constants' of configuration (such as timeouts, Streme network names, the names of the journal folder) are kept as Globals; Streme network endpoints are stored in Globals.

    [Note - there is a weird spelling of the second word of the network Streme, above - when I tried to post with the correct spelling, I got an error message saying this word is 'not allowed in this community".]  I apologize for the offense, but I must confess that I do not understand what the problem with the help of the spelling of this word...]

    Why use Globals in these cases, rather than write a bunch of VIGs to hold these data?  Note that almost all these Globals are 'Read' essentially (written once when a resource is acquired, for example) or "Read Only" (treated as if they were a constant).  Indeed, read-only variables can be written as a Subvi with only an output terminal, acting as a (visible, due to the icon) constant.

    I can see advantages to this approach.  On the one hand, VIGs can have error bounds who run the data flow (I just spotted a bug "data flow" in code, I am developing that is based on this model, to read configuration data to an XML file in a world and in the same VI, Global wiring to a "use - me" terminal, but with no guarantee that I'll read the overall after I write it).

    It is, I suppose, a matter of 'speed' - perhaps Global Variables are 'faster' than VIGs (especially if the VIG 'sits' on an error line).  My thought, however, is that this difference is likely to be trivial, especially as these VIGs (or Globals) tend to become "occasional" calls (with the exception of the indicator 'all the loop Stop' which is called once per line).

    Are there other arguments or considerations that make a Variable global to a better choice than a VIG?  Is there a reason that LabVIEW developers put in these start-up of projects LabVIEW?

    BS

    I have to ask, how do you use functional Global Variables?  Like just a Get and Set?  If so, you can use a global variable.

    Yes, globals are faster and use much less overhead.  At the summits of CLA in recent years, we talked about using globals.  The most common use is for Write-Once-Read Many and writing-never-Read Many with configuration data.  It's a good idea to use globals with the constants that can change on you.  It turns out that the world will have the same performance as a constant in this case.  This is done so that you don't have 1 place to edit the 'constant '.

    The rule on "Globals are evil" actually goes back several years when NEITHER had the huge "people of the country are bad" vendata.  But NEITHER explains well how to do things properly.  So I found people, instead of using local variables, using the value property node.  It's even worse because the property causes thread swaps and kills your performance.  It wasn't until I shouted to people to use wires and shift registers I have seen improvements in the way in which people wrote their code.  So people are always riffling in the use of globals and decided to use FGVs with the EEG and fixed rather cases.  But this does not solve the problem of the conditions of race with critical data and you cause an additional burden.

    So from my experience, I use globals all the time for configuration data.  Yes, you must be careful about the race conditions.  But as long as you understand that it is a common and useful practice.

    I would not use a global variable for data that are constantly changing (use registers to offset or Action motor) and/or processes that have critical sections of code (use a motor of Action).

    NOTE: I use the definition of Mercer to FGV (a Get/Set only) and motor Action (many cases which specifically affect the data).

Maybe you are looking for

  • How to restore Vista on VAIO VGN-NR285E the new disk

    My laptop has a new drive after replacing the damaged original disc. The new drive is detected by the BIOS and the works.I'm trying to recover the original Vista operating system and drivers with the Sony Vaio recovery CD of for the VGN-NR285E. The r

  • Programming a module FlexRIO FPGA to computer?

    Hello I'm new to National Instruments LabVIEW equipment. I have a FPGA FlexRIO SMU-7965R module and a RF Transceiver 5791. To use this equipment, do I have to have a chassis (to put my FPGA), or can I simply program the FPGA on my computer (using a c

  • replacement cpu hp dv6 3152sl

    Hello guys, I can explain my problem in a very simple (I hope) I have a hp 3152sl, equipped with a processor HMN620DCR23GMAMD Phenom™ II Dual - Core Mobile Processors socket s1 burned N620 (Caps Lock key blinks once) I disassembled it obvious burn ma

  • Aspire desktop TC-220

    I just bought your desktop TC220 with 12 GB of ram, 1st slot machine has 4 GB of ddr3 memory, 2nd slot has 8 GB of ddr3 ram, seems a weird combination, but I want to add som ram so move th 8 GB slot 3 and buy 4 GB memory ddr3 for the 2nd slice. not s

  • How can I fix my automatic, log on different programs

    At the same time, I don't have to put in my password or some time my ID.    For some reason any that has stopped working.    I have now signed up for either one until I can open some of the prograns.    Can someone help me please.    I am runing Wind