From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

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

Solved!
Go to solution

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
(3,147 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


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,122 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
(3,115 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.

0 Kudos
Message 4 of 9
(3,106 Views)

try something as follows:

 

timerreset.png

 

0 Kudos
Message 5 of 9
(3,096 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
(3,086 Views)

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

0 Kudos
Message 7 of 9
(3,077 Views)
Solution
Accepted by topic author tmd123

Here's what I would do...

 

 

0 Kudos
Message 8 of 9
(3,068 Views)

Thank for the enlightenment

0 Kudos
Message 9 of 9
(3,026 Views)