Showing results for 
Search instead for 
Did you mean: 

Two different tasks in one application file

I would like to do 2 tasks in one application.


1-  when RUN button is pressed 

  • and then say  a TEST  button is pressed execute first part of code or sequence structure (once in whole test , kind of finding zero at the start only) , after finish go to second part of seq struct where 6 different serial writes or modes are present 
  • if TEST is not pressed --> do not go to next code or sequence structure , wait for TEST button to be pressed

but in my case first part is working if TEST button is pre-pressed before run .

it does not wait for TEST button if not pre-pressed, and executes second part simultaneously without first part



0 Kudos
Message 1 of 6

Hi DMic,


As best I can tell, it sounds like there is a problem with your code that is causing it to not behave how you want.

Message 2 of 6

Without seeing your code we can only guess...


My guess is you are doing it wrong.


BTW: My reasoning behind that guess is you said you are using a Sequence Structure. Honestly there is very little reason to ever use a Sequence Structure anymore. They are still part of LabVIEW for backwards compatibility, but no new programs should even need one, except for a few very rare instances.


In general when you find yourself reaching for that Sequence Structure...

STOP take a step back and think about it, because there is probably a better way to accomplish your task. 

Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 3 of 6

Your description is just screaming "State Machine".

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 4 of 6

Although some of the responses so far have amusingly pointed out the problems inherent in your description without uploaded code, I'm going to guess that you have a button that is read at the start of the VI, and you instead want to only read it when it changes.


You might find some use for an Event Structure here. However, suggesting where to put it (apart from "around the TEST button") without seeing code is a little tricky.

If you only want to run a test once, and what you're trying to do is just wait for input, then an Event Structure without a While loop might be a simple solution for your problem.

If you want to repeatedly run tests, then I'd say the State Machine architecture/design already mentioned is the best bet.

Message 5 of 6

Sigh.  You need to invest some time into learning LabVIEW.  There are Tutorials (see the list on the first page of this Forum), Classes (though possibly few and far between), and LabVIEW Gurus (someone who has some LabVIEW experience, patience with Newbies, and willingness to spend some time with you getting you "up to speed").  There are also a few books on LabVIEW, some written fairly recently.


Having tried my hand at a dozen or so Programming Languages (including PostScript -- you can do some interesting coding with PostScript!), I find LabVIEW easier to learn and easier to use than most of the other programming paradigms I've encountered.  But you do need to learn some basics (which is why I'm making this recommendation ...).


Bob Schor

Message 6 of 6