LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Prevent Express VI from executing inside while loop using boolean switch

Hi everyone, i'm relatively new to Labview and looking for some help wiring a VI.

 

I have an Express VI task inside a while loop with a couple case structures and i am trying to stop a task and execute another task inside the case structure when a boolean switch is set true, then return to the first task when the boolean is returned to false.

 

Attached is a screenshot of the section of the VI causing problems. It executes fine until the while loop enters the next iteration and tries to start the Express VI again. Is there any way to prevent the Express VI from executing in subsequent interations of the loop when the boolean is true?

 

If you need more info to help or need to see more of the code, i'll be happy to upload it. Also, I'm sure there are better ways to code this, so i am open to any suggestions.

 

Thanks!

0 Kudos
Message 1 of 4
(3,223 Views)

Hi tigmandave,

 

It executes fine until the while loop enters the next iteration and tries to start the Express VI again.

What's the problem with the 2nd iteration? Are there error messages/codes?

 

Is there any way to prevent the Express VI from executing in subsequent interations of the loop when the boolean is true?

When you don't want to execute parts of code you need to put it in a case structure…

Or: why do you put the ExpressVI into the loop when it should run only once?

 

If you need more info to help or need to see more of the code, i'll be happy to upload it.

Then why didn't you attach the full VI at first? How should we debug an image?

 

Also, I'm sure there are better ways to code this, so i am open to any suggestions.

First improvement: use Autocleanup (just press ctrl-u before uploading screenshots)!

Next improvement: remove those classic Rube-Goldbergs! 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(3,208 Views)

Hi GerdW,

 

On the second iteration after the boolean switch is flipped, it returns a stop error 50103 The specified resource is reserved. The specified resource being the VI inside the while loop. I have determined once the VI stops and the case structure is executed, the while loop enters another iteration for every sample update of the VI inside the case structure. When the new iteration begins, it tries to start the VI outside the case structures but cant because the VI inside the case structure is already using the analog in chanels, and thus returns an error. I simply want it to not try to start the VI outside the case structure when the boolean is true.

 

I thought about using a case structure, but i was unable to determine how to program that. The Express VI needs to be inside a while loop because i want it to run continuously EXCEPT when either of the two boolean switches are true.

 

I did not include it because i did not see the relevance of the rest of the code on the operation of this segment. And i just tried to upload with this but it gave an error saying content does not match the file extension. I'll work on that too.

 

The Ctrl+u is a really awesome trick.... i did not know about that. Thanks!! And what are you refering to by the Rube-Goldbergs? I know what Rube-Goldberg is, just dont know what you're refering to in the code.

 

Thanks!

0 Kudos
Message 3 of 4
(3,175 Views)

Sounds like you are starting a task that has already been started with that error.

 

See Rube Goldberg Code

0 Kudos
Message 4 of 4
(3,158 Views)