LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timing-stop button without stopping the vi

Hello,

 

So, this is a pretty easy fix I think, but I am not very familiar with all of the labview options. I want to stop these loops but not the entire vi.

 

The point is to record the time the buttons, individually, are clicked, but to allow the vi to run continuously even though each of the stop buttons can be clicked at any time. 

 

Here is a picture of the timing section of my vi; i have tried two different structures and they both stop the entire vi. Any suggestions?

 

Thanks!

0 Kudos
Message 1 of 7
(3,293 Views)

You should never stop your application using the STOP function unless it's something like "Stop it now or the nuclear reactor is going to blow!"

 

You should be able to stop your separate loops using the stop condition terminal. Why do you have three nested For loops without any criteria changing from loop to loop?

 

If you're not familiar with the "LabVIEW options", I would suggest reading up on what LabVIEW can do for you and what you can do with LabVIEW. You should be familiar with the programing language you're trying to use before using it.

"Give me six hours to chop down a tree and I will spend the first four sharpening the axe."  - Abraham Lincoln

 

Here are some free training tools primarily focused on LabVIEW and NI hardware to help get started.

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

Learn NI Training Resource Videos

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 7
(3,287 Views)

What exactly are you trying to record? From your code it looks like the time since you pressed the stop button, but this seems to be extremely complex and unnecessary.

 

You have almost everything you need to perform this function in your code but yet somehow managed to miss the solution. After looking at James' notes things should get significantly clearer, but for now all you need to do is:

elapsed.png

You will want to add a wait depending on the resolution that you need.

0 Kudos
Message 3 of 7
(3,255 Views)

@ogk.nz wrote:

..., but for now all you need to do is:

 


Nooooo!

0 Kudos
Message 4 of 7
(3,245 Views)

I added a warning. Totally their fault if they happen to not read all the way through.

I'm going to call it a boobytrap.

Totally a concious decision.

0 Kudos
Message 5 of 7
(3,230 Views)

Hi,

 

I want to record the time from the start of the vi (when I press run), until the button is pressed. There will be multiple buttons.

 

The reason the loops are nested are for seconds, minutes, and hours; thus, the 60,60, an 24. I also have already tried using a conditional terminal within the for loop, but, again, this stops the entire vi instead of just the count of that specific elapsed time.

 

For all who advise training, thank you. I have completed all the training i have access to, which is why i am asking here instead.

 

Thanks!

0 Kudos
Message 6 of 7
(3,213 Views)

What you've done above just to get a count of hours/minutes/seconds is what we call spaghetti code. The tools to time how long your loop has been running are part of LabVIEW in the form of a single VI: Elapsed Time. Check your Timing palette.

You've taken the For loop, Wait function, and Indices as your hammers and are hitting LabVIEW like it's a nail.

 

You say you've completed all training you have access to. Does that include the links I gave above?

 

Here's how you can use Elapsed Time to get exactly the outputs you already have. I would suggest using the timestamp in seconds on its own, though, without converting to a cluster. You can format a numeric indicator to show the timestamp as "H:M:S" if you want and don't need to break the values out.

Elapsed Time.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 7 of 7
(3,196 Views)