LabVIEW 2010 local variable behavior

HI -.

I upgraded to LabVIEW 2010 of 2009SP1 and the attached sub that VI no longer works correctly.  It is a case of State machine structure that is called inside a loop.  I will put a Boolean variable true local, then on the next appeal when the case changes the variable has been reset to false. He has not done this in LV2009.

Someone tell me immediately I have a race condition, but these local variables are not be written anywhere else, just in these separate cases.

See the attached code, specifically, the local variable 'Activate' is to reset during the passage of the 'turn on' case for case "power."

Anyone else seen elsewhere deliver, or can shed some light?

I've corrected the VI by writing the value in each case, but this different behavior I wonder what are the other issues lurking in LV2010?

Thank you

This code looks more like a kind of a motor of Action that a state machine, but not quite.  It is called several times since a state machine, and he decides who will be the next State according to the entries.  Instead of using all local variables, I would use shift registers not initialized (Nothing cable on the left side).  They hold their value of one call to the other.  A case more will need to be added in this case.  An event of default without a name, which would set the initial values of all the shift registers.  Make the default case and does the same name.  It will be called first automatically because the shift register is not initialized, then the default value will be called.  Inside the default case, set all the shift fits to the desired values.  Next time the Subvi is called, these values will always be there.  As long as nothing is wired on the left side, everything is wired for the shift state register will be the next case called.

See attached vi.  It's broken because I have this thread not to indicators.

Tags: NI Software

