I wanted to have a delay in a statechart that could be interrupted by the user,
but it seemed that I could only pass data with a trigger or in a transition, but
this wouldn't work if the statechart was idling in a timer state.
So here's what I found:
"Interval" and "Delay" control a timing loop inside the statechart.
You can change the values here and watch the "Time" and "Count"
parameters speed up and slow down as "Interval" and "Delay"
are changed. The data is passed back and forth between this vi
and the statechart through Data.vi, ReadData.vi, and WriteData.vi.
The idea comes from "A Software Engineering Approach to LabVIEW"
where they show how a loop with a shift register with a uninitialized
input stores its value in memory. Using this idea, I put a cluster in
a case structure (Data.vi) and this allows me to pass data between
this vi and the statechart. This gets around the problem of needing a
trigger or transition to send info to or from a statechart. The "Timeout"
case of the event structure in Top.vi sends and receives the data
through Data.vi at the timeout rate wired to it.
This structure uses a synchronous statechart and a queue to pass
triggers to it (an idea I got off the Labview forum), but you could
probably replace the synchronous statechart with an asynchronous
one, but I haven't tried it yet.
I'm new to Labview and statecharts so any feedback is appreciated.