LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting an unwanted numeric from Tick Count

I have a while loop waiting for a burst that executes every minute. I am using a local variable to trigger my "time between bursts" vi. when the burst arrives(this sends a TRUE). When the while loop is waiting, the trigger is FALSE resulting the 1st value being 0.
At present, my "time between bursts" vi produces the following results: 0(because it runs the false page in the case structure), a random number depending on tick count(incorrect), 60sec(correct),60sec(correct)and so on per while loop. The correct values should be :1st burst = 0 and then 60s thereafter.

Is there a way to delete a known error value without interupting my other code or is my code simply wrong?
0 Kudos
Message 1 of 8
(3,418 Views)
Thsi is my code.
0 Kudos
Message 2 of 8
(3,414 Views)
I can't look at your code at the moment, but according to the picture, you have at least one problem here - the RF Burst local variable will only be read once, when you enter the loop. That means that's when the time between bursts VI will run. This may be the source of your problem, but without looking at the code itself, I can't tell.

___________________
Try to take over the world!
0 Kudos
Message 3 of 8
(3,396 Views)
I'm not sure what the code you submitted is for, but a possible reason for the jpeg pictured diagram's having different times is the "wait until next ms multiple". As described in the help documentation the first instance of it being called in a loop can return a time other than that wired to it. You might want as your first change to substitute the "Wait(ms)" function.


P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 4 of 8
(3,385 Views)
LV_PRO, that part of the circuit is ok. I use this wait (ms) to control the speed of the while loop while it waits for my next rf burst. That arrives once a minute. Perhaps the best way to describe the problem is that i want to measure the time difference between bursts with the 1st burst`s difference equal to 0. By using a tick count i can achieve this for results after the 1st burst but cannot initialise the tick count to give a 0 when the 1st burst arrives. When run is pressed, the wait loop polls until it recieves the burst then outputs a TRUE. I was rtying to use this TRUE as a trigger to start the tick count. Hope i have explained myself a little better. This is a real ******* of a problem?
0 Kudos
Message 5 of 8
(3,352 Views)
I have modified your VI to produce a fixed time interval between executions of the loop. The outer (Main) loop simulates teh rest of your program. The inner loop compares the time (in Tick Counts) of the Prior burst to the current time. When the difference exceed the Delay(seconds) value, the loop stops and sets New Start to the current Tick Count, which is returned by the shift register in Main loop to Prior. The waits produce timies which are not exactly one second for demonstration purposes.

The Tick Count is a U32 and will roll over to zero after about 49 days. If your computer runs that long without rebooting, you need to add some extra logic to handle the overflow.

Lynn
0 Kudos
Message 6 of 8
(3,335 Views)
Lynn, thanks for the advice. I have implemented your help to my code and the time difference works well. However i still have the problem with the first result as shown on my table. This result is a random generated by tick count.

Ideally, i would like this value to be 0 as there is no time difference on the 1st rf burst. There must be a way of initializing the tick count?
0 Kudos
Message 7 of 8
(3,312 Views)
The Tick Count is the number of milliseconds since the computer was last booted, so it cannot be initialized. What you can do is use the First Call? function from the Synchronization palette to initialize the shift register to the current Tick Count value.

Lynn
Message 8 of 8
(3,298 Views)