From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tick Count Giving Very High Result

I am fairly new to labview and am having a problem with the Tick Count (MS) function. In my program that is attached the count comes out very high after just a few seconds. For example after about 5000 ms the count reads 87,000,000 ms. This is a pretty simple program that I am just trying to have turn on lights at set times and turn them off at set times. I have put a numeric indicator in the first case so that I can see the tick count on the front panel.

 

Any help would be greatly appreciated,

Kelsey

0 Kudos
Message 1 of 8
(3,983 Views)

The Tick Count is not a timer, it is a clock. It's giving you a tick cound in units of milliseconds between 0 and 2^32. You need to use it twice and subtract in order to time something.

 

Turning on and off lights at set times may be easier by using the Elapsed Time VI.

 

There is no loop in your VI, so I'm guessing you are using the Run Continuously button? You should look in to using a While loop along with Elapsed Time to do what you're trying to do.

Elapsed.png

 

 

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 8
(3,979 Views)

Look at this little VI, and before you try to run it, decide (for yourself) what it is going to do.  Then give it a try.  Welcome to LabVIEW's Timing Functions.

Flasher.png

Bob Schor

0 Kudos
Message 3 of 8
(3,966 Views)

I see an uninitialized shift register Smiley Wink

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 8
(3,964 Views)

So do I.  So what (in this particular case)?

 

BS

0 Kudos
Message 5 of 8
(3,956 Views)

In this case, it means your LED will start at an inconsistent state as you know. It doesn't really matter for the flashing function, but for demonstration purposes I like to remove inconsistencies so we don't get a new topic in a week when a shift register like this is causing a bug in someone's code. Core 1 and Core 2 courses also emphasize initialized shift registers because the CLD marks off for it (unless it's an FGV of course).

 

In the end, I was just giving you flak.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 6 of 8
(3,955 Views)

Of course -- flak accepted.  Find me at NI Week and I buy you a beer (or glass of wine).

 

BS

0 Kudos
Message 7 of 8
(3,938 Views)
If I want to calculate timer I would suggest you to use get timer in milliseconds at different instances and find the difference of two which gives actual timer
----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 8 of 8
(3,934 Views)