How to reset a while loop based on a value change event?

Hi all

I work in a labview program that sends voltage to a laptop via USB 6008, tension is amplified by an op-amp, and then he comes back in the laptop. I created a program and a working circuit, but my current challenge is how to reset the average of the values of voltage coming into the laptop, after that the user changes the digital control (which controls the output voltage). In other words, I need to be able to reset the number of iteration and the sum to 0 each time this happens.

I looked upward to reset the counters of iteration through shift registers, but I'm not sure it will work in this case, but I'm also not sure how to reset the sum of an array (if possible). I have spent a lot of time to read these forums and tutorials from various sites, so I think it can be done with the correct nesting of the case structures, structures of the event and while loops, but I don't know how. I am new to LV, just started to learn in mid-January, so any help is appreciated.

Thanks in advance,

Graeme

You just need the structure of single event with the bargains.  Use the case of timeout to get your new values and find the average (100ms timeout value and get rid of the wait function (ms)).  Keep the amount and the number of items in the shift registers.  Wire these values through each case of the event.  In the event of changing the value: control, just set the values to 0.  Then add a Stop button value change event to stop your program.

Tags: NI Software

Similar Questions

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

  • How to control a VI (with a while loop and a structure of the event) from an another VI

    Hello

    I have the main VI which I want to be driven from an another VI. But I can't do that and I don't know what is happening.

    For example: VI main, I have a while loop with a structure of the event, there is a Boolean controller controlling a Boolean LED, which is inside the structure of the event. And the other VI, there is just a Boolean controller and functions of applications to open the main VI.

    How can I control the Boolean LED in VI main, changing the State of the Boolean controller in an another VI?

    Thank you.

    There are different options, but depending on what you want to do. For this example I can't give you a specific solution.

    I do not understand why you do what you do. Why do you call your 'principle VI' dynamically? What is the advantage to do? There are also other ways to call a VI dynamically, based on real cases (for example the method "call and forget", etc...).

    In you principle VI, control you Boolean ("THATCHER") is not the case of corresponding event. This is not usually a good practice, keep it inside.

    Also, why you try to communicate with the caller and callee VI through such a way to twist? There are better ways to do it.

    In one of my projects, I use the user event to launch orders in case of case of appellant VI.

    some Associates more readings for you:

    http://www.notatamelion.com/2015/03/23/how-to-make-dynamic-subvis/

    http://forums.NI.com/T5/LabVIEW/Dr-Damien-s-development-event-structures-III-communicating-with/m-p/...

  • How to have a while loop inside a structure of matter?

    Hi all

    I would like to know how to control a while loop by using the structure of the case? I would like the person to check if the object has is in its original position or not.

    If this is the case, go...

    The object must then do its job, as mentioned in the while loop... as up and down 10blocks...

    Later, when she returns to its original position, the entire process must stop...

    I checked the forums on this http://forums.ni.com/t5/LabVIEW/How-to-stop-while-loops-inside-a-case-structure/m-p/591259

    It is the closest, I can have... but can someone tell me how to program for this? How logic should be?


  • Control of the event: how to stop the race while loop within a structure of the event

    Hello

    I have some problems with control of a while loop inside a structure of the event (see annex VI).

    I have 3 buttons (the "Start measurement, stop, exit the program"). When a measure is running, it should be possible to stop the measure by clicking on "Stop the measure", but it does not work.

    Someone at - it an idea?

    Thank you very much and best regards,

    Michael

    Hi Michael,

    create a process parallel to your measurement. You can use the design model "producer/consumer with vents. You'll find it with «File-> new...» ».

    Another possibility would be to remove the "lock frontpanel" sign, in the case of event start measurement.

    Mike

  • How to get the ActiveX component value change event?

    Hi all

    LV 8.6.1

    I try to get the ActiveX component value change event. I covered forum and through examples, but I can't get an idea of how "Recalling vi. For example, in the example 'ActiveX event Callback for IE.vi' it is used "recall vi". I've added an example where the change event of value with the mouse to the bottom of the event are scheduled to the structure of the event. Mouse down event OK work but change the value no. Can anyone describe what I need to add to my example vi who value the change event works fine?

    BR, Jim

    Here is the solution! "Value changed event" is not performed in the structure of the event, but in "Reminder VI".

  • How to stop a while loop structure in the event of a main vi

    Hello;

    Sorry for my English

    I have to stop to a Subvi my main VI, the Subvi contains a while loop and an event structure, so I need to stop this loop while I tried directly from my main vi, global variable, but it did not work

    any help please or example!

    How about something like this (solution see attachment) using a user event.

    Explore the User Interface--> range of events and dialogue. To display the dynamic event of the terminals in the structure of the event just right click and select 'display the dynamic event posts '.

  • How to run a while loop for 0.5 seconds?

    Hello

    I am doing a project and I'm stuck with the programming.

    Some time ago in a loop inside a box structure. When the real state of a structure box is enabled, the loop inside, should run for 0.5 seconds. How do this?

    Thanks in advance.

    Why you want to run a while loop? what you do inside that? If you want to perform any operation for a specific time, you can use a loop for.

  • How to 'continue' a 'while' loop using an "if"?

    I have a loop 'while' continuous operation, by taking a step at each iteration. In each such iteration I save this measure unique to the file AND display it on a chart. From time to time, I have "out-of-range" measures, which are displayed as 1E-37 or 1E + 37 on the graph and poured on the record, and are not relevant (for me, it is). With the help of a simple interpreter, like python, I could use an 'if' statement to check if the reading is indeed irrelevant and if so, 'continue' in the loop 'while' so that it stops the current iteration and starts a new.

    How we not implements such a thing in LabVIEW?

    Thank you

    Amit

    Hi Amit,

    There was no 'cynicism', not at all! You ask a few notions of LabVIEW base so I suggested where to find that...

    "but this would require having wrap all code inside the"while"loop."

    OK, then you should explain the difference of a IF/THEN construct textual languages. Made a simple

    IF test

    {do something here}

    ON THE OTHER

    {do something here}

    not wrap the code inside a structure?

    A CASE structure does exactly the same thing and I don't see anything more simple as followed by comparison of two cases. What is complicated in a case around another structure design code?

  • How to run a while loop continuously without iterate loop inside the fi, a condition is met

    I enclose a VI that once the answer 28 comes the loop must stop and loop should continue an iteration. Can you show me a way for her

    You can stop the loop when a certain condition occurs: http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/add_cond_to_for_loop/

    Add a register to offset for the while loop and to implement the feature as below:

  • How to end parallel while loops

    Hi, I'm using LV8.5.  I have 2 while loops, running in parallel.  Loop1 is faster (waiting time of 100 ms) and Loop2 is slower (several minutes waiting time).  I use a local variable (STOP button) Boolean to commonality between the loops.  The button is in the loop faster (Loop1) and the local variable is in Loop2.  When I try to end the While loop, Loop1 stops immediately, while I have to wait for Loop2 finish.  Is there a simple way to make two loops to stop immediately?  I have been using a Control\Stop Application, but may not be the right solution.

    Thank you.

    Hi shanx2,

    reduce waiting time in your second loop and count the iterations instead. The loop will do the same, but the stop will react much faster. Another possibility would be to use a queue instead. Connect to a timeout that corresponds to the current time-out period, you use and send a message to stop the loop. You can choose between the queue has been exceeded or not. Connect this result to the conditional loop. You can send the message from the queue after the first loop was arrested.

    Mike

  • How they intend to while loops

    IM an example to count the number of loops of my program did. However, it doesn't seem to work. Ive attached a DBL the i indicator in the while loop of the block diagram. I joined the program below.

    Best regards, Sam

    While the loop counter starts at zero, so if you want to know the numebr of iterations of the loop, you need to add 1 to the loop counter.

    Your loop will work also only once, if the STOP button is not pressed, since you have time condifitional called loop terminal to to continue if true.  If you press the button before running the code, it won't work twice, because you have the Boolean value set to lock, so when the loop reads the Boolean value, it will return false and stop the loop.

    I think that you want to change the conditional terminal back to interrupt if true.

  • How can I add Auto text based on the value in the numeric field?

    Need help... I'm trying to add the auto text to a text based on a value in a numeric field. I want my text fields (summary box) to say 'Success' if (box score) value is equal to 10 and say "is not good" If the value is less than 10. My digital field is calculated by selecting drop-down lists.

    Thanks in advance for your help.

    Ed Watson

    Here is a link to the document that I created...

    https://files.Acrobat.com/?TrackingID=KGLIT#folder/c3106c32-2e69-4a5f-8ef2-94d25623dbfb

    Try this:

    If (NumericField1.rawValue< 10)="">

    TextField1.rawValue = "does not."

    }

    else {}

    TextField1.rawValue = "passed."

    }

  • How to disable the page for a value change event processing

    I am trying to find a solution to a requirement and is currently working on use cases using the HR schema.

    I have a text entry box in the page that accepts a new Department name.

    The value change listener method on it called a bean of support to verify the uniqueness of the name of the Department. (I'm an iteration through the lines of the Departments table to check if the value is unique)

    Now, I need to disable the page and display an hourglass, so what this control and display a message at the end of the treatment.

    I have this job except that I don't know how I can disable the entire page and see an hourglass.

    I have to use Javascript for this?

    Hello

    I've had this work now after the use of clientListener as below.

    Binding = "#{backingBeanScope.backingBean.IT1} '"

    ID = "it1.

    valueChangeListener = "#{backingBeanScope.backingBean.checkUnique} '"

    autoSubmit = 'true '.

    Validator = "#{backingBeanScope.backingBean.validateDeptName}" > "

    Type = "valueChange" / >

    Thanks for your help.

    References: http://www.oracle.com/technetwork/developer-tools/jdev/1-2011-javascript-302460.pdf

  • How to synchronize parallel while loops?


    This will do what you want?

Maybe you are looking for

  • Windows XP Home 64 Bit edition - could not run any utility from Toshiba!

    I installed Xp pro 64 bit. I found little of some drivers (even some of them are missing), but I can't yet run Toshiba Power saver or virtual sound and function keys! It says I need to install the common Module first, but after installation, he alway

  • Satellite M70-152 - no display more

    Hello The screen went black while I was working. I turned off the laptop and it works again. Now, I see a lot of little colored rectangles. A connected external display shows the same result. Thanks in advanceToru

  • HP Notebook D1E89UA #ABA: enter the password administrator or power on password

    My sister said that someone contacted her and told that the computer had a virus and was asked to take over his cell phone (which she permitted) now it is reading, enter the password administrator or power on password and after the third failed try r

  • HP Pavilion dm3: internal battery dm3

    to get the message that my 601 internal battery will need to be replaced... with the age of my laptop, it may be more cost-effective to get a new computer... If the internal battery goes down, will be the mobile service when it is connected to an ext

  • Recommended structure for separation of measurement and control

    Hi everyone, I m going to write a labview program for a test bench that requires to control external devices via the outputs of the NOR-DAQ modules in a chassis usb DAQ and also various measures of tasks via DAQ modules in the same chassis. The outpu