LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble setting up Global Stop function

Solved!
Go to solution

Hello,

 

I'm a new user to labview, so apologize if the questions I'm asking sound pretty basic.  I'm putting together an application that can both read incoming voltage data from an Analog Input, while also send output voltage data across two Analog Outputs.  I've been able to get the system to work at a basic level.  However, now I'm having trouble understanding how to implement a sort of Global stop variable into the program.  When searching through the forums, I did find that someone had put together a basic "Global Stop" program, but am having a little trouble understanding how to implement it into my code.

 

I'm including the VIs for both a more stripped down, basic version of my application, as well as the vi for the Global Stop program I saw mentioned in the forums.  Any advice on how to implement it would be greatly appreciated.  For reference, I'm using the USB-6008 as my DAQ.

Download All
0 Kudos
Message 1 of 9
(291 Views)

Many here don't have LabVIEW 2026 yet. Please do a "save fore previous" (e.g  LabVIEW 2019) and attach again.

0 Kudos
Message 2 of 9
(243 Views)

In the lower loop, you should use an event structure for ("knob1, knob2, stop", value change). No need for the stop 2 button or any FGV at all.

0 Kudos
Message 3 of 9
(214 Views)

Here is a quick draft.

 

(I don't have any DAQ drivers installed and don't know your hardware. I thus cannot comment on the sanity of the hardware IO, but there is definitely some code smell...)

0 Kudos
Message 4 of 9
(211 Views)

Hi altenbach,

 

First of all, I apologize for the delayed response.  Was out of the office for the weekend and didn't have access to Labview at the time.  I appreciate the rework you provided.  However, I still have a few questions about it.  

 

1)  How does putting the "Write Analog Output" loop into an event structure help me in terms of having a single stop button control both loops?

2) I'm still getting errors whenever I press the Stop button on the VI you provided.  Specifically, Error -200088: "Task specified is invalid or does not exist".

0 Kudos
Message 5 of 9
(127 Views)

(cannot look at the code at the moment but ...). Make sure to wire the task id across all cases of the event structure 

0 Kudos
Message 6 of 9
(121 Views)
Solution
Accepted by nim87

Yes, my example was just a sketch and you were supposed to fill in the blanks, of course.

 

As I said, the stop event did not have the task wired across, so when the stop event fires, it resets to the default, which is invalid. (Are you familiar with "use default if unwired" output tunnels?)

 

You just need to wire across the stop case (top picture). If you want, you could even explicitly set the outputs to zero if that is appropriate (bottom picture).

 

wired.png

0 Kudos
Message 7 of 9
(83 Views)

Oh I see it now.  Not familiar with "use default if unwired" property, so wasn't sure why it wasn't reacting under the "Stop" condition.  Had to review a few more tutorials about how Event-Structures work in order to fully grasp it, but not it makes sense.  Also like how the Event structure allows you to bypass the limitations that using a local-variable would have.

 

Thanks!

 

One question about the way you set-up timeout, though?  Since you set the while-loop value to be -1, is including a Timeout feature in the event structure even necessary if it never triggers?

0 Kudos
Message 8 of 9
(47 Views)

The timeout event fires once when the program starts.

0 Kudos
Message 9 of 9
(38 Views)