To create a new active object VI based on the HSM template:
1. Create a blank VI. Select "LabHSM - HSM Template.vi"
from "Functions/User Libraries/LabHSM palette" and drop
it on the block diagram.
2. Save the VI under some name (It must start with
"Demo_" if your LabHSM toolkit copy is not registered
3. Launch the LabHSM Editor from the Tools menu.
4. Create a new HSM file in the LabHSM Editor by
clicking on the New button or selecting New in the File
5. Save the new HSM file under the same name and in the
same folder as the VI you saved in step 2.
That's it! You already have a fully functional
event-driven LabVIEW application. Well, it consists of
only one active object so far and all it can do is
exiting. However, it has all the plumbing code necessary
to develop it further to any desirable functionality.
While doing that you will work on a higher level of
abstraction, thinking in terms of states, events and
actions. The best part is that no matter how many times
you add or change the functionality, no matter how
complex the behavior becomes, the complexity of the code
will not change much, because, basically, all that can
change is the number of actions!
So, just add your states, events and actions in the
LabHSM editor and completely define the behavior of your
object there. Then (or at the same time if you wish) add
the desired controls and indicators to the front panel
and code for your actions into the respective cases of
the Processing loop case structure. If you want to
capture user events other than clicking on the Exit
button and closing the front panel, modify the event
structure to throw the necessary events in a way similar
to the way it was done for the Exit button.
You may also want to add some shift registers to the
processing loop for your frequently accessed data or
store (some of) it in external functional (LV2 style) globals.
Use LabHSM template as a wrapper to give "life"
and complex event-driven behavior to traditional GOOP
objects! Just call their methods in the respective
Turn on LabVIEW context help and hover the mouse over
controls in the LabHSM Editor. Their descriptions will
provide some additional detailed information on the
options you have when describing desired HSM behavior.
Please check out the supplied
examples to learn how you can launch or even
instantiate other active objects, post messages/events
to self and send them between active objects on the same
machine or over the network. You will also learn from
the examples how to work with external timers which are
just - you guessed right! - active objects too, which
send messages to yours at the intervals you specify and
can change at run time.