02-04-2016 03:48 AM
Continued from question http://forums.ni.com/t5/LabVIEW/2-parallel-state-machine/m-p/3247857#M946309
Want to start 2 state machines running parallel. Have been suggested to use UserEvents
Mainvi:
subvi:
I have 2 questions:
1)
Am I right when is say that I can place my state machine in the subvi instead of the random generator and the waveform chart?
2)
how to start subvi with arguments?
Solved! Go to Solution.
02-04-2016 04:32 AM - edited 02-04-2016 04:35 AM
@Michael.Koppelgaard wrote:Continued from question http://forums.ni.com/t5/LabVIEW/2-parallel-state-machine/m-p/3247857#M946309
Want to start 2 state machines running parallel. Have been suggested to use UserEvents
I have 2 questions:
1)
Am I right when is say that I can place my state machine in the subvi instead of the random generator and the waveform chart?
Yes, one way if you create your state machine by using a shift register (with Enum or string) located on the While loop around the Event structure. Note that, the timeout of the Event structure which is creating the random numbers at certain intervals. You could have your DAQ here. Of course, there are other options, like using two parallel loops in the subVI, top loop only for the GUI and Dynamic Events, and the bottom loop would do the DAQ, and even hold the state machine logic...
2)
how to start subvi with arguments?
Also have a look how I did in my example project: I call the subVI with two arguments: an ID (numeric U32) and the typdef cluster holding the UserEvents references. You can just easily create another input terminal for this subVI, like a cluster which could hold several parameters (like DAQ parameters, COM ports, device ID, etc...). After modifying this subVI, do not forget to update the "Type specifier VI refnum (for type only)". You can right click on this object, and browse your modified subVI, so the new input terminal will "appear" on the "Start async call" icon.
EDIT: start to design your state machine in the subVI, and later post your VI so we can comment and help if you need.
02-04-2016 07:05 AM
I have to keep it as simple as possible for now. Have to finish this program and the equipment by the end of this mount.
But later in March I'm going on a Labview course which hope can teach me about this - I find it difficult to understand despite your help. I will properly return with more questions
02-04-2016 07:11 AM
Is it possible to have to to instances of the subvi in 1 form, 1 in each tab i a tabcontrol?
02-04-2016 07:16 AM
@Michael.Koppelgaard wrote:Is it possible to have to to instances of the subvi in 1 form, 1 in each tab i a tabcontrol?
I think for this case you need to use subpanels. However I never used subpanels before, but if i get some time I can have a look how to load two clones of the single subVI into two subpanels (i guess this is what you want?).
Maybe someone with better LV skills will come here, and show us how to deal with subpanels in this case...?
(no time right now, I have German lesson in 3 hours, and my home work is not done yet 😄 )
02-04-2016 07:20 AM
Okay - you are a student
I better not answer more questions today.
Do you have some spare time tomorow ?
02-04-2016 07:27 AM - edited 02-04-2016 07:31 AM
Haha, it is offtopic, but I am not a student unfortunately anymore 😞 I am a "wissenschaftler mitarbeiter" (physicist, got my PhD back in 2011) in a research center in Germany. It is pretty hard to start learning German when you would like to spend more time with programming and research 😄
Yes, I might have some time tomorrow, lets see...
edit: have a look at this doc in the mainwhile: http://digital.ni.com/public.nsf/allkb/60A749CF788726088625766200537F65
02-05-2016 09:23 AM
Nice !!!
Now I can load the same vi twice - but can't start I though.
02-05-2016 09:24 AM
Here is my main Vi
02-05-2016 09:50 AM
Ups - this must be more correct