LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a thread/ background execution

I want to create VI which is able to start a cyclical execution in background (e.g. send a message)
I run the VI and stop it, so the execution is not cyclical...but the event must run.

Thank you in advance
0 Kudos
Message 1 of 18
(3,992 Views)
Oriana,

it is simple: just create a while loop. It will run in parallel to the rest of your vi. Inside the loop, perform the task that you want to be done regularly. Also, add a delay function from the time/dialog palette. In LabView 7.1 (which I don't have), there is also a special timed while loop which performs its timing on its own. You need to wire something to the stop terminal in the lower right corner of the loop, like a local variable, that can be set from outside the loop to stop it when needed.

Regards
Matthias
0 Kudos
Message 2 of 18
(3,976 Views)
Hello,

Thank you for your responce!

Unfortunately the problem is not so easy to solve it. I want to stop the execution of the VI but the event must run into background ... so it cann't bbe solved into this manner. The way you said, when I stop the VI, also the VI stops ...
I want to create a sort of system event ...
0 Kudos
Message 3 of 18
(3,976 Views)
I'm a little confused by what you want. You have your main application VI that you want to be able to stop, but still have the event running in the background? In otherwords you just want a background task that is always running? Does it actually have event code that runs in the main application VI?

You should take a look at the VI Server. For example the following code allows you to run a VI seperate from your application. When this code stops executing, the background.vi continues to run until it decides to stop.
0 Kudos
Message 4 of 18
(3,962 Views)
Yes, you are right about the server behaviour ... want to
I am using also a server to lunch the VI which Istart ... but I can't lunch another VI until the previous doesn't execute ... logical 😞
So I should find another solution ... without consumer/producer manipulation because also the application from background should execute something cyclical ...
I think that I should triger a function from a dll and associate a timer with my event, then start the timer ... I belive that the timer doesn't stop until it is not called the explicit function ...
0 Kudos
Message 5 of 18
(3,948 Views)
Could you explain a bit more about the application structure. The phrase "but I can't lunch another VI until the previous doesn't execute" through me for a loop - what are you saying there?

If you can describe the various parts and what the requirements are we can make more progress.
0 Kudos
Message 6 of 18
(3,934 Views)