LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run code without usual labview buttons

I am creating an application. I disabled the run and abort buttons

on the front panel. I want to run the code by using simple buttons

of the frontpanel other than the run button. If anyone can give me

a simple example like generating random number inside a while loop

but without using the run button on top of frontpanel it could be great.

0 Kudos
Message 1 of 13
(4,180 Views)

Would these be acceptable solutions 

  1. You can run a VI by the Ctrl+R key combination.
  2. Check the  Run when opened option of the VI (Ctrl+I >> Category= Execution >> Run when opened). The VI will run itself.
Message 2 of 13
(4,168 Views)

What you are saying is that I should run it automaticaly when the VI opens

and just use an event structure inside labview to wait for start button. This

does look like a soultion, but wouldnt it take lot of memory if its big application.

Is there anyway I can trigger the Run or the command you just mentioned.

 

The other problem is I need to create an infinite loop in such cases, because if I stop

the while loop it wouldnot execute again when i press start.

0 Kudos
Message 3 of 13
(4,161 Views)

Is there not a confusion between notion of edition and run mode?

 

Why not create an executable if you don't want use the development interface?

 

You could launch a VI via dynamic link or a method but your case is not very clear or I don't understand.

0 Kudos
Message 4 of 13
(4,153 Views)
Here is a small example. Are you familar to the event structure ? Just open the VI and see the CPU load --> 0% !
Message 5 of 13
(4,138 Views)

thanks for your response. I had this idea. I have slightly modified the frontpanel

which was attahced to the post above. Now if you open the VI you will see that

it will run automatically and even generate numbers. But as soon as you stop it

it wouldnot work since I have made Run and abort buttons invisible. All I need is

to stop and run the code again by not using ctrl+R but by placing another button

on the front panel. I have atahced the VI.

0 Kudos
Message 6 of 13
(4,124 Views)
You need to differentiate between starting the application and starting/stopping a process within the application. The VI itself should run continuously, and your buttons should start/stop the process. You should have a separate button to QUIT the application (i.e., VI). In this case, a state machine is what you want.
Message 7 of 13
(4,106 Views)

You already got great advice, here are some general comments.


Yesh wrote:

What you are saying is that I should run it automaticaly when the VI opens

and just use an event structure inside labview to wait for start button. This

does look like a soultion, but wouldnt it take lot of memory if its big application.

Is there anyway I can trigger the Run or the command you just mentioned.


I think you have a misconception here. Once a VI is loaded into memory, there is little

difference in memory use between running or not running. If an event structure is just

waiting, CPU use is ~zero.


Yesh wrote:

The other problem is I need to create an infinite loop in such cases, because if I stop

the while loop it wouldnot execute again when i press start.


Once the VI is set to run when opened, the only reason to stop it is to make edit changes.

(Once it is built into an application, it shoud close when done).

 

Don't make an infinite loop, but make sure to detect when the user is done with the program.

If there is hardware involved, certain shutdown steps are often needed (disconnect from instrument,

set voltages to zero, etc.), so you could trigger those with a "panel close?" event, for example.

Message 8 of 13
(4,090 Views)

Still stuck at the same problem. Forget the

above posts where I wanted to run the Vi

when they are opened. Is ther any damn way

to run the code without using then Run button,

not using CTRL+R, and not Run the VI when its

opened. I want to create a custom Run button on

the front panel. thats it

 

The biggest problem witht he Run when open the VI

is when you stop the execution of VI, you cannot restart

it agin unles you have acces to run button. 

 

0 Kudos
Message 9 of 13
(4,019 Views)

Yesh wrote:

Still stuck at the same problem. Forget the

above posts where I wanted to run the Vi

when they are opened. Is ther any damn way

to run the code without using then Run button,

not using CTRL+R, and not Run the VI when its

opened. I want to create a custom Run button on

the front panel. thats it


This has already been answered. Answer: NO.

 


The biggest problem witht he Run when open the VI

is when you stop the execution of VI, you cannot restart

it agin unles you have acces to run button. 


It sounds like you're configuring the VI properties to hide the Run button. Methinks you may just want to turn off the toolbar when running.

 

Message Edited by smercurio_fc on 01-11-2010 04:18 PM
Message 10 of 13
(4,011 Views)