LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Momentary switches and sequential logic--- seeminly not available in Labview

What you just described is what a state machine does!

 

You can proceed through steps in a certain order.  At the end of a step, you can proceed to another one, or decide through a case structure or Select function, "Hey that Brief True occurred", and go to a different state.

0 Kudos
Message 11 of 39
(1,366 Views)

@blessedk wrote:
so I am looking for some other means that allows me to execute any section of my block diagram again and again as much as I want irrespective of data flow or the sequence of the codes

Unfortunately, the State Machine is by far the best solution for that.  Anything else will be nothing but a cludge and asking for more trouble down the road.  I highly recommend you just bite the bullet now and start the rewrite process.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 12 of 39
(1,365 Views)
Thanks for all your feedback. I will brave it and start breaking down this large vi. ( or re-write or whatever it takes). However I have one more concern: I have already made a good looking front panel out of the original large vi ( which I don't want to sacrifice or lose). This front panel is made up of several tabs with each tab consisting of several indicators and controls as necessary. From the few subvis I have managed so far to make out of this large vi, I see front panels that don't look so great and are actually subsets of what I would like to see on a front panel tab page. How do I ensure that my original front panel outlook is maintained after breaking this down and designing a state machine which will then determine how the front panel looks. How do I combine objects from two or more different front panels from two or more subvis into one front and place them on a tab i want just as with my original large vi front panel.

[BADGE NAME]

0 Kudos
Message 13 of 39
(1,352 Views)

You do know how to pass values out of your subVI, right?  If not, you really should take some of the tutorials.

3 Hour Introduction
6 Hour Introduction
LabVEW Basics
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Learning NI
Getting Started with NI Products


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 39
(1,345 Views)

It doesn't matter what it looks like in the subVI's.  They just receive data in and send data out, both by way of the connector panel.  Your Main VI stays the same.  You just wire up the outputs of the subVI's to the appropriate terminals to your current Main VI front panel.

 

By the way, making subVI"s out of sections of code has nothing to do with state machines.  You can have a state machine without subVI's.  You can have subVI's, in non-state machine programs.

0 Kudos
Message 15 of 39
(1,341 Views)
OK. But I thought the state machine will be a separate vi which becomes the main vi which then calls the subvis ? Or you do you mean that my current large vi will remain the main vi which calls the Subvis?

[BADGE NAME]

0 Kudos
Message 16 of 39
(1,336 Views)
RavensFan,
I Just saw the last paragraph of your last connent. If I can have a state machine without subvis that would be my best bet.

How can I do that given my particular circumstances of a single large vi which I want to run sections of?

[BADGE NAME]

0 Kudos
Message 17 of 39
(1,332 Views)

Correct.  A state machine is not a separate VI.  It is an architecture for how you structure your main VI.

0 Kudos
Message 18 of 39
(1,330 Views)
So when I want to create the state machine block diagram, in which vi should that be, a new separate vi or within the same vi as the original single large vi? I noticed that when I try to do that in a separate vi errors saying " event data node: cluster is invalid or empty or contains unwired or bad terminal and event sources do not exist. Also do the nodes of the SubVi which I placed inside the event structure have to be wired? One other thing I noticed with my original large vi was that as soon as I reduced some sections of the block diagram into subvis, the vi wouldn't run properly.

[BADGE NAME]

0 Kudos
Message 19 of 39
(1,302 Views)

Start LabVIEW 2015.  Before opening anything, click the big Create Project button on the left.  Choose Simple State Machine.  Follow the prompts, then view (and study, and make sure you understand) the results.  Read all of the documentation and text, examine all of the cases.  Try to understand how (or if) this "maps" to your Project.  Then start moving your Project into this Framework.  [I recommend moving small parts of your Project in, say 2-3 States, testing it, seeing if it works, getting it to work, then adding more details, rather than trying to do "everything all at once".  It makes debugging so much simpler when you are debugging something small and compact, not huge and sprawling.]

 

Bob Schor

0 Kudos
Message 20 of 39
(1,291 Views)