Suspend and restart a while loop

Hi all

After a few TAPI, this is my first post here.

I need to write a simple VI with three buttons on FP: 'Send', 'do not send' and 'Stop '.

'Stop' execution of termites. 'Send' starts sending that one CAN frame on NI USB CAN every 5 seconds. 'Do not send' suspend the CAN communication without putting an end to the VI.

I am not able to find a way to "suspend" the CAN in a loop and then to spin again, I tried to use the queues and the structure of the event, but I can't find a solution to this problem.

I've been searching the net but without success, for example This example is not appropriate because 'stop' does not work when 'pause' is true.

Can anyone of you please give me any suggestion / link?

I'm under LabView 2011 on PC Windows7.

Thank you

Andrea

Thanks Ed, he now works as I expect.

This is the code:

Do you think it's a good solution or there is a "more clear" solution or better somehow to do?

Once again, a big thank you to you two

Andrea

Tags: NI Software

Similar Questions

  • After that 'stop and install updates' on restart it happens to "configuration" 3/3 then restarts then does "configuration 3/3" again and restarts in a loop ""»

    This is windows vista business.

    After that 'stop and install updates' on restart it happens to "configuration" 3/3 then restarts then does "configuration 3/3" again and restarts in a loop. ""» I tried to find out latest fashion good and safe, but still the same. Help, please.
    Is it possible from a different drive to boot and then by applying some changes that would stop it. At the time when the computer is unusable, it just starts to "configuration updated 3/3" then restarts.

    Hello

    Try these methods.

    Method 1:

    You have to do a cold start, press and hold power for a few seconds (10).

    Wait a minute or two and turn it back on.

    Make sure that "all the" non-essential devices are disconnected. (USB keys (for example, flash drives) or any other external media like this takes place.).

    If you can, start safe mode.

    Start your computer in safe mode with network.

    http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode

    NOTE: see 3 from the link above, Advanced options boot (including safe mode).

    http://Windows.Microsoft.com/en-us/Windows-Vista/advanced-startup-options-including-safe-mode

    Select Mode safe mode with networking.

    Method 2:

    Use the system restore feature:

    (a) click Start, type system restore in the Search box or search programs and filesand then click on the system restore under the programs section.

    (b) on the System Restore page, click Next.

    (c) select a restore point during which you know the operating system works, and then click Next.

    The restore point should be a date that precedes the first time you encountered the problem.

    NOTE: If you use system restore when the computer is in safe mode, you can't undo the restore operation.

    See also: error: configuration of the Windows updates failed. Restoration of the changes. Do not turn off your computer when you try to install updates for Windows

    http://support.Microsoft.com/kb/949358

    Data loss caveat:

    Be sure to back up data that you want to keep before you begin. This is to ensure that there is no loss of data.

    Method 3:

    Step 1:

    To avoid this problem on Windows Vista, obtain and install update 937287 from the Microsoft Download Center separately from all other updates on Windows Update site. Install the update that applies to your version of Windows Vista so that you are able to install future updates.

    A software update is available for the Windows Vista installation software feature

    http://support.Microsoft.com/kb/937287/en-us

    The following files are available for download from the Microsoft Download Center:

    Windows Vista x 86 systems

    http://www.Microsoft.com/download/en/details.aspx?amp;displaylang=en&ID=15287

    Windows Vista x 64 systems

    http://www.Microsoft.com/download/en/details.aspx?amp;displaylang=en&ID=23732

    Step 2:

    Save the update to a location on your hard drive, you can find and then install the update from there.

    Download, *Save* and install the update with no security (antivirus/security suite) software installed, disconnect from the Internet, disable the firewall & close all non-essential processes in the Task Manager.

    Disable antivirus programs and firewalls.

    Disable the anti-virus software

    http://Windows.Microsoft.com/en-us/Windows-Vista/disable-antivirus-software

    Windows Firewall

    http://Windows.Microsoft.com/en-us/Windows-Vista/firewall-frequently-asked-questions

    Note: Make sure that you enable the antivirus software, other security and firewall after the test programs.

    Caution:
    Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you need to disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network, while your antivirus software is disabled, your computer is vulnerable to attacks.

    I also recommend taking off of USB keys (for example, flash drives) or any other external media, as this takes place.

    When the file is downloaded, see these steps.

    (a) right -click on the file and

    (b) select run as administrator from the menu.

    Check if it helps.

  • How to pause and resume a while loop with a button

    Hi all!

    I'm back in LabVIEW, after only a few years and I cannot understand, what at first sight seems to be a simple problem!

    All I want to do is have a while loop in which, for the purposes of illustration, I have the 'random number from 0-1' function on the inside, and I want to be able to pause and resume this help from a button. There are a few other posts on the forum that are very similar and do use "event structures. The problem I encounter is that I can get the genarator random number to start the generation but the break will not stop this!

    I have the feeling that I made a stupid mistake - but I can't understand or google my way out the problem! I enclose my solution so far!

    See you soon!

    I did an example (you can drag and drop the image into a labview diagram > = 2014)

    hope this helps (I just did 2 excerpts, it's the same program)

  • Why Ctrl-P restarts a while loop?

    I explore (= teaching myself) how key codes are captured by the structure of the event.  I built a simple test routine (see below) which has a period of 1 second which increments each tick (allowing the program to exit after 30 seconds) and a key down? filter that shows me what happens when I type in various keys.

    When I ran first, I didn't throw it away? Terminal wired and noticed that ^ Q pops up a dialog box 'Leave?', while ^ P emerged from a dialogue box 'Print Screen '.  I wanted to "capture" these strikes to "Quit" and "Pause".  I then wired 'True' to the Terminal, and no additional dialog not popped up (as expected).

    However, I noticed that typing ^ P effect was to raise my time loop (there is an indicator, not visible here, inside the the timer event that shows the current count, 1, 2, 3,..., and when I type ^ P, it restores 1 and start counting again).  I guess that overall the program is restarted, but that he was not aware of this problem!

    Two questions.  First of all, it is documented, and if so, where can I read on ' actions ' of this key combination?  Second, is there a way to 'disable' this behavior and have ^ P considered just a combination of keys, the effect of which is "waived" by the event loop?

    Bob Schor

    Your meter is reset because we did not connect the shift through the key down event register. There is no way to program restarts.

  • Computer shut downs and restarts all while browsing a Web site

    Original post: Windows stops while I visit a Web site and then restart again, also frequently have updates installed and stop to make while I am browsing.

    My computer is ASUS which I bought last month.

    Hello

    1. what browser you use to surf the Internet?

    2. this question does while you are browsing a specific Web site?

    3 - is installs it updates successfully on the computer?

    4. What are the updates that settle?

    Check the event log in the case where the Viewer for any error message when you restart the computer.

    Open event viewer

    http://Windows.Microsoft.com/en-us/Windows7/open-Event-Viewer

    What are the information contained in the logs of the event (Event Viewer)?

    http://Windows.Microsoft.com/en-us/Windows7/what-information-appears-in-event-logs-Event-Viewer

    Also check the history of Windows Update to see if the updates are installed successfully.

    See the Windows updates are installed

    http://Windows.Microsoft.com/en-us/Windows7/see-which-Windows-updates-are-installed

    Please provide more information on the issue so that we can better help you.

    If the problem persists, start advanced boot options, and select Disable automatic restart on system failure to get the error message (it is, follow the same step as described in method 1 and choose disable automatic reboot system error).

    Disable the automatic restart in the event of system failure

    Prevents Windows from automatically restarting if an error of Windows to fail. Choose that this option only if Windows is stuck in a loop where Windows fails, attempts to restart, and fails again repeatedly.

    Consult the following link:

    Startup options (including safe mode)

    http://Windows.Microsoft.com/en-us/Windows7/advanced-startup-options-including-safe-mode

  • Can not on the button while loop

    Hi all... hoping to get a few design tips as I am very, very new to LabVIEW. I got a project that someone else had started and I've encountered a problem that I don't know how to solve.

    I'm using LabVIEW version 8.0.1 and I think my problem has to do with the help of DAQmx in a while loop. In "Working.vi" (including the Sub - VI 'Temp data to CSV.vi'), I copied - and stuck the while loop in a vacuum VI for testing. In this VI, with nothing else, it works - slowly, but it works.

    In the real VI, I can see the data of temperature updated every 4 seconds, so I know that the program is not frozen or something like that. However, by pressing the button "Return to main Menu" does nothing - the image of the button does not show that it is to be depressed, regardless of how many times you click or click and hold the button. I've attached a screenshot of the while loop inside the real VI; I prefer not to fix the real VI (especially because it contains references to many of the Subvi, and it is not currently contained within a LAW degree).

    I'm this coding the wrong way? I have the feeling that it might be caused by my settings DAQmx (continuous samples, 2 samples to read, 250 mHz). The very low rate would be the cause? Is there a better way to have readings of temperature taken every 4 seconds (approximately)?

    You have your case of event the value "lock the front panel" until full?  If so, then no other presses the button will be recognized until the ongoing case event complete.

    It is never a good idea to have a code in an event business that takes a long time to run.  It will make your UI seems to lag or even functional.  Any time I see someone with a while loop inside a case of the event, I'm afraid.  (By the way, I am also concerned all nodes comments hovering over the structure of your event?  What are doing?  Why some operate on the default data?)

    In general, events should take is no longer running then what ordinary person could be expected until they feel like the user interface is delayed.  Perhaps at the top of 1-2 seconds.  You should look at a model of design of producer/consumer with events.  The structure of your event should respond to UI events, then pass orders by a queue path to the part of your program that does the real work.

  • While loop with reading of text file - calendar of events in a given period

    Hello world.

    I created a program that if serial interface via a port to a syringe push in my lab. Currently, the program reads in a text file-flow rate values and sends them to the pump, one by one, through various commands. I need to ensure that whenever a new flow rate value is sent to the pump, it does in a specific/hard time for a while. I.e. every 0.1 seconds, changes in flow rate and must are active until the next period. I tried to use a timed loop and I think I've succeeded, but it hogs system resources, so I was wondering if there was a way to do it using the number of cycles or something of this nature. I just started using LabView, so I'm slowly getting the hang of it (easy when you watch my VI!)

    See attached VI. I took orders from serial port and have instead orders display in an indicator. The nested and densely populated while loop contains the commands that need to be completed/last during the period (like 0.1 second).

    Thank you for your time and help!

    -Phebotalus

    Hi, you should read some introductory material on LabVIEW to down the idea of the stream.

    Basically, the data flow in the wires from left to right, and any node will not work until it has reached all of his contributions.

    The thread of the error is the best way to run data streams.

    ***

    In your VI I use data wires, their execution through structures, and forcing the structures to run in the sequence.  Using a structure of sequence you mentioned in your next post will force the two scripts to execute in the order of (the only one we discussed to be in race condition.)

    Similarly, for brevity, I would wrap the EMO and she is business structure in a single sequence and force it to run last using stream.  In this way the user has the most possible time to decide to hit the EMO before she is called by the application.  As it is now, it most likely is interviewed at the beginning of the loop, so if it's the exchange value you won't see results until the next loop.

    When running in execution of highlight you see the order of data flow, but that is not guaranteed to be the same for a normal performance, where the use of the data stream.

    ***

    The counter tick account ms up to a very large number and then "says" reset and start counting again.  I know you want to START the loop as close to every 10 ms.  Yes, using data flow, take the number of cycles first, perform actions, then return the number of cycles.   The second time of the tick read that you are in a nested loop that does not stop until you get 10 or more difference on the number of cycles.

    And, on the off chance that you must achieve "return" on the tick counter comes stops the nested loop then move.  (if the second measurement is less than the first, then the tick counter handed.  If you miss this situation while you'd have to wait a long time for the condition of the difference > 10 in the reunion, basically locked in the loop.

    ***

    You could put the EMO sequence, we have seen, in line with data streams.  Before or after the second control of ticks will not make much difference in terms of 10ms.  I would put it after checking the tick, again give the user more time to hit the EMO if necessary.

    ***

    I put in a queue for the stream error and removed the other stuff.

    LV2010

    Check out some of the LabVIEW intro docs, they are online, they discuss these issues and much more.

  • Start stop while loop with tab control

    I want to be able to start and stop a while loop by entering and leaving a tab.  I use a structure of the event to do so, but it seems not elegant or the right way to do it.  The only way I could get to the kind of work is by unchecking the lock front panel in case of structure.  I have attached a sample vi of what I have so far.

    The problem is that you can't even stop the program by pressing the stop button until you exit the tab, which is not a user friendly interface.

    The event should just manage basic user events.  Any given event does not take a lot of time to run.  While you are in the diagnostics tab, your code is stuck in this while loop.  Although the setting of the front panel of the lock allows you to do other things, the LabVIEW is just put on hold all these other events of the UI (like Stop button value change) and cannot handle them inside while the loop stops and allows outside while loop to go through again.

    You should have a parallel while loop to manage waveform graph.  You can use notifiers or queues or a motor of action FGV (see Ben Action Engine Nugget) to switch the starting or stopping of the update of the chart of waveform until the parallel of while loop.

  • Reset a loop counter and restart the calculation

    I have a while loop nested inside a loop for the calculation of a model.

    Lets say that I am on the loop for counter 4. Suppose that I wanted to keep track of the number of iterations on a while loop, and if it exceeded a certain 100, exit say number the while loop.  I do this to avoid my model of computation being blocked somewhere due to optimization problems. Now, I want to restart the loop counter calculations 4.

    Is there a way to do this in labview?

    Well first of all, if you want to start the same program inside loop after it got stuck is going not only to get stuck again creating a permanent loop in the code? Would you not just to go and have some sort of identifier as one of the loops is stuck?

    But I recommend just nesting your while loop inside an another while loop, and then connect the output to the out-while loop to a variable of the while loop inside, so if optimisation did not appear correctly then it simply repeats the inner while loop.

    Although I am of my thoughts that you will end up just straight up in a loop permanent if optimization fails the first time.

  • How to do while loop that runs and re - index reset continually

    Hello

    I'm trying to send and read data through the serial port. I'll send separate strings that are stored in a table and the serial port read a value that is returned from my instrument for each string that is sent to it. The table is indexed by the 'i' in the while loop. My problem is, the while loop runs until it reaches the maximum array index + 1, then stop. I would like to have the index restart to zero once it reaches the maximum of 'i' - value, then it returns the values of my table again. It is essentially a program to monitor for an instrument, and I need to continually update the variables in the monitor. I'm new to Labview but is really cool! If someone would be kind enough to help, I would really appreciate it.

    Thank you

    Mike

    Anil Reddy wrote:

    What about using another loop

    Nested loops...

    Please do not do this.

    A Quotient function and the rest is all you need. Entry is equal to the size of the array.

  • While loop, wait for the function and the stop button!

    Hello

    I have a while loop and a stop button. Inside my While loop - I have a 'Wait (x ms)' function. If I press the stop button, it does not block the program immediately, he expects ms x then stops the program. How can I get rid of this?

    Thanks in advance for the help!


  • Control and Simulation in a loop / while loop with TCP/IP reading / writing of synchronization

    Hello, I have a problem with reading TCP/IP and written in two loops. The problem is NOT to get the two loops to read and write to and from the other. This has been accomplished. My problem is when I run control and the loop simulation on my laptop and the while on a RTOS remote on the controller on-Board of LabVIEW in a remote PXI chassis, the while loop the remote system running on four 4 times faster than the loop control and simulation on my laptop. In other words, for each iteration of the loop control and simulation on my laptop, there are 4 four iterations of the while loop on the remote system. I need to know how to get a degree of kinship (1:1) with these iterations of the loop. When I run a longer simulation in real time, say 10 seconds, the control and Simulation loop begins to slow, i.e. the simulation time slows down until it is no longer in real time and the "Late Finish"? Parameter is set to true and the LED lights and continues to stay lit. At this point, the system destabilizes due to what I believe is being well sampling rate too discreet and I have to end the simulation. How can I get a ratio of one to one between the loops and also to avoid slowing the loops causing destabilization?

    To give an overview of my application, I implement a control system in a network, seen in "image2.png". This is achieved using my laptop as a subsystem 1. Reference signals are generated from the laptop and the error signal is produced. Control measures taken and the control signals are sent via TCP/IP to the remote system. Position feedback is returned, and the process repeats. My system has Core I7 Procs w / 3 GB of RAM, up to 1 GB/s speed via ethernet and LabVIEW 2011 installed with all necessary modules and networking tools. The attached VI Custom_Wireless_Controller works on my laptop. The remote system I'm working on that has the 7830 NI R Series with FPGA card. OTN runs on the PXI chassis with an enbedded controller that has networking capabilities of up to 100 MB/s via ethernet. I use the FPGA for the acquisition of data and apply control signals to my plant. The plant is the PCE twist connected to the FPGA through the cable of the ECP - RIO of NOR. Subsystem 2 is this side of the CNE. The FPGA collects position, he sends to the controller via the network, receives signals from the network drive and writes signals to the plant power amplifier that operates the plant. This process is repeated and the VI and is titled Custom_Wireless_Plant.

    I appreciate the help really and look forward for her and for any question!

    Well, the first step is to understand what you have set up right now. Your control and Simulation loop on the side of the controller is configured as 'Runga Kutta 4' and you have a loop timed on the other side. In addition, you have the primitives of TCP/IP on the control and the Simulation diagram and means he will perform (a message) on the size of each minor step, which in your case is 4.

    So, you have two options:

    1. replace the Solver side controller Runga Kutta 1 (this must synchronize loops)

    2. hold RK 4, but create a Subvi around two primitives of TCP/IP and configure from the VI to run than the major (continuous) step-size. If you do it right, you should see a 'C' on the upper right part of the VI you have created.

    Please let me know if what I said is not clear...

  • Stop and start the task in while loop

    I try to start and stop an output meter (creates pulsed output) in a while loop and I don't know how this is possible. I have a while loop running who is taking measures from a digital compass. If my title is within acceptable limits, the outputs of the meter (2 of them to turn to the left and right) must be turned off. If the title is out of the acceptable range, let say too far to the right, I want to start one of my outings of the counter to activate the object to the left. The issue I am having is that if I put the block 'Start the task' in the while loop the system will try to start each iteration of the loop, even if it is already on. I don't know if there is a problem, but it does not appear effective from a programming perspective. I remember reading somewhere that stop and start tasks can really slow a loop. Any suggestions?

    I actually just to understand it. If you use some if statements and the "fact of task is" block you can make it work.

  • while loop: delay enforcement and continuous updated: VI back to fake out of time?

    Hi all

    I want to control the time of execution of a while loop. I want the user to have the ability to decide how long he wants to run the while loop. The while loop is used to update certain values, then it should run continuously, not only run once and wait (that I could easily using the synchronization functions).

    I used the time up VI as suggested in this post:

    http://forums.NI.com/T5/LabVIEW/how-to-create-a-time-control-for-while-loop/m-p/2530212/highlight/FA...

    and works well, but the while loops are integrated into another loop for and when Goes to the next iteration, the elapsed time Boolean result is set to true and it does not run at all (I think that's the problem).

    Can I return the Boolean result of the elapsed time VI to false, after reaching the target of time? That would solve my problem, I think that...

    I attach some of my VI, although I don't know that it could be useful for you...

    Thanks for your help

    Use the iteration for while loops count and an equal to zero? node.  Then the output of the comparison at the entrance to reset the elapsed time functions.  The idea is that reset you on the first iteration (when I = 0).

  • While loops and event structures

    Is there a problem using more then one While loop with an internal structure of the event, in a single VI?

    In my (only a partially attached printscreen) VI there is more then 2 all in curls with a structure internal even who controls a different devices.

    Event structures are being controlled by a box structure.

    From time to time the VI gets stuck and resetting local variables.

    Hello

    Using two while the loop is not a problem, it depends on how you structure the code.

    Generally, we use two while loop for Producure-consumer, master - slave structure type of applications. Try to use the structure of State machine inside while loops, see standard state machine examples in the palette of NOR find example.

Maybe you are looking for