global variable

Dear all

I create a project in Labview with couple of VI. I use a modbus tcp ip Protocol to read the records of PLC controllers and tcp open blok . In the main screen, I create a Menu with password and username and I want to use this menu to change the ip addresses of the other VI. I did this task with global value, but when I change the work of the value of the other VI fine but when I shut the windows and when I open again the global variable is empty. My question is how can I store the new value?

Hi Bonchev,

Yes, everything is possible...

So I want to configure the ip address of the other VI (I create a menu system to make some changes as the Board of Directors). Then I type a new IP address and close the "vi admin".

In LabVIEW, this is called a Subvi. You can have in - and outputs of a sub - VI connected by wires...

After I opened the main program with tcp connection and ip address is configured and stored.

As you wrote: "are stored. You must store your string in a file...

Then I close the project. In the next time, when I open the project, it must load the last ip address value.

As you wrote: "it must load. You must load the string from a file...

It seems to me you are a beginner in LabVIEW. So, I say take all these LabVIEW free online learning of courses offered by NEITHER. And watching all these example screws coming with LabVIEW...

Tags: NI Software

Similar Questions

  • Using global variables in a device custom

    Hello world

    I have problems with the passing of data through my device customized using global variables. I want to allow a user to select a RIO device address when you set up the system definition file. This is recorded in a global variable using the hand Page VI. I would later use this RIO device address in RT driver to deploy a bitfile. I can hard-code, but it is much more convenient to use a global.

    When I try to store the address of the global variable, it updates the value temporarily (I confirmed that the structure of the event recognizes the change of value). When I click the node of the tree to define system linked to the Main Page VI and then click on it again, the hand Page VI runs again. I wrote the code to repopulate the address of device of RIO with the last value stored in the global variable, but it is empty. I've included the VI global variables in my build, so I can't imagine why it can reset this value.

    Any help would be appreciated!

    Thank you

    Mitch

    Have you tried to use the custom device properties to store this value instead of GVs?

    Configuration VI, you can set this property, and if I'm not mistaken, you can read these properties on the RT driver.

  • 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)

  • Global variables for circular buffer

    Hallo!

    I have another question:

    I need to have a variable circular buffer size. So I want set size circular buffer by a global varable.

    Is this possible? I tried to use the global variable like {VAR_01} to insert in the field that you want to the memory size circular buffer, but dasylab puts only a zero in the field.

    Thank you and have a nice day.

    Hilby

    Unfortunately, it is not possible to have a variable size buffer. Right-click in the textfield corresponding: the shortcut menu does not show an entry to select the global variable from a list.

  • 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

  • Functional Global Variables: an indicator can be used instead of a shift register?

    It is a simple question, but I can't find an answer to it. The model agreed to a functional Global Variable is to use an uninitialized as in this example shift register:

    ('Référence IN' and ' Reference to "is actually a pile of references.) There is also a "Se Refnum" case, which comes the straight through the tunnels shift register.

    My question is, why can't we do store the indicator data? It is much simpler to use a shift register (IMHO a non obvious way to store global data!):

    The case "Se Refnum" does absolutely nothing. Other functions such as erasure of data can be implemented just as easily. The advantage of the FGV to help avoid race conditions is maintained because you always use the VI to access the data.

    JonP says:


    Not so much, the Inidicator can happily live outside the case structure, together and Clear would be just assign different values.

    If you have only a case structure, the indicator could not live outside of it.  In order to maintain the indicator data, your design requires that it is not written in for a case of Get.  If you have an exterior structure deal that decides on 'Get' or 'set or clear' and (in the case of "Set or clear") contains the terminal of the indicator and a classiquee case that decides on 'Set' or 'clear '.  However, I would consider this a design below using the standard template of the FGV.

    The difficulty with retrieving the value if you want to do a read operation / writing change. But LV provides many ways to retrieve data from an indicator (one you don't mention is the 'Value' property), do you mean that's all "incorrect"?

    Yes (I mean that they are all incorrect).

    You could hack your way around the design to work with a single structure of matter and the terminal of the indicator being outside using a method to read the value of the indicator and through a tunnel to the structure of the case through wiring for the tunnel of writing indicator in the case of 'Get '.  However, who will require a local Variable or value of property node.  As I said, these (I only mentioned the local Variable originally) are not good choices for performance and scalability.  If you are not aware of the functional differences between the terminals, local Variables and nodes of property value, refer to this article (obviously advantages/disadvantages such as redraw objects on the front panel are not relevant here).

    I guess you could say that indicators should only be written, but it is difficult to be pure!

    No, it's not, just use the classic design of the FGV!

  • Functional global variables with polymorphic VI

    Hello

    I am keen to build a functional global variable in a polymorphic VI. So, for example in a functional global variable, we have case structure. I want to build separate VI for the structure of the case and make a polymorphic VI.

    Is it possible that I could use a polymorphic VI rather than business structures?

    Thank you!

    You could create a polymorphic VI that serves as a wrapper for the FGV.  The idea is that each instance of the polymorphic VI called FGV with selected appropriate case-sensitive.  Then your API is the polymorphic VI instead of FGV.

  • 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.

  • Slider - setting through global variables

    Dear friends. Is it possible to change the "maximum value" on the module cursor externally, using the global variable?

    I am programming the communication with the shoot-syringe TSA and I need to change the range of rates according to the diameter used the syringe. I can make six different sliders for each diameter, but it is too inconvenient. Do you have someone has an idea? I tried to set the variable to the maximum value in the field of slider module, but only a certain number was possible.

    What DASYLab version do you use?

    My cursor with DASYLab 12 module allows a Global Variable for the Min and Max, and she changes her running.

    A way to tell whether a Global Variable is supported... right click in the parameter field.

  • Using a Global Variable for the input recorder DisplayRange

    I'm assuming; Since I can't do it; that you cannot change the display range of a graphic recorder by using a variable.  If there is a way I'd love to know how.

    Thank you!

    Determine if you can use a global variable is to click right in the parameter field. If the global variable is available in the context menu, then you can use a variable y.

    You can use a variable of the y-axis from the settings.

    You cannot use a variable for the display range of the x-axis parameter. This is because DASYLab needs to know the amount of memory to be allocated at the beginning of the measure.

  • Dynamic read the global variable (cluster)

    Hello!

    I would like to lika to read each control (label and value) in my global variable that contains a cluster. The problem is that I am doing it on a cDAQ and insofar as I undestand and has seen property th node do not have good worl on a real-time target. The code that I've tested so far is as follows:

    It's the main/fornpanel on my cDAQ. The Subvi in the main code contains the following:

    The phenonomen I've seen against hepatitis a is that it works very well maybe the first and second time when I run cod drank for the third time that the labels are empty. I read something that the dose of propertynode does not correctly for real-time target, but it is a way to come to the same solution using only not not the propertynode or you could use the different propertynode?

    Best regards

    Anton

    I solved it by using a library (Cluster Toolkit of Autotestware) to the GE in variant tables and depending on the type, I converted the variant accordingly and saved.  I guess that CVT would be able to do, but since I already use the cluster and they are "already here" it was more convinient for me to use this solution.

  • How to get the value of the global variable to test in the user interface of labview?

    Hello.

    Can someone please share examples and tell me how access the global variable to test using the interface labview user.

    I found some references and obtained from the method.

    I sent the link below

    https://decibel.NI.com/content/docs/doc-5501

  • Get local and global variables using API

    Hi, I do in LV a Publisher for TS. The user should be able to change the value of global variables and the inhabitants of file. Using the TS API, it is possible to get all files of Globals and locals without knowing the name of these variables have ts? I mean, if I knew the name I could use the value of property Get with the search string. But if the I do not know the name of the variable, can I get the list (and their values) of the variable?

    Thank you very much.

    Try the following link

    http://forums.NI.com/NI/board/message?board.ID=330&message.ID=3390&query.ID=6624776#M3390

    In summary:

    Use the GetNumSubProperties method to get the total number of inhabitants / FileGlobals.

    Use GetNthSubProperty to get sub properties using the index starting with 0 to GetNumSubProperties-1

    Use the Name property to get the name of the subproperty.

    Concerning

    Ray Farmer

  • How to keep a relative path in a global variable

    Hello

    I use Teststand 2013 and 2013 of Labview

    Is it possible to set a relative path to a global variable in the Teststand? E.g. "... \vector1." HWS.

    Or should I use Labview functions to solve this problem?

    .

    Thank you

    The railways are much easier to handle in LabVIEW.  Thus, you can store the relative path as a string and then use LabVIEW to make the absolute path.

    I usually store a file into a global variable and then I can just concatinate the strings to build the absolute path.  For example:

    FileGlobals.Folder = "C:\\foo\\bar\\"
    Locals.Path = FileGlobals.Folder + "blah.txt".

  • 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.

Maybe you are looking for