Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

timer

Hi
I m developign a timer in LabVIEW which counts time in ms, it resolution will be 10ms. it will start counting from 00.00, 00.01 to 99.99 sec.
 
kindly suggest how to acheive this resolution so precisely.
 
regards
GNS
0 Kudos
Message 1 of 9
(6,082 Views)

The answer to your question will depend somewhat on the implementation. Are you wanting to use the "timer" to govern the execution timing of your program, or are you wanting to use the timer to measure the elapse time of your program? Answering that question will dictate how you should implement it, but regardless, it will be implemented using timing VIs, which are located in the All Functions>>Time & Dialog palette.

It should also be noted that software timing is inherently unreliable. Spikes in CPU usage and a stressed processor can cause small timing inconsistencies that might make a large difference in some very time-sensitive applications. If your application is particularly time-sensitive, you should consider using hardware timing instead.

Kind Regards,

E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 2 of 9
(6,068 Views)
test
0 Kudos
Message 3 of 9
(5,983 Views)
Hello

I have a very similar problem.  I need to do a kind of timer to control de application process.  Time accuracy is not critical.  I have tried it with "Time Has Elapsed".  This function is OK for Labview 7.0, but I need to work with the 6.1 version, and I haven't found this function in that program.  ¿Is there a solution to insert a timer in my project?  How can I do it?  Is that solution already implemented in the 6.1 version and I haven't found it?
Thank you in advance

Carlos
Carlos Arcediano del Amo
0 Kudos
Message 4 of 9
(5,947 Views)

Carlos,

The Elapse Time Express VI is not available in LabVIEW 6.1 because express technology was not introduced until LabVIEW 7.0. You can, however, easily measure the time elapsed in LabVIEW 6.1 by using the Tick Count.vi located in the Functions>>Time & Dialog palette. I have attached an example that uses the Tick Count.vi to measure the time it takes to do 10,000 addition computations. You can apply the same concept to measure the elapse time of anything in LabVIEW.

Kind Regards,

E. Sulzer
Applications Engineer
National Instruments
Message 5 of 9
(5,922 Views)
Hi,
Thanks for ur kind reply. i m using pci 6602 card for measuring the elapsed time. there I have to attain the pecision like 10 ms. Kind suggest to implement the same without the occurance of error.
 
Regards
 
GNS
0 Kudos
Message 6 of 9
(5,912 Views)

GNS,

There's more than one way to measure time with a ~10 msec precision.  For example, once upon a time I posted a simple example of a module that could do timestamping with a precision of 1 msec.  At present it self-initializes one time only but you could easily replace the "First Call?' primitive with a boolean control that would allow it to be initialized whenever you choose.  Here's the thread: http://forums.ni.com/ni/board/message?board.id=170&message.id=111583&query.id=103513#M111583

You can use your 6601 to keep track of time in hw.  However, unless the 6601 is also being used to synchronize another bit of hw acquisition, I don't think you'd be doing yourself much of a favor.  You still would make a "Read" call in order to retrieve the value for use by your app, and that software Read would be subject to the same variability as a call to the msec Tick Count primitive.

I'd start by trying to use the built in Tick Count primitive and only reverting to hw if necessary.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 7 of 9
(5,902 Views)
Hello, E. Sulzer

I understand the concept, but maybe it isn't what I really need.

Let me explain what I am doing.

We have a finite state machine (fsm).  There are several states that will be executed until a time has elapsed.  I execute the state n, then the n+1,... and then the n+m.  After, I evaluate if the time have ellapsed and, if it is the case, I continue with the state n+m+1; if not, the fsm goes again to the state n.

Using this technique is very simple and clean.  I only have to create a new state with the sequence structure with three frames.  The first and the last one have the Tick Count module and the middle one ALL the states I want to execute.  I will need shift registers to record the ellapsed time and increment it each time the sequence structure is executed.  Logic control is needed to determine if the total recorded time is greater of equal than the desired limit time.

There is a problem.  The VI is not new, and I am only changing it... :mansad:... this solution requires a lot of changes.

I have though of an alternative solution.  I use the Get Date/Time In Seconds function and I need a shift registre too.  The fsm is inside a while loop, and each case is a frame of a "case" structure.  Each while loop, I evaluate if a value that I have calculated previously (Get Date/Time + timeLimit) is greater of equal than the currently Get Date/Time.

I'm programmating it, and it seems a little complicated.  The logic control is inside the case (¡!) and I can't make a subVI because LV 6.i doesn't "like" feedback with modules... Feedback Node isn't included.  So my code is not "clean" at all.

What do you think?

Thanks.

Carlos Arcediano del Amo
0 Kudos
Message 8 of 9
(5,840 Views)

Carlos,

I'm not sure I follow the implementation that you are using, but you should be able to measure elapse time in your state machine in a similar manner to the way I showed before. I have attached an example that corresponds to the way you described your setup. Take a look at it and see if it gets you pointed in the right direction.

Kind Regards,

E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 9 of 9
(5,810 Views)