Restarting counter in Timed Loop

I have a timed loop inside a state machine, used to start/stop a data acquisition sequence.
It works fine, but I'm monitoring the "i" count and Actual End [i-1] values and after the start/stop/start sequence
these values continue to grow and don't get reset to zero.  I would expect a While Loop to reset the "i"
variable every time is is called, but I don't see any option for resetting the time looped.
I can get around it, but I would expect a reset method for this loop, so I'm just wondering if I'm missing something.
Maybe I need to use "Create Timing Source" instead of the setting it iin the dialog box?
Labview 2010f1 on Windows Vista SP2 PC

This might help. Here is a part of the png file you posted. I put in "Structure Name>" to point to the Structure Name input. Notice that the name "bob" is listed as the Structure Name. You must be on Win7 which uses different fonts than XP - that's probably why the name is only half visible.
Note that the Clock name is connected to the (timing) Source Name input.
I'm attaching an updated version of the file with the Timing Loop name wired directly.
Thanks for posting your timed loop interations3 program in 2009. When I run this code, the Iteration Count DOES reset when the Timed Loop is restarted.
steve
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
Attachments:
New timed loop interations.vi ‏42 KB

Similar Messages

  • How can I count the number of times a timed loop finished late?

    I am getting occasional timing errors in a timed loop under windows XP and would like to count the number of errors, but I can't find a simple software counter vi

    The timed loop has a terminal (boolean) to indicate if the previous iteration finished late. Just increment an integer shift register if this happens.
    The attached shows a very simple demo (LabVIEW 7.1).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    LateCounter.vi ‏76 KB

  • Using timer/counter with PCI-6221/USB-6210 to control timed-loop VI

    Dear all,
    I need to ask about two devices and one of their functionalities, PCI-6221 and USB-6210. For our NI-based system, we need to control some timings in a Timed-Loop vi, for that currently we are using PCI-6221 and we give external TTL signal (at 1 kHz) to it,
    recenntly we need to make some changes and for that we found USB 6210 DAQ to be more suitable, but we need to clear ourselves on some specific things.
    Can the counter/timers functions available in the either PCI 6221 or USB 6210 can be used to control the Timed-loop VI by giving external clock or by using their own internal clock source?
    Although we are using external clock with the PCI 6221 but we want to know about the usage of their internal clock, also are controlling timed-loop also possible for USB-6210
    Also... What if we use the RTOS, are they still able to control the timed-loop VI  without giving any 'EXTERNAL CLOCK' and using the internal clock sources of the DAQs
    Waiting for reply,
    Bests,
    RaJaf
    Solved!
    Go to Solution.

    Ben,
    I having read previous email which I send earlier with general overview, we discussed in more detail within our team and I am giviing the specific answers.
    Please check in RED the most recent answers. Blue are the questions/suggestions by your side.
    1.    Using Internal hardware clock of PCI-6221 would enable us get rid of external clock, but how to divert the internal hardware clock to the current settings. Any idea  (can you provide us with some reference manul for otherwise). I mean is there some flag-bit etc. or VI
    2.       Is it also meant that with the installation of RTOS the timed-loop can directly get the timing source from the internal hardware clock PCI-6221? --- How???
    3.       In order to make desktop to work as RT system, what is the hardware (motherboard, processor, etc..) requirement? What are the LabVIEW modules (specific name) that needed to be installed? Our platform is LabVIEW 8.6. (Currently we have windows-7 with i7 core processor)
    What kind of application are you intending for this system? ---- high-speed laser scanning system.
    Are you most concerned about accuracy, speed, or responsiveness? To control the laser mirror scanner to move at 1 kHz or 2 kHz speed. On the other hands, using PCI-5105 (128 MB memory) as a DAQ for real-time/on-the-fly data processing.
    Bests,
    RAJAF

  • How to pause and restart a timed loop in Labview

    I am trying to pause and then restart a timed process (series of stepd that happen at precise times), which is implemented using a timed loop.
    I was wondering if anybody out there can give me a hint.
    Thanks

    Roxanne,
    Well, it's not exactly a "pause", but here's a way to stop and re-start your Timed Loop.
    See the attached example in LV2010.
    A While Loop and a Queue are used to allow you to start and re-start the Timed Loop.
    The "Stop Timed Structure" vi is used to stop the Timed Loop.
    Releasing the Queue stops the While Loop when you end the program.
    Note that the example is very similar to the NI template "Producer/Consumer Design Pattern (Events)". (File>>New)
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.
    Attachments:
    timed loop.vi ‏39 KB

  • Why do we lose counts through a timed loop?

    I have written a program to count the rising edges of a square wave produced by a function generator using the DAQmx functions. The counter is read in a time loop with a period of 1 second, so we take a sample once every second. It appears that the program is working correctly accept for the fact the the counts are continuously 2% lower than they should be. We are guessing that this is due to the fact that the timed loop really isn't taking a full second to complete each iteration. Any suggestions on how to fix these timing errors? The counters are read from the NI 6608 Device if that is of any help.

    Please post images of your code so that we can be off assistance.
    Thank you,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Strange DAQmx Timing Source Timed Loop Error

    I have a digital edge counter fed into a timed loop. Everything works fine until I stop the loop, and stop the DAQ task. Once I restart the loop it fails with "resource is reserved". Attached is my code.
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    daqloop.JPG ‏136 KB

    Here is a piece of code to illustrate the issue. If the timing source is created in the loop (it will be created each loop iteration) the error occurs. If it is moved outside the loop, and only created once the issue is resolved. Is there a way to RELEASE the timing source so that it can be created again? If the VI is stopped, this "resource" is released. I want to programatically release it.
    Note the error comes from the timed loop Error terminal that is Probed (50).
    Message Edited by bkb on 10-08-2008 09:52 AM
    Message Edited by bkb on 10-08-2008 09:53 AM
    Attachments:
    ts.jpg ‏57 KB

  • Timed loop and CPU usage

    Platform is WIN_XP Pro and machine is a P4 at 2.5Ghz with 512 Mb ram.
    LV7.1 + PCI 6229
    I am using  50ms Timed loop for running a state machine inside it
    and also a  whole lot of other things like reading / writing
    DAQMx  functions;  file I/O functions and such. As the
    project involves a  main and sub-panlel set up local variables
    could not be elimnated fully and there should be something like 150 of
    them. But not all are accessed always - maybe about 15 of them at any
    given time depending on the SM staus.
    Problem :
    Once started the "Finished late"  indication  is off and
    the  actual timing  alternates between 49 to 52 ms. The CPU
    usage is around 25%.
    But as time goes by,  the system gets unstable : After 15 minutes
    or so, the Finished Late indication is always ON and the CPU usage is
    gradually tending towards or exceeds 100%. 
    Obviously the machine control timing now gets affected and things slow
    down badly. Closing the application ands restarting repeats the above
    cycle.
    I am at a loss  to understand what is happening ?  WIll
    breaking down the single Timed Loop to multiple ones help  ? WIll
    that be an efficient way of parallel threading ?
    I can post the code but its quite large and will do it as a last resort.
    thanks
    Raghunathan
    Raghunathan
    LV2012 to Automate Hydraulic Test rigs.

    Hello,
    It sounds like an interesting problem.  It would be worth some experimentation to figure out what's going wrong - attempting to decouple major "pieces" of the code would be helpful.  For example, you could try breaking your code into multiple loops if that makes sense in your architecture, but perhaps you could even eliminate all but one of the loops to begin with, and see if you can correlate the problem to the code in just one of your loops.
    Another concern is that you mention using many local variables.  Variable read operations cause new buffer allocations, so if you're passing arrays around that way, you could be hitting a problem of forcing your machine to perform many allocations and deallocations of memory.  As arrays grow, this can be a bigger and bigger problem.  You can use other techniques for passing data around your block diagram, such as dataflow if possible (just simple wires), or queues where dataflow can't dicatate program flow completely.
    Hopefully looking into your code with the above considerations will lead you in the right direction.  In your case, removing code so that you can identify which elements are causing the problem should help significantly.
    Best Regards,
    JLS
    Best,
    JLS
    Sixclear

  • LabVIEW RT, Timed loop, finished late, Call by reference

    I have a timed loop triggered by the sample clock of a DAQ-Card. The sample Clock is 8 kHz and the loop will run with dt = 4. Normally the loop is running without finished late[i-1]. But from time to time it happens that the loop is running extremly longer which means instead of 0.5 millisec it needs 4 - 5 millisec. It seems this doesn't never occur while accessing DAQmx.
    The application uses plugin technologies and some of the VIs in the timed loop are preloaded and called by Call by Reference.
    Does those VIs inherit the priority, execution system and CPU of the timed loop?
    The application is running on LV RT 2009 on a Dual core PXI-Controller. The timed loop is bound to CPU 1. There is no  difference runinng the application from the development environment or as a startup application.
    For the measuring test  I modified the application in a way that I don't have:
    disk access for storing the result file
    TCP/IP communication
    Controls on the front panel of the top level VI
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

    To keep you informed:
    I stripped the application and have left only the measurement storing module and the timed loop. The loop was using the microsecond timer running each 500 µsec. Additional all Non-Real-Time modules were loaded and only one module creates a XML string and sends it to the communication layer which will drop it because no TCP/IP port is open. The creation of the XML string is done each 300 ms.
    In this case I don't have any finished late iterations
    Next I added the DAQ Module. Now I get finished late again but with a lesser frequency as original.
    I removed all unnesseccary tasks from the DAQ moulde leaving one task for a PXI-4204 for using as the clock source for the timed loop. No I get finished late seldom.
     I removed the module which will send the XML string and I don't get finished late.
    Next I was adding code to see memory allocation. I can when memory allocation is changing but it is not related to the finished late iterations.
    Next time I have the chance to do more tests I will see which DAQ task triggers the finished late iterations. I have one AI task on a PXI-4204,  4 Counter tasks on a PXI-6602, 1 DI task on a PXI-6514, 1 DO task on a PXI-6514, 1 DI task on a PXI-6259, 1 DO task on a PXI-6259, 1 AO task on a PXI-6259 and 1 AO task on a PXI-6711.
    The AI task on the PXI-4204 is running in Continous Sampling (Single Point HW Timed is not supported), all other tasks exept the DI and DO are Single Point HW Timed.
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • Unable to run Timed Loops

    Bit of an odd one that had me scratching my head.
    I have a development system consisting of a PC running a 7842R, acquiring analogue and digital data from the FPGA, loading it into a shared variable, and reading it out within a timed loop on the host as one parallel loop in a producer-consumer architecture.
    All's well until one day last week when I noticed my host VI becoming unresponsive.
    After a bit of digging, I find that the timed loop doesn't run at all. Replacing with a while loop with a wait at least allows me to show that the error is timed loop related, but it's not a viable long term option for me. Creating a new project and a new VI with a simple timed loop showed the same behaviour.
    A restart of the system, and rerunning the same VIs, and no problems since.
    So, questions:
    1) Has anyone else seen this behaviour?
    2) Any idea what causes it? A service crashing, for example?
    3) Is there a way of recovering without a reboot? If it's a service crash, I'm hopeful.
    The system will eventually form part of a production test environment, hence the query.
    Edit - also, wiring error terminals of a timed loop is a good way of highlighting errors of course.
    FWIW, LV2012 SP1 32bit, Win7 64bit, Core2 Duo, 4GB RAM, tassels from the handlebars etc.
    CLD

    The timed loop is used to read all elements from a DMA FIFO and load them into a buffer FGV, which spits out packets of N samples long once they've assembled within the FGV. Ordinarily, I'd do this with a timed while loop and be perfectly happy to do so. However, the elements are actually an interleaved array, meaning that I have to demux them in the correct order that they were loaded.
    I use timed loops for a number of reasons: on my current Windows host, I've found that using a while loop has caused me more problems with respect to disordered packets, and that at least with using multiple timed loops (two, at most), I can assign priority to the acquire loop. Finally, it's also a development platform, and will be deployed onto an sbRIO once the electronics integration is finished in a week or two!
    W.r.t. system resources, there's very little else running on that system, but that doesn't normally stop Windows
    I recognise it's not ideal to run a software timed loop under Windows, but when you cannot run a blank project with Optimizing timed loop rate.vi from the shipped examples with nothing else running, it makes me curious to know why!
    CLD

  • Timed loop

    Hi all ! I have a question ...
    I have a timed loop (which run on RT target ) . I  parameter this loop with  1Khz clock and 1 ms period. The aim of my program is to transmitt/send CAN frames. When i parameter my programm to send a frame every 10s, I receive my frames after 9993 - 9994ms ! I also tested my program with 1 Mhz clock and 1000 µs and i still have the same problem.
    I'm almost sure it doesn't come from my program, because i tryed to use an external timing source instead of the internal clock and it works perfectly ! And it can't be beacause my subvi takes too much time, because i receive the frame 6-7ms BEFORE ! It's like the internal clock run faster that it should .... I don't really undrstand, could someone help me ???
    Thanks... 

    Hi,
    I can't believe that the use of the 1MHz clock can give this result but the timing must be always accurate using the 1KHz clock.
    I don't think the timed loop itself is the problem. Are you using a timing function or tick count function in your VI or subVIs?
    Are you using a PXI target? because it seems that the timed loop is not accurate only in PXI.
    Investigate and let me know.
    Regards.
    Omar S. NI

  • Is there a way to immediately abort a timed loop

    Im writing a program that when completed, could run for a very very long time. But I need a timed loop to execute every 60 secs. The two option I have come up with are these
    1. Timed Loop executing every minute
    2. Timed Loop executing every second, but processing the contents every minute.
    First way means I can't stop the loop until the time expires (more desirable than the 2nd option), the second option relies on the ability to determine when a minute is up based upon a 1Hz iteration rate, but from what I am reading, the iteration counter will eventually get to its max value and just hold its value, while the loop continues to execute (hence I lose my logic for content execution)
    I'm really hoping there is a way to do an immediate abort of a Timed Loop, but i'm not finding a way, lol
    Solved!
    Go to Solution.

    If you want to use a timed loop, you can stop it at any time using the Stop Timed Structure tool. (even if the conditional terminal is hardwired to never stop!)
    For example in the following code draft, pressing the stop button will stop and complete the timed loop immediately, no matter how long the interval is.
    (Note: Configure the timed loop to get the current name, or set your own)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    StopTimedStructure.png ‏12 KB

  • Timed loop in a subvi, one or the other runs but not both.

    I have a vi with two sub vis. Each sub vi contains a timed loop that updates a global variable. In the top level vi I read from each global and display its content. When I run the top level vi I see only one global counting but not both. If I start and stop the top level vi the sub vis take turns counting but they never both count. If I replace the timed loop with a while loop in each subvi then both count. If I move the two timed loops from their respective sub vis and place them in the top level vi then both globals show counting. Can any body explain what is going on.
    I'm using Labview 2010 SP1.
    Attachments:
    Test Of Timed Loop.zip ‏72 KB

    Never Mind!
    When I cloned the subvi I forgot to change the structure name of the timed loop. Placing an error indicator inside the subvi disclosed the error -808 (Error -808 occurred at an unidentified location. Possible reason(s):LabVIEW:  The given name is already being used by the following timed structure.).

  • Using NI-9411 in a timed loop clock less than 40Mhz...

    Hi,
    I'm using a cRIO for motion control. I have a counter that I modified a little bit (from the softmotion examples) and once compiled (unfortunately after 1 hour ...), I have an error saying that I couldn't acheive the desired timed loop clock of 40.4 MHz... the clock rate able to acheived was 40.16 MHz (really near)...
    So I had a derived clock of 38.75MHz but this time, before compiling, i have an error saying that theses inputs can't not work at with this time loop clock...
    The timed loop counter for this encoder only have to be more than 8000 Hz (1rev/s with 8000 pulses/revolution)
    What can I do?
    Thank,
    Patrick

    I know that a 9411 device can run in a SCTL at 40Mhz.
    What I don't understand is that I can't run the loop below than 40Mhz.
    I read in the FAQ that some device can not run above 40Mhz, but in my case, I want to run in slower....
    Can it be because I'm asking the same device to run 1 SCTL with DI0, DI1, DI2 at 40Mhz and 1 other SCTL with DI3 DI4 DI5 at a different loop rate.. (38.75MHz) ...
    Thanks,
    Patrick

  • Timed loop with array dimension control

    Hello,
    I have imported an excel to an array and im trying to use a timed loop to run the values of the array on a timed interval. One of my problems is that the array is 2D and i cant use its length to stop the loop. I want to use witch value of the array in the loop in each iteration of the loop and i want the loop o stop when the counter equals the length of the array. Can someone help me plz here is the labview.

    It is really unclear what your question is.  Could you clarify?  
    If you are struggling with why you have a broken wire it is because you are sending an array to the stop of the loop.  When you use the array size function on a 2D array it returns a 1D array with the size of each dimension.  When you then use the greater than function it returns a 1D array of Booleans.  It compares each element of the array size to the current count of the iteration terminal.  
    To use this to stop your loop you need to reduce it to a single element some way before you send it to the stop control of the loop.  You could apply an "and" or "or" function to the out put of the greater than or pull out a single index out of the single greater than array. 
    In the image logical AND, logical OR, or element could be used to stop the loop.  You just need to choose one that gives you the behavior you need.
    Lukin
    Certified LabVIEW Developer

  • Using Timed Loops

    I am trying to use a timed loop in my application. The only timing source available is the 1Khz clock on the CPU. I am using a PXI-8176 CPU in a PXI-1045 Chassis. I have found that the timed loop using the 1 kHz clock is not very accurate. When comparing the loop time versus a reference clock it lags by approximately 6 seconds in a 12 hour period.
    Is there a way to use the 10 Mhz reference clock available on the PXI bus?
    I have also tried using the counter on a PXI-6031E card but have not had much success.

    I am trying to configure the timed loop to utilize the counter on a DAQ Card in lieu of the 1Khz clock on the CPU. I have included a vi demonstrating how I plan to implement this strategy.
    I have also found that if a timed loop configured to process missed iterations is stopped and placed in an idle case, it will continue to count iterations based on its period and when made active again will process the missed iterations. Is this normal?
    Attachments:
    DAQmx Config for Timed Loop.vi ‏94 KB

Maybe you are looking for

  • S-video or composite input into powerbook

    Hello everybody, I was wondering if there was a way to get a game console, such as a playstation or gamecube, to hook up to my powerbook; the television in my house is often busy and this is the only other monitor available. Thanks for your help!

  • Report inculdes PO with Payment term

    Hi .. I need to have report includes my purchase orders with payment term column , which transaction can provide that ? Thanks Yasser

  • Photoshop Elements 6.0 Update to 6.01 Fails

    My computer: Dual Core @ 3 GHz 8 G Ram Win 7 64 HD - 500 G Earlier today, I re-installed Photoshop Elements 6.0.  The installation was completed without any issues. I then downloaded the file, ps601up.exe, from adobe.com to update Elements to 6.0.1.

  • PAvilion dv6, fan not working correctly?

    Was on my laptop, it shut down randomly, notification popped up saying fan was not working correctly. Is there a way to fix this? Or will it have to be sent away?

  • New developments in ABAP in ECC

    Hi All, Can you please provide me document or link fir the new developments in ABAP in ECC 6.0? Thanks