LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event driven state machine

Dear
 
 
Recently, I studied about design patterns.
Event driven state machine (http://zone.ni.com/devzone/cda/tut/p/id/2962) is the combination of state machine and event structure.
LabView Style book by P. Blume also explained about this.
 
In order to receive some event in the event driven state machine, ideally, LabView should monitor some idle state (inside while loop) without any delay time.
That is, some infinite loop should be run.
Is the event driven state machine useful in real programming?
0 Kudos
Message 1 of 7
(4,028 Views)
Sorry,

I don't understand the reason behind your post.

You write "ideally, LabView should monitor some idle state (inside while loop) without any delay time."  Is this a statement or a question.  If it's a question the answer is no.  If it's a statement it's wrong AFAIK.

The "activation" of the event structure works on Interrupts I think.  IT does not need to loop in an idle state, this is the whole idea behind the event structure.  It sleeps until it has something to do.

And yes, it's very useful for any kind of decent UI.  Even in "real programming".

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 7
(4,025 Views)
the event stucture in the event-driven-state-machine(edsm) will be inside case routine.
Therefore, while loop should be run every time.
 
Contrary to this, event structure only will sleep until UI event is fired.
 
If so, edsm is a kind of some infinite loop which is not recommended in LV programming.
 
Am I right?
0 Kudos
Message 3 of 7
(4,020 Views)
No you are wrong. Look at the examples in Blume's book for instance and you will see that the structure is a "wait until" not a "loop until".
0 Kudos
Message 4 of 7
(4,009 Views)
Dear  drval
 
Would you please explain me wait until and loop until?
I can't find them.
0 Kudos
Message 5 of 7
(3,996 Views)
Hi labmaster,

"wait until" and "loop until" are no LV functions, drval just gave you a description how the edsm will work.
The event structure "waits until" an event happens, so the state machine doesn't has to iterate all the time!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(3,994 Views)
Dear,
 
I see what you mean.
I knew wait until is not function, but I became aware what you meam after seeing the event structure again.
 
Thanks alot.
 
 
0 Kudos
Message 7 of 7
(3,988 Views)