11-04-2012 07:58 AM
Hello!
I have a project where I needed a start button. Turned out it was quite easy to make one in an xcontrol:
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.
Solved! Go to Solution.
11-04-2012 10:45 AM - edited 11-04-2012 10:47 AM
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. 😞
11-05-2012 02:53 AM
> 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.
11-05-2012 11:18 AM
@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?
11-05-2012 12:06 PM
@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
11-05-2012 12:25 PM - edited 11-05-2012 12:35 PM
@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.
11-05-2012 12:43 PM - edited 11-05-2012 12:44 PM
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.
11-05-2012 12:45 PM
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. 🙂
11-05-2012 02:55 PM
@Mark_Yedinak wrote:
It sounds to me like you are trying to rewrite LabVIEW.
^^ This.
11-06-2012 04:05 AM
@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.