LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to do state machine using events .

Solved!
Go to solution
Solution
Accepted by topic author SaranVenkateshS

I'm attaching a small Event State Machine I built to illustrate User Events and using them as a State Machine.  Notice that, in this particular machine, no State takes a lot of time, which means that Events (either Front Panel or State Transitions) get handled quickly.  It does have a single loop, with Shift Registers allowing data to be passed between the "State Machine" and the "Event Structure" simply because they are the same wires in both.

 

Let us know if this is the kind of architechture you are seeking.

 

Bob Schor

Message 11 of 16
(3,667 Views)
What does "I need a function which calls all the event function like state machine" mean? That is awful close gibberish. Likewise I also don't see the point of your code. You click a button in one loop that fires an event in a second loop, which fires an event in a third loop with very little delay between any of these operations.

Describe how you see it working. And please use simple words. As you can tell I am a simple man who gets confused easily.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 12 of 16
(3,649 Views)

Hi Mike ,

 

nice comment 🙂  gibberish

 

is there any way we can do state machine like State Chart . 

http://www.ni.com/labview/statechart/

 

or else like this video 

 

C# can do this job , why labview not able to do these kind of state machines 

https://www.youtube.com/watch?v=GTogQTHR2d8&authuser=0

 

or else 

 

UML based State machine 

0 Kudos
Message 13 of 16
(3,490 Views)

Hi Mike ,

 

Please let me know , if you still cant understand this gibbrish means 🙂

0 Kudos
Message 14 of 16
(3,483 Views)

saran1988 wrote:

is there any way we can do state machine like State Chart . 

http://www.ni.com/labview/statechart/


Didn't you just answer your own question there?  The State Chart module is an add on to LabVIEW.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 15 of 16
(3,448 Views)
The state chart module is in essence an alternative editor. You can't just draw loops and expect them to operate as a state machine. Likewise, events are for signalling.

I have written applications where I have used events to alter the execution of a state machine that was running, but you don't need separate events for each state transition.

See here:
http://www.notatamelion.com/2015/02/23/building-a-proper-labview-state-machine-design-pattern-pt-1/

And here:
http://www.notatamelion.com/2015/03/02/building-a-proper-labview-state-machine-design-pattern-pt-2/

Also be very careful about trying to apply too much of what you learned in other languages to LabVIEW. Basic concepts are fine because a good idea is a good idea regardless of the language in which it is expressed. Specific techniques, however, often do not translate well.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 16 of 16
(3,412 Views)