Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Can anyone tell me why the count tick cannot be show?

Hi All

I am trying to write a code for speed calculation, so first I am trying to familiar with the timer function. However as shown in my test code, I cannot get the result in front panel. Can anyone help me in this, please?
0 Kudos
Message 1 of 5
(3,727 Views)
HI,
that's because the time to execute the two tick count vi's is less than 1ms, so the difference is zero.
You need to move the initial count outside of the loop, so it's executed first.
The execution flow is down to a sub vi node having all its inputs, and then it runs.
So since there was no timing flow between the two tick count vi's they run in parallel.

Fix attached

Thanks

Sacha Emery
National Instruments (UK)
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 2 of 5
(3,722 Views)
Hi Sacha

Thank you in this, but I cannot open that file, because I am still usu V.7. Can you save in version 7, please ? And according to a help description of the tick count which states the tick count run from (2^32)-1 to 0, I wondering how I can initialise the start time to the tick count. For example I need to tick count start from 1x10^4 every time when the programme start. Can you please give me a clues about this as well?

thanks,

Noppadon
0 Kudos
Message 3 of 5
(3,718 Views)
Hi,
I've saved the file for 7.0.
You cannot initialise the tick count sub vi.
Reading the full help :
Returns the value of the millisecond timer. The base reference time (millisecond zero) is undefined. That is, you cannot convert millisecond timer value to a real-world time or date. Be careful when you use this function in comparisons because the value of the millisecond timer wraps from (2ˆ32)–1 to 0.

If you want to fake an initialise, then you're simply finding the current tick count (outside the loop) and adding on 1x10E4 every time you use the tick count from then on, so a difference will actually be the difference plus 1x10E4.

Make sense?

Alternatively, use the elapsed time express vi in the execution control palette, which can take a start time.

Thanks

Sacha Emery
National Instruments (UK)
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 4 of 5
(3,716 Views)
Hi Sacha

I got it, and thank again for your helps.

Noppadon
0 Kudos
Message 5 of 5
(3,708 Views)