LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Please help: How to continue reading off the time after the pause program

Solved!
Go to solution
Highlighted

Hi guys

 

I have a project that reads everything in real time.

However, I have a problem: Continue reading off the time I have release the pause button

 

I understand that to record the time, its takes current time minus away the time when I start my program. When I press my button to pause the time, it manage to pause but when I switch off the pause button, it is unable to continue the time from where i pause. Can anyone enlighten me how to program this? 

 

Thank you

0 Kudos
Message 1 of 9
(657 Views)

Hi tmd,

 

what's the point of putting a huge image of a block diagram in the block diagram - instead of real code???

 

General comments on this image:

- way too large

- way too many local variables

- you need to clean up your block diagram

 

General comment on your problem:

You need to count the time, when your program is in the "pause" state. This time interval needs to be accounted for when you calculate your "running time"…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 2 of 9
(632 Views)

Hi GerdW,

 

I have cleaned up the block diagram. However, I am still stuck at this: After I switch off my led light, I want my time to continue from where I have pause. Is it possible to program into this way? I am sorry if it is a easy question as I am still learning how to program using labVIEW

 

Thank you

0 Kudos
Message 3 of 9
(625 Views)

You have a race condition because you cannot guarantee that the current time terminal is written before the local variable of it is read.

I don't see an pause state. Please tell us how to run and operate your VI, what you expect to see, and what you see instead.

Do you really need to spin the loop 1000/second?

If you want the clock to continue, don't put the timing code inside a case structure that bypasses the code. Use shift registers to hold the capture time to reset the capture time every time the boolean goes on-off, for example. no local variables needed at all.


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 4 of 9
(616 Views)

try something as follows:

 

timerreset.png

 


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 5 of 9
(606 Views)

This is how I wish my VI to operate:

1) When I press the button, timing will start to record.

2) When I press the same button second time, the time recorded will pause at whatever minute or seconds it is recording.

3) When I press the same button again, the timing will record again from where it have paused.

 

However, my program only work from option 1 to option 2 couldn't go to 3.

This is what happen currently when I tired to go to option 3: When I press the button, my VI will restart back from 0 and count from 0

Spinning 1000/second in the loop is not required but from seconds onward are all important variables to me.

0 Kudos
Message 6 of 9
(596 Views)

So you probably simply need another shift register to accumulate the total on time. try it!


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 7 of 9
(587 Views)
Solution
Accepted by topic author tmd123
01-08-2018 06:41 AM

Here's what I would do...

 

 


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 8 of 9
(578 Views)

Thank for the enlightenment

0 Kudos
Message 9 of 9
(536 Views)