LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what am i missing here...

Solved!
Go to solution

What am I missing here in this timer pause? I calculate how long the timer has been paused and add that to the "start time" to be subtracted from the current time. If it has been paused 10 seconds, the current time should be 10 seconds greater than when it was paused, but the "start time" should also be increased 10 seconds. This should result in my timer pausing when the subtraction is done but it's counting down when I hit pause....what am i missing here? Also, this VI is meant to be placed in a while loop.

 

 

 

Yes I have looked at examples, but i wanna do it MY WAY! haha. Actually, it's more of an ego thing that I can't figure it out on my own...

 

 

Message Edited by for(imstuck) on 05-11-2010 05:48 PM
0 Kudos
Message 1 of 8
(3,580 Views)

Wired your code and got the same result, it counts down when stop is pressed. Highlight Execution and Retain Wire Values are your friends.

 

Functional Global Based timers aren't all that bad of a way to go. I know you want to do it your own way, but looking at other's techniques isn't all that bad of an idea.

 

Also, consider using system labels, you won't get the strike through line.

 

Anytime you catch yourself using the same thing in every case, more it outside the case structure. The first mod I did was to move the Get Date/Time In Seconds - To Dbl outside the case structure

 

Boolean to float to boolean between the shift registers intuitively doesn't seem right and maybe hard for the person after you to understand.

 

I'll be interested in seeing a post of your best effort working vi.

 

 

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

Functional Global Based timers aren't all that bad of a way to go. I know you want to do it your own way, but looking at other's techniques isn't all that bad of an idea.

 

 It's not really about doing it my own way. It's more about understand why what I'm doing isn't working/why it is doing what it is.

 

Anytime you catch yourself using the same thing in every case, more it outside the case structure. The first mod I did was to move the Get Date/Time In Seconds - To Dbl outside the case structure

 

Not true here. I need it in the case structure in order to store the timer value from the most recent iteration when it was not paused. If it is outside, you will always be updating the shift register value with every loop iteration. I don't want that. I want to store the time in the shift register from when pause was hit. Therefore, I do need it in the case structure.

 

Boolean to float to boolean between the shift registers intuitively doesn't seem right and maybe hard for the person after you to understand.

 

There is no boolean to float to boolean in my diagram

 

 


Thanks for the input. Hopefully I'll get it working.

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

for(imstuck) wrote:

 

Not true here. I need it in the case structure in order to store the timer value from the most recent iteration when it was not paused. If it is outside, you will always be updating the shift register value with every loop iteration. I don't want that. I want to store the time in the shift register from when pause was hit. Therefore, I do need it in the case structure.

 

 

Ignore that ignorant comment...duh...it can easily be moved outside. 1 a.m. apparently my mind is not working right...nor was it at 3 this afternoon either. You think after 2 years with LabVIEW those things wouldnt happen! Smiley Mad

Message Edited by for(imstuck) on 05-12-2010 01:04 AM
0 Kudos
Message 4 of 8
(3,518 Views)

Haven't solved it yet, but figured out partially why it wasn't working.

 

1. was adding the wrong numbers in the true case...oops.

 

2. Date and time in seconds to double doesn't actually give you a whole number for seconds. For instance if it has been 3 million seconds since 12 am. on jan 1 1904, that doesn't mean convertin gto double will give you the number 3,000,000.

 

If this is wrong please correct me.

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

I made some mods, decided to use ms timer instead. What I don't get is, why does the start time indicator show a number incrementing incredibly fast? The paused for(s) indicator is showing the paused for time progressing normally. But when I add it to the start time, start time increases by thousands? Help in understand what I'm missing here? When the timer is not paused, it works fine so the false case seems to be ok.

 

 

Excuse my poor ms paint editing

Message Edited by for(imstuck) on 05-12-2010 10:50 AM
0 Kudos
Message 6 of 8
(3,464 Views)
Solution
Accepted by topic author GregFreeman

The problem is the way you are adding the paused time to the timer start time. Every loop you're adding an offset to timer start time that has mostly already been accounted for by previous loops.

 

Pause time/timer start time

 

0/0

1/1

2/3

3/6

4/10 ...

 

See how this gets out-of-hand real quick?

 

What I would do is keep 'timer time' on a SR and adjust 'timer start time' based on 'time' each loop. No need to keep 'time when paused'.

 

Randy

Message 7 of 8
(3,447 Views)

 

0/0

1/1

2/3

3/6

4/10 ...

 

See how this gets out-of-hand real quick?

 

What I would do is keep 'timer time' on a SR and adjust 'timer start time' based on 'time' each loop. No need to keep 'time when paused'.

 

Randy


 

 

DUH! I have seen the light!!!!

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