Enter the external value in the while loop

Hello, I have the following problem. I am beginner labviewe and I created a simple program to record data and control a laser printer driver. The problem is:

at the beginning, I'm in the temperature values and current - they must be outside of the loop, because I want to include these start values in the header file that I add the file initially.

Then I go into the loop, but if the control is on the outside I can't change the value more.

So here's the question: what to do to be always able to change these settings without creating more control?

Sorry for the mess in VI, but I'm just getting started.

Thank you very much

Maciek

Hello

A quick solution, create a local variable for the control to use in the loop. Best solution, plan to implement a state machine design model so put everything before the loop in the first State, before moving on to the main report (the stuff currently in your loop). In this way, you would be able to access the control of these two cases which is preferable.

Hope that helps,

Tags: NI Software

Similar Questions

  • store the value obtained in the while loop

    Hello

    I'm data acquisition (1,000 points every 0.1 s) in a while loop. I would like to calculate the average y of the first sample of 1000 points when I click on a Boolean 'calibrate', store that value somewhere (outside the while loop?) so that it can subtract from each new amplitude y. In the vi below, a new average value is calculated in each loop, although I would only use the first.

    You don't need to store the value outside the while loop. Keep the offset of the value when calibrate button is pressed and subtract the value with earned value. I modified your find VI the VI attached.

  • How can I update the values out of while loop

    The LabView waveform chart updates every 0.1 sec.

    When a user clicks on a button, I want to LabVIEW to wait 5 sec and beep for 5 sec.

    Meanwhile, it should be to update permanently the wavefrorm graph.

    When I have the structure case inside the while loop, it interferes with the updates of the waveform graph.

    When I structure case outside the while loop, the structure of the case is never executed.

    What can I do?

    I thought about it using the example of design of producer/consumer model.

    http://decibel.NI.com/content/docs/doc-5404

    It allows a variable that is updated in a while loop to update outside the while loop while the loop is running.

  • How the entry changes with each iteration of the while loop

    Hello

    can anyone explain (clarify) to know how or what contribution will be fed like the d block of adaptive filtering for the first, second entry (n) and remaining iterations of the while loop as shown in the picture as an attachment...

    As I need to feed the e (n) out of the while loop as input d (n) to the Adaptive block for the first iteration for the next iteration of the previous output e (n) of the block Adaptive must be fed back as input (n) d and other x (n) of entry form the DAQmx.

    Thank you.

    You have a shift register on the edge of the loop, so for the first iteration, the input (n) d will get everything that feeds the shift register on the left of the outside. After that the adaptive filtering performed, e (n) is injected in the shift to the right, register to be read from the shift register on the left on the next iteration. And so on. This seems pretty much what you want.

    PatanGova wrote:

    As I need to feed the e (n) out of the while loop as input d (n) to the Adaptive block for the first iteration for the next iteration of the previous output e (n) of the block Adaptive must be fed back as input (n) d and other x (n) of entry form the DAQmx.

    If you need retain the value in calls, use a node that is initialized in the world of feedback to feed out of the while loop at the entrance.

  • How to add the unique element (inside the while loop) to itself

    I have only digital output element that is in the while loop. Its value changes in each time the loop iteration. If lets say I want to adds the values of the ten first in iterations of the loop of this variable.  How can I do that.

    See attach image for more precision.

    Thank you

    JK

    Hi Joseph,.

    THINK THE STREAM!

    As the values are stored in the son and the shift registers (and NOT in any kind of variables), you must use these fundamentals of LabVIEW:

  • For results outside the while loop

    Dear friends,

    I have a while loop vi, which is attached to this mail. I want to update Boolean Boolean results, while the while loop runs. In fact this is not the case?

    Do I need to use it as a global variable or another simple method to do? Could you please guide me, or please alter the VI of the sample which is attached to this mail.

    Thank you

    Best regards

    Tom

    The Boolean value outside of the loop only will be updated, as wiring system, when the loop ends, it's how the LabVIEW data flow. The simplest method for updating the Boolean value outside of the loop is to unplug the wire, create a local variable (right click on the device, select 'create', 'Local Variable'), move the room inside the loop and hook it up to your function "equal." This is not necessarily the best method, just the easiest for this example.

  • To break out of the while loop (1)

    Hi all

    I have a simple question that if a callback to a command button function, I use a (bLoop) While
    loop, where bLoop is a boolean variable has the value TRUE, then how can I break up or out of this while loop by using a control on the façade, which released the while loop by setting bLoop = FALSE.

    I tried, but it didn't come out

    The problem here is that the CVI normally only runs a reminder at a time. While you are in snooze control, no treatment of GUI and subsequent calls to other reminders usually occurs.

    You can try the following approach-, but it's not really the best method:

    While (b_loop) {/ / within a reminder}

    ... / / Do your tight loop

    ProcessSystemEvents ();   Force the CVI to see if all the GUI needs maintenance controls

    }

    If you have a reminder of different control to erase the global b_loop, this packing approach might work for you.

    You must use this technique for very simple programs - it can quickly escape out of control and in the end upward in a mess if you're not careful. OR recommend that you use not ProcessSystemEvents() within a point of order.

    JR

  • delete 2d array in the while loop

    I have a table 2D being initialized outside of the loop executing a state machine, how would a clear table 2d in the while loop? I guess I'm not sure what to wire a constant matrix empty 2D too =)

    When you want to erase (regardless of this Boolean condition), wire just a constant matrix 2D of your shift register.  See attachment.

  • How to create a control of time for the while loop?

    Hi all

    I want to control my time running of the loop. In other words, I want to stop everything in the execution of the loop after a time (in ms) that is defined by the user. For example user defines Control Panel for 5 seconds before a while loop runs and stops after 5 seconds.

    I don't know is it possible with the while loop. I managed with the timed loop, but this must be wrong with my application. Y at - it of the other loops for timed control if it is not possible with while loop? There is also a simple loop with .vi random number (0-1) as an attachment.

    Best regards

    Jick

    Hi again,

    I managed to solve my problem right after I posted my first message. I did it with the passage of time and the register shift (for the elapsed time of reset).

    Thanks for your replies anyway!

    Best R

    Jick

  • Table 1 d in the while loop problem

    Hello world

    I searched this problem in the forum, but seems only some positions quite didn't answer.

    I'm stuck by saving the data in a while loop.

    I have a while loop, within which there are two exits in each iteration, I want to add to a table, and then after the while loop is completed, I want to combine these two tables in a 2D array (since the release of them must be a pair in my case).

    I tried 'Build array' and 'transpose array' and 'write in spreadsheet' element set, which maintains concerns me is how simply to add the result in a 1 d table during each iteration, these 2 outputs are in digital format, which prevent to directly create a table for it.

    Any idea is appreciated,

    Thank you

    Chen Kunsheng

    Here are some other ways to insert.

    It may be useful

  • Force the While loop to exit when the delay is running

    Hello guys,.

    I have a While loop containing some jobs. One of them is delay for 10 seconds. When I push the stop button, the loop does not stop immediately. Instead, it stops after a few seconds (can be, pending other jobs is done).

    What can I do if I want to stop the loop immediately after I press the stop button?

    Thank you for sharing...

    Hello Yoppy,

    I don't know if I understand your problem completely, but here's the method I use to stop the while loop immediately (some ms delay will be there for you).

    I would like to know if the attachment helps.

    There are several ways to do it and you can get better solutions than this one on this community.

  • URGENT::opening multiple files - i have 3 files in my directory... When I run the code I can open a file and read it... but the while loop get blocked after the first iteration... can someone me help or give some indications

    bbmChatDB of public database;

    public static FileConnection fconnRead = null;
    public static String fileReadData = "";
    public static InputStream is = null;
    data Byte [] = null;
    DataInputStream is = null;

    Here is my code...

    I have 3 files in my directory... When I run the code I can open a file and read it... but the while loop get blocked after the first iteration... can someone me help or give some indications

    try {}

    FileConnection fc = Connector.open("file:///store/home/user/documents/BSM/") (FileConnection); "

    If (fc.exists ()) {}

    Enumeration e = fc.list ();

    While (e.hasMoreElements ()) {}

    System.out.println ("files are:" + (String) e.nextElement ());

    play this file
    StringBuffer stringBuff = new StringBuffer();
    try {}
    System.out.println ("opening file")-;
    System.out.println ("file name is:" + (String) e.nextElement ());
    fconnRead = Connector.open("file:///store/home/user/documents/BSM/(String)e.nextElement(),Connector.READ_WRITE) (FileConnection);
    System.out.println ("data length")-;
    If (fconnRead.exists ()) {}
    is = fconnRead.openDataInputStream ();
    data = IOUtilities.streamToBytes (is);
    Ddd = new String string (data);
    fileReadData = ddd.toString ();
    System.out.println ("length of data:" + fileReadData.length ());
    System.out.println ("read data :" + fileReadData);

    }

    } catch (IOException ee) {}
    ee.printStackTrace ();
    System.out.println ("Exception in the read data :")
    + ee.getMessage ());
    }

    }
    }

    } catch (IOException e) {}

    e.printStackTrace ();
    }

    {Finally

    try {}
    If (is! = null) {}
    is. Close();
    }
    System.out.println ("is closed...");
    } catch (IOException e1) {}

    E1. PrintStackTrace();
    }

    If (fconnRead! = null) {}
    try {}
    fconnRead.close ();
    } catch (Exception e) {}
    System.out.println (try ());
    }

    }

    }

    You can recode this treatment so that it uses only:

    e.nextElement ())

    Once a loop iteration.

    Directly at the start saying something like:

    String fileName = e.nextElement ());

    and use fileName everywhere in your loop.

    Also be aware that printStackTrace() will do nothing in your situation, it only works if you catch Throwable.  So make sure you something output all your catches exception and also have a catch (Throwable t) to catch the things you miss, as follows:

    {} catch (Throwable t)

    t.printStackTrace ();

    System.out.println ("Eception exception:" + t.toString ());

    }

    I think your code is thrown an exception and you don't see it.

  • Retaining the last value without a while loop

    Hello

    I'm using LabVIEW 2013. My VI is attached. I'll send in a 'Curr. Random random numbers TestPlan Row"time. I'm eager to keep his last number, whenever this VI is not called and then reset the value to its new value whenever the VI is called again and a new number has been sent. Also attached is a screenshot at the VI.

    Please note that I can't use a WHILE loop, so it must keep its value in a different way...

    Thanks in advance for any help!

    SM

    Maybe a feedback node?

  • How is it my local variable is not updated its value compared to what is happening in the while loop?

    Hello

    I am trying to extract data from a time that my statements updated in what concerns the number of loop iteration. I tried to use the two local variables and travel records, but without success.

    I also did the following example: http://www.ni.com/white-paper/7585/en and it works like a charm.

    I've attached the PNG file with declaration of the local variable circled in red. Join a VI in the next respnose.

    Thank you

    No, the two while loops are stacked and not parallel, which means the outer loop cannot go to the next iteration until all code in this document, including the inside so that the loop is finished.

  • How to stop the While loop in the Structure of the event with the same button?

    Hello

    I have a problem. I want to use a single control to activate an event in a structure of the event and the same control to end a while loop in this case.

    It is possible to use 2 controls to do this, but I need to be alone.

    Thank you

    You should NEVER place while loops inside the case of the event, and it is never necessary to do. Think about it: all you have to do is spin the code. You can easily use the outside while loop for everything. Simply place the code of the loop internal (without the inner loop) inside the case of delay and manipulate the time-out period between a pending finished and the infinite (-1), depending on the State of the Boolean value.

    A very simple example (LV 8.0)

  • Strange behavior of the WHILE loop

    Dear experts LabVIEW

    I would ask you to give me an explanation of the behavior of the very simple VI as an attachment. This VI contains a WHILE loop with three parameters, input and STEP. The table of RESULTS shows the calculated values. Considering the input parameters OF = 0 TO = 1 LEVEL = 0.1, then the RESULTS table contains the values 0, 0.1, 0.2,..., 0.9, 1. Considering the input settings ON = 1, TO = 2, STEP = 0.1, then RESULT table contains values 1, 1.1, 1.2,..., 1.8, 1.9. The question is, why the number 2 is missing?  (I also tried to use different types of data, but without success). Thanks for your thoughts.

    Juraj

    Because you compare floating point numbers.

    For example, 0.1 cannot be represented in exactly in binary, cela repetitive additions probably will not end in an exact integer later.

    Since the three entries, you can calculate the number of values exactly and use a loop FOR. Do not use the convoluted code...

    Why not just use ramp model?

