LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start button xcontrol

Solved!
Go to solution

Hello!

 

I have a project where I needed a start button. Turned out it was quite easy to make one in an xcontrol:

start button.png

I did a search for existing solutions but couldn't find any, and since many ask for a start button I'll just leave this here.

 

To use it, drag and drop the xcontrol in your vi.

 

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 1 of 14
(4,869 Views)

Well, you are basically building on my silly idea draft here. There should never be a reason for such a start button if the code is implemented as a proper state machine. When was the last time you had to start or stop MS word, excel, or internet explorer?

 

The difference between "edit mode", "run mode", and "running" only makes sense in the LabVIEW development environment. A finished application needs to be set to "run when openend" and should disappear when closed. This has been discussed many times.

 

What is your suggested use for such a button? Why do you "need" it?

 

I think it only entices new LabVIEW users to take shortcuts and write incomplete code. This should not be encouraged. 😞

Message 2 of 14
(4,859 Views)

> When was the last time you had to start or stop MS word, excel

 

You've never coded scripts, have you?

 

> The difference between "edit mode", "run mode", and "running" only makes sense in the LabVIEW development environment.

 

Depends entirely on what you want the instrument to do.

 

> There should never be a reason for such a start button if the code is implemented as a proper state machine.

 

That's the crux. I'm implementing a fine-grained data-flow programming system in LabVIEW, therefore I can't have any state machines. Yes, there are other ways I could get around this, as well. Problem is, all other solutions take a lot of work and are cumbersome. So much easier to just have a button.

 

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 3 of 14
(4,827 Views)

@O.P. wrote:

I'm implementing a fine-grained data-flow programming system in LabVIEW, therefore I can't have any state machines. 


I have absolutely no idea what that means. Can you enlighten me?

0 Kudos
Message 4 of 14
(4,807 Views)

@altenbach wrote:

 

I have absolutely no idea what that means. Can you enlighten me?


 

LabVIEW belongs to a group of programs called Data Flow Visual Programming Languages (DFVPL). It's a coarse-grained DFVPL, because it offers some execution control (most notably, branching a wire starts a new thread). In order to make it fine-grained, wires need to represent a flow of values, instead of a single value as it is now. Because of that, LV while and for loops become a big no-no.

 

Some papers on this topic:

 

Advances in Dataflow Programming Languages,

Johnston, Hanna, Millar

 

Visual Languages and Computing Survey: Data Flow Visual Programming Languages

Hils

 

Dataflow Programming Concept, Languages and Applications

Sousa

 

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 5 of 14
(4,801 Views)

@O.P. wrote:

@altenbach wrote:

 

I have absolutely no idea what that means. Can you enlighten me?


 

LabVIEW belongs to a group of programs called Data Flow Visual Programming Languages (DFVPL). It's a coarse-grained DFVPL, because it offers some execution control (most notably, branching a wire starts a new thread). In order to make it fine-grained, wires need to represent a flow of values, instead of a single value as it is now. Because of that, LV while and for loops become a big no-no.

 


I'm pretty sure branching a wire does not start a new thread...If it did, I'd have about 1000 threads running. It only creates a copy of the data (when necessary). The compiler decides. Furthermore, LabVIEW threading is implicit. The programmer doesn't really have control over any of the threading; the compiler is smart, let it do it's work. And, I have a lot of "no-no's" in every single VI I have ever written if this is the case with loops. <sarcasm> I should really stop using LabVIEW </sarcasm>. I'm sure others will come with more in depth information, but I do believe your statements do not hold a lot of water.

Message 6 of 14
(4,793 Views)

It sounds to me like you are trying to rewrite LabVIEW. Under the hood LabVIEW is very fine grain in terms of determining when a node can execute. While/For loops become a more complex node however internally any node within the loop can and will execute when all of its inputs are satisfied. Without constructs to control the execution flow you could not write a program. It would be impossible to write an application without any loops or decision constructs.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 7 of 14
(4,774 Views)

These are all such big words 😮

Why you would consider misusing a UI centric feature (Xcontrol) as a central code feature is beyond my understanding. I just don't get it, I guess. 🙂

Message 8 of 14
(4,772 Views)

@Mark_Yedinak wrote:

It sounds to me like you are trying to rewrite LabVIEW. 


^^ This.

0 Kudos
Message 9 of 14
(4,746 Views)

@Mark_Yedinak wrote:

It sounds to me like you are trying to rewrite LabVIEW. Under the hood LabVIEW is very fine grain in terms of determining when a node can execute. While/For loops become a more complex node however internally any node within the loop can and will execute when all of its inputs are satisfied. Without constructs to control the execution flow you could not write a program. It would be impossible to write an application without any loops or decision constructs.


I'm trying to design an API for our research group's data stream management system, as part of my PhD. Yes, of course there are loops and all; I'm hiding all that in subvis mainly by using xcontrols, master/slave combos and classes.

 


@altenbach wrote:

These are all such big words 😮

Why you would consider misusing a UI centric feature (Xcontrol) as a central code feature is beyond my understanding. I just don't get it, I guess. 🙂


I don't really see the difference between one and the other. But I do need to learn more about xcontrols, that's for sure.

 

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 10 of 14
(4,719 Views)