02-12-2013 11:40 PM
Hi Mark_Yedinak,
Do you have any example VI for state machine implemented ? Post it if possible
02-13-2013 12:07 AM
i need the commands to be sent one by one, means the first command have to execute and give the reply after that second have to execute. How can I do it using for and case loop.
02-13-2013 01:12 AM
Hi perumpadapu,
This is kind of serial processing then better use 'error out' 'error in' like Mark_Yedinak mentioned otherwise use sequence structure but first appraoch is more appropriate.
Thanks
02-13-2013 02:09 AM
Hi Mark_Yedinak,
I got one more quesiton for you. I have attached my question in vi attached below.
Thanks
02-13-2013 04:56 AM
In that particular case, you cannot use error terminals as they are not present but most of the vi's do have error terminals and wiring to these would ensure data flow. Sequence structures are very inflexible. The following may help:
http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/avoid_overusing_sequence_structures/
02-13-2013 05:08 AM
That means here only sequence is an option.
02-13-2013 10:37 AM
@Ranjeet_Singh wrote:
That means here only sequence is an option.
The answer would be it depends. If you impement a state machine and these actions are two different states then your state machine logic will control order of execution. If this is simply some samll part of code then you would need a sequence structure. However even then I would generally use a single frame and create an artifical data dependency. Your particular example though could be placed in a two frame flat sequence structure. Though in this example I don't see any reason why they code could not execute in parallel.
There are lots of examples of state machines on the forums. The LabVIEW examples should also include an example. Here is a simple example as well.
02-13-2013 11:25 PM
This is just an example having no meaning. This can be executed parallely with no problem but i just want to know how to execute them serially.
What do you mean by 'artifical data dependency'
02-14-2013 12:07 AM
you can use a for loop and inside you create a basic serail VI. The numbers you want to be inserted into an array (build array). The appended array is wired to the write of serail communication. Then it will work serially
02-14-2013 09:13 AM
@Ranjeet_Singh wrote:
This is just an example having no meaning. This can be executed parallely with no problem but i just want to know how to execute them serially.
What do you mean by 'artifical data dependency'
This is basically putting a single sequence frame around some code and either wire a value into or out of the sequence frame. For example, wrap the Wait VI in a single frame sequence structure and wire an error wire through the frame. This will force the Wait to execute after whatever code is passing the error in and any code after the Wait will not run until the Wait is complete if you pass the wire through the frame structure.