Maybe you are looking for

  • iOS music player glitches

    Hello everyone. A year ago, I received an iPod touch of 128 GB. It has been a very good product, and I have never had a problems with it, apart from a few strange occurrences with iOS music player app which unfortunately have very frustrating and tim

  • Scratches at the bottom of the screen

    There are scratches or clear spots at the bottom of my screen (mid-2014 MacBook Pro 2.8 GHz, 16 GB RAM, 1 TB HD, retina - all original, OS X 10.11.6 beta - 15G19a, Iris Pro 1536 MB Intel display set to 2880 x 1800).  I tried to capture in a screen sh

  • L how to be more friendly firefox on a windows 8 10 "Tablet?

    Hi, on a 10 '' tablet with windows, I find much harder to work firefox only the with a mouse. On the desktop with a mouse, I love firefox and thunderbird. On the tablet buttons as bookmarks are too small, and when I try to scroll, text gets highlight

  • Qosmio X 500-Bluescreen

    Hi allI apologize immediately if this is the wrong forum or if this problem has been answered before, I couldn't find anything...My 2010 Qosmio X 500 - 10V - which always worked well yesterday - welcomes me with a blue today screen. Error code is:0x0

  • I forgot the BIOS administrator password

    I forgot the BIOS password here is the code: [84050049] I'm not a hardware programmer, can you tell me a steb by step what I have to do... to recover or reset the BIOS. Thank you!