Similar Questions

  • LabVIEW: Concerns with local Variables and the readability of the program

    Hello everyone. I was hired for the summer to work at my University to a new laboratory. All right, but I have some problems with my main VI. I am a new user of labview coming from a C++ background. I went through several iterations of adding features, fixing bugs and doing my readable program. Before the last "cleaning" my program was so big that I couldn't see it all at once on my screen. My goal was to solve this problem. My solution contained three parts: use a state machine show parts of my code at the same time, to remove the son as much as possible, and use structures element to position my code manually.

    I met since problems write other programs that brought me here, and I saw a series of messages condemning the new programmers for their use of local variables instead of cables. I do not know my use of structures element as fancy boxes I can exclude the automatic cleaning is also a terrible practice.

    After doing some more reasearch on the subject I see local variables to add the duplicate in memory entries and their suppression can significantly speed up execution time. I have a delay programmed in a part of my code, but the rest can run as fast as he can as far as I'm concerned.

    I have attached my main program. Looking at it I think I did a good job to make it readable. But I'm not a user expert labVIEW.

    How to balance (do not use local variables, these structures element, etc.) efficiency and readability. Before you make these changes, there was so many things and so many threads all over the place that I couldn't even tell what was going on, and even less my teacher. I really wish I could see my entire program without scrolling on this computer of the laboratory (resolution 1280 x 1024).

    Advice on how I can achieve the efficiency, simplicity and common readability would be greatly appreciated. I feel I've done the latter while sacrificing the first two. Ultimately the three should probably be equally important.

    Thank you.

    Nukem

    LabVIEW 2010

    As said altenbach, attach your event structures.  It should really be only need structure of an event, especially for a simple VI like that (I counted 3).  This is the second time I have recommended this today, but fetch JKI State Machine.  I use as the basis for most of my interfaces.

    Here's a way to manage the break with JKI.

  • Write to the faster local variable in 2010?

    I remember a demo of LabVIEW classes which compared to the speed of writing directly to an indicator compared to a local variable and the property node.

    I thought that writing to a local variable has been very slow compared to writing to a terminal. There is no difference that I see with 2010. Maybe I'm not remembering correctly but I know that the gurus OR did a lot of performance optimizations.

    I have more 2009. A person of 2009 or an earlier version can tell me what's the difference in speed between writing to a terminal in the attached vi vs local?

    OR put in place a dorr back to allow the local update quickly. Not as fast as the terminal but fast.

    The draw on the spell-back cmoes in force when you have multiple.

    If you have a large table, you update (big table will make it easier to reference) and there are 20 places that read through local, then the dat should be copied in other residents.

    Ben

  • Question about local variable in LabVIEW

    I am a new bie to LabVIEW.

    I have a question about local variable in LabView.

    I tried to stop a loop by the local variable, but the value of the loop for counter is different with my hope.

    I think that the loop to stop at 6, but he stopped at 7.

    Could someone help me?

    This looks exactly like a race condition.  You have know control if the control terminal is first in reading or the local variable is written to the first.

    Try to run your code to highlight execution.

    In your code, what usually happens is that order is read and the value is false.  Then the other code will run allowing the value to write to the local variable.  Let's say that in a particular loop iteration, we get the True value.  But control of the final value has already been read as false, then the loop runs again.  The next iteration of the Terminal is read and then he sees the true, will force to stop no matter what happens in the rest of the loop the loop.

    So, why do you use a local variable instead of sending just the wire to the terminal stop?

  • Data is not displayed for a local variable Visual C++ 2010

    I am running Microsoft Visual C++ Express 2010 on windows 7.  Yesterday, he decided to no longer display the data for local variables (variables related to level superior OK, under block variable not). I deleted files *.pdb and *.idb and recompiled (off optimization). Microsoft argues it has a fix to https://support.microsoft.com/en-us/kb/2452649 , but looks like they're going to charge me just short of $500 to the difficulty of access. I can't afford the charge. In the past, move to a newer version of Visual C++ and brought me to hire fees to make it work because it is not backward compatible. Any other ideas?

    This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)
    *
  • How can I get the changed data in a def type control containing an Xcontrol with a local variable

    Hello

    I did an Xcontrol and I inserted this control in a def type.

    When I want to change the data of the control with a local variable in a VI the VI change nothing. The change of the data is not complete

    How can I fix this problem?

    Thanks for your help

    Hello

    What is your version of LabVIEW? You have a simple example program that demonstrates this behavior?

    I found an other discussions related to your problems with Xcontrols:

    update of type defs Xcontrol faade

    No data change event generated for an XControl in a Type definition

    XControl facede.vi

    I hope this helps.

    Kind regards

  • Why flatten data chain not getting past all about TestStand via a local variable of the string?

    I tried to go around a series of data in TestStand as a string using "flattened chain" of LabVIEW. When I create a local variable in TestStand of type 'string' and try to write the cluster flattened at this that he simply not transmitted. If I convert the string flat binary table and then pass it around, I can recover all the data very well.

    Is there something I'm missing here?

    I've attached an example Teststand sequence that illustrates this problem. If you run this sequence that the 1st test will fail, which is the attempt to simply pass the flattened string data structure and the 2nd test will pass as it is the binary table that I generated from the flattened string.

    Thank you

    Pete

    crossrulz is correct.  The Null character affects how TestStand handles the string.  You will need to specify the string to a binary string in the list of settings both the VI.  TestStand then encodes the stringso it can prevent the loss of data.

    If you need work on the binary string in TestStand, you will need to convert it to an array of raw data with PropertyObject.GetValBinary.

  • How to set multiple values clustered with local variable?

    Hi all

    Okay, I made my way through Labview for everyone and have some basic concepts down. I can see with a cluster, if acting directly on it, you can ungroup, change values, rebundle, etc..

    I try something a little more complex... and just do not know how to start on this.

    I have a menu menu ring set. I created this with a typedef, with 4 values.  I used this typedef 7 times, more a few LED bool, in a cluster. I made this cluster a typedef.

    Therefore, in my main vi, I started designing, I put an example posted here... and inside, I have two instantiations of the typedef cluster commands selection of left and right.

    I dropped in this vi, a copy of the menu ring typedef (same typedef as in clusters, values) called reset all tubes.

    Now, I am trying to understand how, with an event to change the value to 'reset all the tubes'... that I can start with the left switch and change all tubes (here is the menu ring selector) to the same value as what has been selected with the ring of menu 'Reset all the tubes'.

    I created a local variable for the selector on the left. It is configured to read values. (I'll be doing the same thing with the right too, but just to start with the left).

    In the examples I've seen where access to a cluster, you could ungroup the cluster... browse and change the values... maybe pull out all the "hits" in a table and go through to update the values.  And when you group or ungroup the bunch... you can see the values, etc., when you stretch on the block diagram.

    With the local variable... I do not see to 'stretch' it as I expected... so I can access the values "tubes"... and all at the value of the 'reset all the tubes' ring menu value.

    Someone can put me on the path on the best way to do... or is it a component structure I'm missing here?  Am that I on the right track everything first here?

    It seems pretty basic to me, but miss me just something here on the way to start...

    Thank you in advance,

    Cayenne

    You can't do this with a for loop of how the Department is structured, but why make it so complicated?  Just group the new value in the cluster, as shown below:

    If you do not want to use a loop for example, consider the restructuring of your cluster.  Group ring and a Boolean value in a cluster, and then unmold 7 of those in the cluster of selector.  Then you can use 'cluster to the table' and 'picture of cluster' for all elements of the external cluster will be of the same type.

    Also, be careful when using rings in the form of type definitions.  You probably want to use an enumeration instead.  The elements of a ring do not update the when you update the type definition because they are considered to be cosmetics. the elements of a definition of enumeration type update, because the elements of an enumeration are considered as part of the data type.

  • Code to skip the steps: initialization of local variables failed

    Hi all

    I'm upgrading some software LabVIEW RT I inherited LabVIEW 2011 to 2015 LabVIEW (32-bit) on a host Windows 7 Professional PC. The target is an SMU-8135. The software ran well when it is compiled under LabVIEW 2011.

    I modified the code to enable the monitoring of what is happening by looking at screen on the target outputs. The initial error that brought me here is that a local cluster variable initialized in the first window of the flat sequence described below have been appearing as the in windows later.

    The code begins with the initialization of local variables in the first window of a flat sequence and provides a quick line of text output to the display of the target (call this text #1) (using RT Debug String.vi) I send two lines of text so that a new row is created and later text does not replace it. . It then writes to the next window in the sequence flat screen two groups of text output to the target. Second text in the window 2 (#3 text) output is equipped with a wire entry from the error from the first text output in the second window (text #2). That is the second exit must wait for the first exit to complete before being sent to the screen.

    I see now some weird symptoms:

    1. when I connect to the target under a remote debugging session I see expected display outputs. Not remotely connected, text #2 is displayed. The code passes to the third window in the flat sequence, so everything in the two window should have executed.

    2. the text #1 appears on the target screen * before * I get the message "Welcome to LabVIEW Real-time 15.0." Is this normal? Whence this message? I searched my screws and subvis to this text and it is not there then it mucst come LabVIEW screws somehow.

    This all started with local variables no initialization in the first window, so apparently, I have a problem of data flow. Given that the problem disappears under the remote debugging, I'm a bit of a loss.

    Thanks in advance for any help,

    Eamonn McKernan

    EamonnMcKernan wrote:

    Text 2 appears only when remotely connected it does not appear when running at startup.

    Your "text 2" seems to be powered by a collection of nodes comments to "initialize on compile or load.  This will return once the empty string the first and therefore should not be display nothing until the code I run a second time.  That is the crux of feedback for?

  • Copy a structure of event containing local variables

    Hello

    I am a state machine design in Labview and next state transition logic to wait be clicked a few buttons on the Panel.

    If I press a Boolean button from 1 to 9, next State should be X, otherwise condition (10 to 16 tags) should be there.

    I thought that the right approach, because it would be a structure of the event, where I added two cases: case 1 (button 1: mouse to the bottom button 2 down,..., 9 of the mouse down) and box 2 (10 mouse buttons down,...). For each of these cases, I'm reading & writing the local variable of some double digital.

    When I copy the structure of the event in another case of structure of outer case, I note the following: all cases in the event loop is missing, and the local variable renamed automatically and a new created indicator digital.

    • How to make an exact copy of the structure of the event, without the problems described above?
    • Could you suggest a different approach more effective than mine?

    Thanks for any response.

    Start by reading the guard and recommendations for using events in LabVIEW - LabVIEW 2011 help

    The fact that you try to copy and structure of the event to another, and that a structure of the event will be buried in a case initially tells me you are already heading on the wrong track and yourself in creating a world of problems.  Your architecture will never seem to work for you.

    The event structures are always active and capture events.  Even when the structure of the event is not in the path of execution, it's queue of events to which he attributed to him.  If you have events that are set to lock the façade until full, then you're really screwed because the event structure will capture the event, locking of the front panel and the execution path of your code with the state machine may never come to the specific case that has captured the event to support then release the façade.

    In general, you should have the structure of a single event in a VI, and should not be buried in a case structure where he can never carry.  You also shouldn't have several event facilities manage the same events.   These are not hard and fast rules, but until you are quite familiar with how the event structures work and completely understand the architecture of your code, you should not violate or you will just ask trouble.

    Similarly with the help of local variables.  The fact that you say that you have local variables and you try to copy tells me that you already have too many.  There is certainly a better way to build your VI, which does not require local variables with the exception of a few cases and certainly won't need several structures event buried in the structures of the case.

    You should probably have a producer/consumer architecture that handles the events.  Have a simple loop with a structure of the event which captures all user interactions.  Pass events to a loop of consumer who is also your computer through a queue of State.  (Also known as a computer state in queue or the BAU).  Let the state machine to determine how to manage the events, he received based on what is the current state of the VI.

  • copy a local variable without front double element

    whenever I have copy and paste a local variable in the block diagram, LV automatically duplicate the front panel which is really awkward... is there anyway to stop the duplication of the façade?  I have look all over the place, but maybe I missed something... .Gee where that parameter could be?

    There are two ways to copy objects in LabVIEW. Of course, we're the regular copy and paste. You can also hold down the Ctrl key and click on and drag any element in LabVIEW to create a copy. It is not only faster, but this copy mechanism can be used for local Variables and related nodes of property without too much a copy of the associated control. Check it out!

  • By the way the local variable to a default module

    I use LV 8.6 and TS 4.1.

    I made a custom step Type where I specified a default Module to run and I created a substep VI Edit that the user can move the entry to the default maodule.

    If I pass a value it is working properly. So, I want to pass a local variable, so I have a button in the edict Vi, which displays the property browser dialog box I get the name of the selected local variable. How can I pass the local variable to the default input module? (The value of the local variable is installed during the execution of the sequence).

    Thank you.

    Max.

    Hello

    Yes, I see what your problem is.

    If I am proving a means of suppling a variable as a fixed value or a search string then in my step type I organize the property as a container that contains two properties, one to hold the value and one the search string.

    If you don't have what it takes to change your step types, then you must indicate another to contain this search string, IE a local / fileglobal / global station. Or store it in the memory of your labview. None of them are ideal, as it is best to keep the properties of the step in the step.

    Concerning

    Ray Farmer

  • Cannot insert field or paste into the existing local Variable (Boolean container)

    Cannot insert field or paste into the existing local Variable (Boolean container)...  TestStand 4.1.

    It is very strange, especially since I've done it before.

    'Paste' and "insert field" selections are grayed out and disabled in the context menu.  I tried everything I could imagine and tried various combinations of positions.  I'm sure it's something simple, bu redicoulously, I can't find the redicule to solve this annoying problem issue.

    The local variable is a container of Boolean.  It has 90 elements and I need to add one more.  I can not change / rename or do something with this Local.  Must be karma (for those who know me in the LabVIEW forum).  Usually, you do a right click, insert field and that's where...  Not this one...

    Anyone seen this before?  Closing and re-opening TestStand doesn't change anything.  There is a collection in LabVIEW that feeds the local section in TestStand.

    It is a container of data custm type.  To change flags are ok (edit is allowed).  Can't think of any other valuable information...

    He finds...

    It should be edited in the Data Types...  It was not automatic after reloading the prototype of LabVIEW.

    I knew it was something stupid that I didn't...  I became close... but had not sought far enough.

    I was looking at the range of Types, but not in the file of the sequence...

  • automatic creation of local variables

    Hello

    I have the impression that the idea I have is probably not possible, but I thought it wouldn't hurt to ask.  I connect CAN data using a cRIO and NI 9853 using the framework on the channel of convertion vi.  I have a selector of cases in which the message id dictates the case.  In each case, the raster data are converted and sent to tables for data and the name of the channel.  Then, in a separate loop, I make every tenth iteration in the name of channel and data with local variables and save it to a file of PDM.  I currently use local variables for each table in the selector of the case.  While this works well, I'm trying to simplify it and make it like if someone wanted to add several CAN signals for forest exploitation and so more cases in the selector of the case, they could do with as little work as possible.  In essence, I need to make fake evidence.  The idea that I'm trying to find a way to create a local variable and a specific reference indicator as soon as a case is created automatically.  Is it possible, or I ask much of labview?  Thank you.


  • No material listed in Labview 2010 Linux DAQ

    Hello

    I have a problem with DAQmx Base 3.4.0 under Linux:

    mxbaseconfig shows my NOR-6009 device to the USB port. I can also create tasks corresponding to the nor-6009 in there. When I try to create a task in Labview 2010, one of the constant I/O are always empty. Dropdown menu arrow is grayed out. If I get the name of the device directly in the constant, he through me an error :-( Do not know Semms like Labview, which DAQmx Base instruments are connected...

    With devices VISA, I don't have this problem. All VISA devices are displayed in the dropdown of the constant and work correctly.

    lsdaq gives me:

    --------------------------------
    Detect of National Instruments DAQ devices
    Find the following materials:
    NEITHER 6220: "Dev1" (PXI1::4:INSTR)
    OR USB-6009: "Dev2' (USB0::0x3923:0x717B:0119B3BD: RAW)
    --------------------------------

    I use

    RedHat Enterprise Linux 5.5

    NI - 488.2 - beta - 2.51 b 1

    NI-VISA - 5.0.0

    NOR-DAQmx Base 3.4.0

    LabVIEW 2010

    All installers worked well...

    No idea how to access my OR-6009?

    Felix1234 wrote:

    It the device port ID is connected by a string variable to the Vi DAQmx Base... also works perfectly for me. But I do not know why the variable I/O noit work...

    DAQmx Base does not have controls that LabVIEW as DAQmx done [1]. Because the driver does not use background services, it cannot be said LabVIEW what devices and channels are available on the system.

    [1] NEITHER-DAQmx Base tasks and physical channels are not listed in the task of LabVIEW and string constants and controls
    http://digital.NI.com/public.nsf/allkb/57393FEDF313E99B86256F0B0010AD2D

Maybe you are looking for

  • Do not get reminders on my iPhone since iOS 10

    Since iOS 10, I rarely get my reminders on my iPhone 6 s, even if they are created on my iPhone 6 s.  However, I always get them on my Mac, what do me any good, because I don't always have my Mac with me.  Everything has worked/synchronized Is there

  • Repair Macbook Pro 15 "mid-2010

    So it seems that my Macbook Pro Logic Board may be faulty.To add to that, my fans and my battery had to be replaced as well.I also have the question 'well known' with the graphics card, which makes the system crash when you perform certain actions. A

  • Cannot delete contacts unwanted from windows live messenger.

    I got the Windows Live Messenger 2009 build 14.0.8117.416 steps: (1). Tools, (2). Options, (3). Privacy "Allow and block lists", (4) press the right-click on a contact, the option 'delete' is not operational, only 'block' and 'Add' options are availa

  • U2412M, flashing padlock

    This annoying lock drives me crazy in the middle of the screen. I can't remove it. If anyone can help?

  • Lost laptop free

    I have upgraded to Windows 10 and had a program that was not compatible and I don't like it either.  So, I went back to Windows 7.  Now my free cell has disappeared.  How can I get that back?