Resetting tick count?

Is there a way to reset the Tick Count (ms).vi after each time it reaches a certain level?
I am running a timer function where I have one tick count inside the while loop and another outside the while loop. These values are subtracted from each other to give a ms value of the time that has gone by since the start of the program. I want an event to occur every 40 seconds, so I have the while loop stop when the timer is greater than 40 seconds. Then I would like the event to occur and the while loop to start running again until the counter reaches another 40 seconds.
The problem with this is that it seems like the counter does not reset after the first while loop is over. So the first event will occur, it will go back into
the while loop and see that the difference in tick count values is still over 40 seconds, so it will run the second event. This process repeats until all the events are done. Ideally, I would want the tick counters to be reset and the first pattern to run again where the while loop runs until 40 seconds have expired.

From the Board level (where you can see a huge long list of topics in the board), hit "New Message".  It is really hard to miss.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
New Message.PNG ‏20 KB

Similar Messages

  • How to reset a counter on external signal in LabView?

    Hallo there!
    I am using LabView v 8.5 and the NI USB-6211 to acquire signals, among them are the following:
    1) angular pulses from a rotary encoder
    2) a reference pulse for the rotary encoder witch will give a pulse on a specific position of the movement for every rotation
    3) value from a pressure sensor
    What I am trying to do is to create a pressure/volume diagram based on the pressure and volume inside a cylinder of an IC engine. To do this, I will need the angle of the engines crankshaft to calculate the pistons position in the cylinder. This way I can calculate the volume and put it in a xy graph to represent the volume (x-axis) and the pressure(y-axis).
    I am using clk0 to count the pulses from the angular encoder, and this works great. However I now need the reference pulse to somehow reset the count at the precise time it goes high in order to precisely know the angular position.
    How can I do this? And how precise will this be? And will I need any kind of synchronization with my pressure measurements? If so, how?
    The relevant part of the program I am working on resembles the Count Digital Events with reset.vi 33 KB as found in this thread. However, I don't know how to get the reference pulse to reset as the stop button is. How can I do this?
    In addition: the fast pulses of the angular encoder = 0-> ~10kHz. I seem to lose information if I use the basic level trigger detection.vi when I put this signal on an analog port.
    -J

    Hi Nick,
    If you have an X Series or 2nd Generation cDAQ chassis (basically any cDAQ chassis except for the 9172 or 916x sleeves) then you can implement:
    1,2,3,4,5,6,7,8,9,10,(reset),1,2,3,4,5,6,7,8,9,10,(reset),1,2...
    You would have to configure an Edge Count Task, set the initial value to 232 - 6 (such that the 6th count causes the counter to rollover, which generates a pulse on the counter output), and enable the count reset using your external signal:
    The count reset isn't currently available for other DAQ devices, but I believe it should be available on M Series (62xx) and TIO (660x, 6624) with a future driver release (some time in 2012).
    If you don't have an X Series (or gen II cDAQ), don't despair.  On other hardware, you can get close to the previous behavior with a counter output task, with the exception that the "reset" signal would only be detected after the 2nd tick after your pulse is output.  Also, the reset signal would have to occur at the beginning to arm the counter the first time.
    Or, you can get the 3rd behavior that you asked for by doing a continuous counter output task with the external signal as the source of the timebase ticks.  For example:
    1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9
    In toggle mode (default):
    6 ticks of initial delay, 2 ticks high, 7 ticks low, 2 ticks high, 7 ticks low, ... etc.
    In pulse mode:
    6 ticks of initial delay, 9 ticks high, 9 ticks low, 9 ticks high, 9 ticks low, ... etc.
    See here for an overview of the difference of the two modes.  Basically, pulse mode will emit a short pulse when TC is reached, and toggle mode will toggle the state of the counter.  You can't have less than 2 ticks as a high time, low time, or initial delay.
    Best Regards,
    John Passiak

  • Tick count

    Hi. Can I ask how do you make the tick count reset when you start the program .
    Thanks in advance!

    You can't.  It is based on the PC clock,  It starts at zero when the PC starts.
    You can take the reading at the beginning of your VI and subtract it from later tick counts.

  • How do i reset a counter in crio scan interface mode

    Hai,
         I am using cRIO 9104 with NI 9421(DI SINKING) module for my counter application in scan mode.
    I have a doubt that how do i reset my counter previous value when my system is in idle mode(i.e stable mode).I tried to use a timeout in property node, But i am not able to put a timeout in my code ,herewith I have attached the printscreen of my program.You can see the timeout option is in hide mode.Any other option is there to reset a counter.Kindly solve this problem and let me know the details.
    Thanks and Regards
    Jayanthi.K
    Attachments:
    Untitled.png ‏292 KB

    You need to get a refnum for the module.  The simplest way to do this is to drag the module in the project onto your block diagram.  It will drop a refnum constant for the module.  You will find all kinds of useful properties and methods on this refnum.  In this case the refnum is of a class named "SD Module" (where "SD" stands for "Specialty Digital") and it has a method on it for resetting counters.  See the attached screenshot of the block diagram.
    Ross Houston
    Senior Software Engineer
    RIO Software R&D
    Attachments:
    reset_counter.png ‏3 KB

  • T-code that  resets the counts in the storage bins

    hello,
    is there any T-code that  resets the counts in the storage bins.
    As we do our weekly counts it keeps a running total of how many bin are completed and allows us to track the warehouse's progress.
    Regards
    Goutham

    Of cource, very sorry to waste your time,
    I didn't even notice LOL
    But your question is a easy question so I am sure some one will respond with a good answer for you.
    our program name is RLREOLPQ
    not sure if the program is custon or just t-code
    gl
    Edit: may be a bad sign for you, maybe no standard t-code if we had to create a custum one
    Edited by: Arakish on Apr 1, 2010 10:32 PM

  • Stopping a while loop using the time difference of two tick counts

    Hi Guys,
    I'm currently writing a code which test how long does it take for a formula node to perform its operation. The program uses a while loop to perform the calculation, and the program stops after calculating when tick count has reached 10 seconds. The program then displays the number of iterations it does in 10 seconds. 
    So initially I created 2 frames of sequence structure. In my first frame I have my initial tick count, and in my second frame I have my final tick count and the while loop. I used the subtract function and divide the output by 1000 to get the time difference. Then using the comparison function, I set if output > 10 then the program should stop, to do this I linked the output of the comparison function to the stop button inside the while loop. 
    However, when I tried to run the code, the program just didn't run. Hence I created a similar program which puts the last tick count in new frame sequence. When I ran this code, the program never stopped. 
    Do you guys have any idea what went wrong with my codes.
    Thank you!
    Erry
    Solved!
    Go to Solution.
    Attachments:
    1. Tick Count.vi ‏27 KB
    tickcoun2.vi ‏27 KB

    Dataflow!
    In both VI's the stop terminal of the while loop is controlled by a boolean whose source is ouside of the while loop.  So that loop will either run once, or run forever, depending on the value of the boolean that is calculated before the loop starts and shows up at the tunnel going into the loop.
    I would recommend looking at the online LabVIEW tutorials
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours

  • Using a hardware trigger to reset a counter

    Hi all...I am trying to using a quadrature encoder with A,B,Z outputs on an e-series card (pci-6052e). the problem is that the card does not support the z output since it only has 2 counters. So i am trying to find a way to get around this problem. I start off using ctr 1 (to the source pin of which i connect the A signal)..to count the events which will tell me how many angles the shaft has rotated through. The only other thing i need is to use the single pulse generated on the z line to reset the count each time it turns high. From reading posts it seems like i have to stop and restart the counter task to accomplish this. So the thing i dont know how to do is to convert that pulse on the z-line to a boolean value so i can run a case loop to stop and restart the task. I can use a daq-mx start trigger to look at the pulse but how do i convert that to a boolean value to run the case loop.
    Thanks in advance, Shyam.

    Hi Shyam,
    Depending on how fast the encoder will be rotating, you can do a few things. The simplist is to just read the Z index on a digital line as you have begun doing. Using a DAQmx Read, you can detect the state of the line and if the rotation is slow enough, you can use the boolean value. Again, this is not ideal. The newer M-Series boards have a counter input for the Z index in addition to being able to do change detection on digital lines which will make this task much easier. See if this works for your needs.
    Regards,
    Kent
    Applications Engineer 
    Digital Multimeter Home

  • NI-6602 - Encoder capture - resetting the counter to 0 through software - DAQmx

    Hello. A simple one. I'm using DAQmx to set up a task to set channel 0 on an NI-6602 as an angular encoder capture port. This is working fine and I can grab the position in degrees. The simple question is - How do I reset the counter to 0 through software. I can set up ZIndex to do it but how do I either reset the counter or set it with an arbritrary number? I can see a method to set it on startup but not during capture.
    Thanks.
    Will

    If working in LabVIEW, there are DAQmx property nodes that will allow you to set the "initial count" value, but ONLY while the task is stopped.
    If you can't count on a hardware z-index reset, another software technique I've used to avoid stopping the DAQmx task.  I make a wrapper function for all my encoder task access (see the Action Engine nugget for ideas...).   Inside this "Action Engine" wrapper, I use an uninitialized shift register to store my encoder's "virtual 0".  I add a simple function to the action engine for setting the "virtual 0" to be the current encoder position value.  Every time I read from the encoder, I first subtract off the virtual zero before returning the data.  As far ast the rest of the app is concerned, the encoder data it gets is just as if I were able to make a software call to DAQmx to set the raw count to zero.
    -Kevin P.

  • Why is the Tick Count function slow when used with a .dll but fine with normal lab view code?

    when using the Tick Count millisecond timer with a .dll I've written in C, I'm getting some odd timing issues.
    When I code the function I want (I'll explain it below in case it helps) in LV and run it as a subVI, feeding it the Tick count as an argument, the function runs quickly, but not quite as quickly as I would like. When I feed this same subVI just an integer constant rather than the Tick Count, it takes about the same amount of time, maybe a tiny bit more on average.
    When I bring in my function from a .dll, however, I start to run into problems. When I feed my function an integer constant, it is much faster than my subVI written in LV. When I feel my .dll the Tick Count, however, it slows down tremendously. I'm including a table with the times below:
                 |  Clock   |   Constant   |
    SubVi:   | 450ms  |  465ms       |
    .dll         | 4900ms|  75ms         |
    This is running the function 100,000 times. The function basically shifts the contents of a 2-dimensional array one place. For this function, it probably won't be a huge deal for me, but I plan on moving some of my other code out of LV and into C to speed it up, so I'd really like to figure this out.
    Thanks,
    Aaron

    Hi Aaron,
    Thanks for posting the code -- that made things a lot clearer for me. I believe I know what's going on here, and the good news is that it's easy to correct! (You shouldn't apologize for this though, as even an experienced LabVIEW programmer could run into a similar situation.) Let me explain...
    When you set your Call Library Function Node to run in the UI Thread you're telling LabVIEW that your DLL is not Thread-safe -- this means that under no circumstances should the DLL be called from more than one place at a time. Since LabVIEW itself is inherently multithreaded the way to work with a "thread-unsafe" DLL is to run it in a dedicated thread -- in this case, the UI thread. This safety comes at a price, however, as your program will have to constantly thread-swap to call the DLL and then execute block diagram code. This thread-swapping can come with a performance hit, which is what you're seeing in your application.
    The reason your "MSTick fine behavior.vi" works is that it isn't swapping threads with each iteration of the for loop -- same with the "MSTick bad behavior.vi" without the Tick Count function. When you introduce the Tick Count Function in the for loop, LabVIEW now has to swap threads every single iteration -- this is where your performance issues originate. In fact, you could reproduce the same behavior with any function (not just TIck Count) or any DLL. You could even make your "MSTick fine behavior.vi" misbehave by placing a control property node in the for loop. (Property nodes are also executed in the UI thread).
    So what's the solution? If your DLL is thread-safe, configure the call library function node to be "reentrant." You should see a pretty drastic reduction in the amount of time it takes your code to execute. In general, you can tell if your DLL is thread-safe when:
    The code is thread safe when it does not store any global data, such as global variables, files on disk, and so on.
    The code is thread safe when it does not access any hardware. In other words, the code does not contain register-level programming.
    The code is thread safe when it does not make any calls to any functions, shared libraries, or drivers that are not thread safe.
    The code is thread safe when it uses semaphores or mutexes to protect access to global resources.
    The code is thread safe when it is called by only one non-reentrant VI.
    There are also a few documents on the website that you may want to take a look at, if you want some more details on this:
    Configuring the Call Library Function Node
    An Overview of Accessing DLLs or Shared Libraries from LabVIEW
    VI Execution Speed
    I hope this helps clear-up some confusion -- best of luck with your application!
    Charlie S.
    Visit ni.com/gettingstarted for step-by-step help in setting up your system

  • How long does a tick last for the Tick Count (ms) VI in LabVIEW?

    I'm trying to compare the timing performance between a VI implemented in LabVIEW and another VI implemented in LabVIEW FPGA module. If I use the Tick Count in both VIs (every one in their own module), I want to know how long does a tick last in LabVIEW standard (in the computer)?
    Thanks

    vitrion wrote:
    I have this doubt because I read that a tick lasts 55ms in the following source:
    http://books.google.com.mx/books?id=en1GKs2huTcC&pg=PA33&dq=tick+count+(ms)+labview+55+milliseconds&...
    My tick count provides me better results than the hardware results, which is impossible because this is the same algorithm. If I consider the 55ms time, then the FPGA is really faster.
                              Hardware          Software with                  Software with
                                  (ms)        1 ms Tick Count (ms)     55ms Tick Count (ms)
    Algorithm 1          49.48                   1.5552                               84.535
    Algorithm 2         0.8875                  0.032                                 1.87
    Algorithm 3         0.1756                  0.0241                               1.43
    Algorithm 4          0.27                     0.27                                   1.32
    What's your opinion?
    Thanks again
    I think you are misunderstanding what the value of a "tick" is.  From what I gathered from reading your link (which I couldn't get to from your post, but accidentally ran into on a search) a tick of the OS clock."  Curiously, though - why 55ms?  That was mentioned as the tick of a Win95/98 OS!
    I guess you can say that the it returns the value of the next "tick" of the OS clock and returns that value in ms.  So, the value of a tick varies from OS to OS.  In Windows 95/98, for example, you can only look at the OS clock every 55ms or so, but it still returns a value that represents ms.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Generate a event every X seconds and reseting a counter

    Hi!
    I'm quite newby in programming in Labview and I need your help.
    I've programmed a counter that is send to a MySQL database every time I click a button. Now I want to change this click event to an event ocuring every X seconds and that every time this event occurs it resets the counter. How can I do that?
    I think it's not a difficult question for someone used to programming Labview but I can't find an accurate solution.
    Thanks a lot.
    Solved!
    Go to Solution.

    Something like this?
    Jean-Marc
    Jean-Marc
    LV2009 and LV2013
    Free PDF Report with iTextSharp
    Attachments:
    Automatic event LV86.vi ‏26 KB

  • How to reset play count

    how to reset play count in iTunes

    Right-click the track(s) in iTunes, and choose "Reset Plays."

  • Tick Count Express VI outputs '0' on FPGA target running with Simulated I/O

    When I set my target to "Execute VI on Development Computer with Simulated I/O", the Tick Count VIs all output '0 every time they execute. How can I get them to output a progressive count (in the "ticks" instance) or a proper timestamp (in the "ms" instance)?
    Solved!
    Go to Solution.

    I used LabVIEW 2013 SP1 and I was unable to reproduce this issue on my end. The screenshot below shows my result.
    As shown on the Front Panel, the output from the Tick Count Express VI was not 0 on every iteration of the loop.
    To make sure we are comparing the same code, can you reproduce this issue with the Tick Count shipping example?  You can find this shipping example in the Toolkits and Modules>>FPGA>>CompactRIO>>Fundamentals>>Clocks and Timing>>Tick Count section in the LabVIEW Example Finder.  
    Regards,
    Tunde S.
    Applications Engineer
    National Instruments

  • Camera Reset Frame Count

    Hi All,
    new here. Been using LR 4 on MBP 09 for about a year now, Love it!
    I'm shooting with a Fuji X100 exclusively (my only camera =). I recently updated firmware on it, and its reset frame count (up to 9500 frames). This means that the same frame number is now referring to two photos in LR. Should I start a new catalogue so I don't have conflicts? Or is there any other way to fix this problem? I checked X100 manual, I cannot choose to start from a certain frame number.
    Thanks for your help

    ...just on the question of starting from a given frame number, I have a comment and a suggestion.
    First, it is possible to have LR rename images at the time of import, assuming you are using LR to copy the images from camera card (not available if you copy the images into the computer yourself, and then use the "Add" method of import). As part of  this renaming, you can have LR include an "image counter" group of digits, which increment continually. That replaces the camera generated filename with an enforced unique numbering (some people include the capture date in the filename too - or other attributes - it can be defined to suit.
    As dj_paige says, it is not a problem to repeat a filename within a given catalog, but you may still prefer to have some unique element there.
    Next, while I don't know the X100 myself, this question of controlling camera image numbering comes up fairly often. Many cameras have two alternative modes: one where the camera keeps remembering the highest image number used, even after a card is removed; the other, where it promptly forgets about that each time ("goldfish mode").
    When a new card is inserted, cameras tend to take whatever internal counter may have been remembered from before (which will only apply if the camera is not in goldfish mode) AND take the highest number image found on the card, add 1 to whichever is higher, and use that for the next image taken. This becomes the new counter value.
    So: asssuming your camera offers these functions (they may be called different things) - you can set the camera to a given image counter value, by doing the following:
    Take a single image on a camera card. Turn off the remembering/incrementing of image number between camera cards, so that any prior counter value is forgotten. Take the camera card out, put it in a card reader and rename it to the image number that you would like to continue from. Put the card in the camera and turn on the remembering of image numbers. Take another picture: it will get an image number one higher, than the one you manually renamed. Becasue the counter is now persistent, this will continue regardless of which card is used - except if any card is ever put into the camera which has a higher value than the current counter, the counter will leapfrog that and set itself to a higher value still. To get it back down again, you would need to repeat the whole procedure above.
    Personally, I don't much care what images are physically called so far as LR is concerned - but I do prefer to have the camera image number increment continually nonetheless - which it has done ever since it was new.
    regards, RP

  • Creating an array in a 'for' loop (resetting loop count)

    Hi,
    I am trying to integrate an acceleration signal coming from a CRIO analogue input to obtain the speed and then further integrate to get the displacement of a vibration system.
    I understand that in order to perform the integration, an array has to be fed in. My problem is that I could not buffer the signal in a buffer block as I couldn't find any buffer blocks. so I decided to create my an array of data using a 'for' loop. The 'for' loop nests inside a timed loop. The problem that I got stuck at is how to reset the 'for' loop in order to refill the buffer again at every iteration of the outer timed loop.
    I have attached the code if that helps. Note that I am using labview 2013.
    I would be gratefull if someone who had encountered a similar issue before can help me.
    Regards
    Ali
    Solved!
    Go to Solution.
    Attachments:
    acc_test.vi ‏42 KB

    Dear Altenbach,
    Many thanks for your reply.
    I need to make it clear that I have not had enough hands-on with labview, I have only used it for sometime in the past and now I have to in order to perform some active damping on a 50Hz running machine. I must stress the fact that what i find more intuitive to do in a different programming language (matlab or C) is not as straightforward in labview. so please bear with me if my code has basic mistakes .
    All what i am trying to do is obtain the speed and position from an acclerometer signal. unfortunately i dont have a position sensor so i have to measure acceleration then perform time integrations in order to obtain the speed and position respectively. I am using a compact Rio (later in FPGA mode) to take physical measurements of acceleration from the vibratory machine and where i managed to do this bit successfully. when it came to performing the integration, i had to create an array inside my timed loop since i couldn't find a buffer block. I implemented a 'for' loop inside a timed loop in order to build the array. however i got stuck at resetting the count of the 'for' loop in order to refill the array with new values at every new iteration of the outer timed loop. unfortunately, even a sensible answer has been suggested before, i dont seem to have been capable of doing it yet. I really spent all my day trying to figure a way out but not achieved it yet, nevertheless I have learnt many many things by playing around.
    I would be gratefull if you could comment on a possible way of doing what i am trying to do.
    Kind Regards
    Ali

Maybe you are looking for

  • Field cost centre is a required field for GL account Error

    The error that I get during a sales transaction is: Field cost centre is a required field for GL account Error. Where or which transaction in FI do I use to maintain this setting. Thank you.

  • 1390717.1 - 12c Cloud Control Agent: Is it possible to Re-configure ...

    Can anyone get to this note "1390717.1: 12c Cloud Control Agent: Is it possible to Re-configure a 12c Agent to a Different 12c OMS Without Re-installation?" I do a search in Metalink and I see it listed in "How to Point a 10g/11g Grid Agent to a Diff

  • My Intel imac  won't turn on

    Hi! My intel Imac suddenly, and without apparent reason, shut down, and won't turn back on. When I press the power button, sometimes it makes a small noise, but then nothing happens. I have unplugged all the cables, and also tried resetting the SMC,

  • How can I use "Make Current Values Default" Programmatically?

    When I use this method in a Invoke node, I get the error code 1000, then i can't use it in run mode? How can I modify the default values in a Built aplicattion, and save for the next time I load it?

  • How can I update ipod touch model MCO86LL

    My son just received this ipod touch and when I tried to download games for him everything is saying "incompatible with this version of ipod touch."  It is 4.2.1 and someone told me I couldn't update it to a newer version!?  Can I update this ipod?