When you want to connect hardware to the computer and control it by Murmex, one most likely needs to initialise and/or terminate the device. As we did in Step 4: Basic design, we start Murmex by the kick-off message InitialseMessage and start hereby Murmex. We thus always start with the Initialise method. Next, when clicking the terminate button, we send the TerminateMessage and stop the program. We thus always stop with the Terminate method.
By overriding the Initialise and/or Terminate method(s), we can add code that has to be executed.
- If not existing in your project, add the virtual folder “action methods”
- Add to the action methods folder the method Initialise. Use the Right-mouse click menu >> New >> VI for Override…
- Add a case structure for the error and put your code in there. In general you first call the Parent method and then execute your own code. The exceptions are the Terminate and Update method.
- Add to the action methods folder the method Terminate. Use the Right-mouse click menu >> New >> VI for Override…
- Although style prescribes to always use case structures, here one can make the exception. As you might want to run the code even if an error occured. As said before, in general you first call the Parent method and then execute your own code, here is the exception. Once you call the Terminate method, the connection to the server is broken and thus one cannot send message any more (if this would be necessary in your program).