11-24-2013 09:43 PM
I have written several applications using state machine architecture. These applications typically have two buttons (I created), a run, and abort. The abort button halts the programand and jumps to an idle state which loops until the run button is selected. One thing I don't like, my programs end up with one or more local variable for the abort button.
1) Should I be using event structures for these types of programs ?
2) Is an event structure program also a state machine ?
Solved! Go to Solution.
11-24-2013 11:11 PM - edited 11-24-2013 11:13 PM
Why would you need local varables for the abort button? Simply make it latch action so it will reset automatically.
If your loop is spinning anyway (e.g. to update displays) you migh as well poll the controls. No event structure needed.
ggress1 wrote:1) Should I be using event structures for these types of programs ?
2) Is an event structure program also a state machine ?
Event structures are primarily for handling user interaction on the front panel. I encourage you to learn about event structures so you can make an informed decision on the best code architecture for any given programming problem. Maybe you should show us some of your code so we can decide in using event structures would improve things.
A program with event structures is typically much less forgiving of beginner mistakes. Used incorrectly, they can easily lock up your program.
11-26-2013 03:06 AM
@ggress1 wrote:
2) Is an event structure program also a state machine ?
You can create an event driven state machine, in which case e.g. the idle case has an event structure waiting for input and if timeout or event happens it sends out a State to act on.
/Y