From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

countdown timer while loop

Solved!
Go to solution

I am trying to stop a while loop using a countdown timer with the ability to stop by using the stop button. However when the timer hits 0 the vi doesnt stop. Untitled.png

0 Kudos
Message 1 of 8
(10,050 Views)

never mind

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 8
(10,044 Views)

zain,

 

what happens when you check the millisecond timer just one millisecond later (oer earlier)? Your comparison with zero will give a FALSE output…

 

Easy solution: use a more "robust" comparison function here, which also outputs TRUE, when time is over.

Or use the ElapsedTime ExpressVI, which does this thing right!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 8
(10,020 Views)

Oh sorry for not elaborating. I created a countdown VI and it works on its own but when I try and integrate it to my getDataV2 vi the code doesnt work and I cant figure out whats going wrong. 

0 Kudos
Message 4 of 8
(10,018 Views)

Hi zain,

 

this new VI has the very same problem as the one in the first message…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(10,008 Views)
Solution
Accepted by topic author zain1612

Oh sorry didnt save it before upload. I used the elapsed time vi to achieve it. Thanks guys

0 Kudos
Message 6 of 8
(9,992 Views)

Hello Sir, above attached is the error i faced. What i wish to achieve is that when the reading  the lesser than-0.4 or more than 0.4, i want to have a timer to let it have a delay of 5 seconds before i would actually trigger the alarm meaning to say that if the value lesser than -0.4 or more than 0.4 is less than 5 seconds. There would actually be no alarm. I've tried earlier when i put in a timer, it would actually buffer once every 5 seconds. Please guide me along if you guys got any ideas regarding this issue. Thanks.  ASD.PNG

0 Kudos
Message 7 of 8
(9,877 Views)

@edwardanthony wrote:

Hello Sir, above attached is the error i faced. What i wish to achieve is that when the reading  the lesser than-0.4 or more than 0.4, i want to have a timer to let it have a delay of 5 seconds before i would actually trigger the alarm meaning to say that if the value lesser than -0.4 or more than 0.4 is less than 5 seconds. There would actually be no alarm. I've tried earlier when i put in a timer, it would actually buffer once every 5 seconds. Please guide me along if you guys got any ideas regarding this issue. Thanks.  


All you need is an In Range And Coerce and an Elapsed Time.

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 8 of 8
(9,844 Views)