LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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.
0 Kudos
Message 1 of 7
(8,591 Views)
Use a shift register to buffer your initial millisecond timer value. When
your comparison with the current time "trips" at the 40 second mark, load
the shift register with the new timer value. Initialise the shift register
with the millisecond counter outside the loop to prevent the timer tripping
on the first iteration. There is a key phrase cunningly distributed through
this message that should guide you in your search through the online help
system.

VSECorp wrote in message
news:506500000008000000D3160000-984280909000@quiq.com...
> Is there a way to reset the Tick Count (ms).vi after each time it
> reaches a certain level?
0 Kudos
Message 2 of 7
(8,591 Views)
The easiest way to do this is to wire the tick count outside the while loop to a shift register on the while loop. Inside the loop, read the tick count again, subtract off the shift register time (start time), and get your elapsed time. Then, when 40 seconds has passed, wire the current tick count you just read to the shift register on the right side of the while loop; this will cause the "start time" to be the latest time. If 40 seconds has not passed, then wire the left shift register straight to the right one (don't change the "start time").

Mark
Message 3 of 7
(8,591 Views)

I couldn`t understand properly. Could you please explain bit more clear? I am using my tick counter in a case structure. Thanks

Jojan

0 Kudos
Message 4 of 7
(6,248 Views)

Hi jojan,

 

you posted in a 13 year old thread. Do you really expect the users answer after that period of time? Mark visited the forum the last time 5 years ago…

 

Please start a new thread and desribe your problem with some sentences or even an example VI!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(6,235 Views)

Hi GerdW,

 

Thanks. But where can i start the new thread?

 

Regards

Jojan

0 Kudos
Message 6 of 7
(6,188 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(6,181 Views)