04-29-2016 09:01 AM
Hello all,
I started of my first labview project a few months ago with a large block diagram.
Now i realize that i need event driven (value change driven) state machines to be able to go back to sections of code otherwise once the program goes past a certain section to the next, i wont be able to execute the previous code again.
This is the very first state machine i will be building. I believe with a fair understading of event structures/ case structures, shift registers and while loops i should be able to, but there are certain key concepts i dont uderstand.
1. As i mentioned above, i started off with a comprehensive large block diagram. Now I am making subvis out of them which i intend to place into the case structures of my state machine vi. What becomes the use of the intial large block diagram i started off with. Also does the state machine vi simply consist of just the case/event structures, while loop and shift registers?
2. My cases should only pass data from one subvi in a forward direction (eg. from 1 to 2 not from 2 to 1). Howeveer still need to be able to change state from 2 to 1.
3. How is the main level vi and which one these will be the main level vi. the state machine or the intial single large block diagram vi.
I know my questions may sound odd but it just shows the confusion i have with how these things work so i need help
04-29-2016 10:42 AM
Hi again.
You may find more responses if you post in the general discussion forum for labview, since not many people would monitor this group.
To help you out:
1. You probably will replace the app with the state machine and subVIs, but unfortunately, there are many ways to do state machines, so there is no right answer to this. Since you mention events, you would probably be looking at a app loop, with a state for processing events, or possible a more complex producer consumer style where events fire off states or change state logic in the state machine loop.
2. Again, so many possibilities, no right answer, since you can store data between states and pass data between them in the data store, the state information used for state transition logic can change the behavior to be 1-2 or 2-1, it all depends what your states do.
3.
I think you need to review some more state machine options, tutorials and even LabVIEW built in templates for some different options.
Try these.
https://decibel.ni.com/content/docs/DOC-16063
http://www.ni.com/tutorial/7595/en/
http://www.ni.com/video/2963/en/
Hopefully that helps!