09-04-2017 07:08 PM
Dear friends,
I need some help here. I am using state machine. There are 2 indicator. My target is:
1. the indicator 1 will keep blinking, 2. after 5 iteration of first while loop, 3. the 2nd indicator will blinking as well (the indicator 1 should keep blink as well, not stop).
please check the attached vi(labview 2017 64bit). My problem is the 2nd indicator never start to blink.... if I put the 2nd indicator case into 1st while loop, the 2nd will be blink, its good, but 1st will stop. I do need 1st one blinking all the time, never stop.
Thank you so much again. Could you help me modify my vi, so that the 2nd will blinking after iteraion of 1st whole > 5, but 1st one still keep blinking? Thank you again!!!
Solved! Go to Solution.
09-04-2017 08:17 PM
You have a data dependency. The parts on the right cannot start until the loop on the left has completed.
All you need is a simple state machine with one single outer loop. Try it!
09-04-2017 08:43 PM
09-05-2017 10:53 AM
Dear the knight of NI,
Thanks for your vi, yes, it works well.
However, maybe this is my fault, I didnt make it very clear. I am doing a much bigger simulation. And there are 2 state machine actually. That's why I really really need to keep those 2 state machine. Is there a way to achieve the same thing but keep the 2 state machine?? Thank you so much for your help. you are the best Knight! !!!!
09-05-2017 10:59 AM
You can still create a single state machine that contains all states. No need for separate loops, especially if they both run at the same speed.
If you want to run the two state machines in parallel, there cannot be any data dependency or they will run in sequence only. If this confuses you, you need to go back to the tutorials before proceeding.
09-05-2017 11:04 AM
Dear Knight,
Thanks for your quick reply.
Just make sure, you mean, 2 state machines can NOT be run at the same time? and only can be run one after one? Thank you.
09-05-2017 11:48 AM
sunson29 wrote:Just make sure, you mean, 2 state machines can NOT be run at the same time? and only can be run one after one? Thank you.
No, you can have an unlimited amount of independent state machines on a single diagram, but there cannot be data dependency between them if they should run independently. If you have any wire (except channel wires :D) connecting two state machines, the second one can only start once the first one has completed.
You really need to familiarize yourself better with the principles of dataflow!
09-05-2017 11:54 AM
thanks. where to study the NI dataflow?
09-05-2017 12:14 PM
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
09-05-2017 01:31 PM
@sunson29 wrote:
thanks. where to study the NI dataflow?
Of course do all of Tim's suggestions right above.
Dataflow:
In your case, you have a green wire that stalls the second loop until the first loop has completed.
(Also note that your code to determine odd/even can be replaced by a bitwise AND with the number 1. Also, there is an "=0" primitive).