When concentrating on the FSM functions on the board it is often useful to have some sort of monitor available for testing/debugging. The standard contains (as documented) a help function in the serial monitor (channel 0). Like the serial monitor help function, there is now also a VBA program available with monitor functions. Also available are the standard build in functions for forcing and masking I/O tags when using this debugger. The application is based on the already existing HMI functions for communication with the MEGA 2560 board. When the sketch is written with the latest standard, you can start the application whiteout any changes to the Visual Studio application (the HMI debug application). Just add the right com port and baudrate to the shortcut of the debug app and start. The application will send the @GMI message to the board. The board responds with the meta data of the I/O. Dynamically all I/O-points are placed on the form - column wise. The name of the I/O point is also presented on the form together with the I/O type. So all I/O is presented on the form with the standard functionality as normally available (data polling, dynamical updates, tooltips, contextmenu). Also presented on the form is a checked listbox with all possible finite states. A checked entry, presents a running state. Every change of transition made on the board is updated in the list. Below the checked listbox, there are 3 extra fields with; free RAM on the board, the current cylce time and the time of the board.
In the latest version an extra parameter to the shortcut can be added; the monitor parameter. When it contains a YES, all known I/O is automatic added to the form, otherwise no columns are loaded. The VB application is now ideal for use as a template for making your own GUI forms when you ommit the monitor parameter. Also new is saving the raw data to an access database via the VB programm. Every I/O type can be saved by opening the context menu by means of a right mouse click. When data is saved to the database a "disc" icoon is shown on the form and the saved I/O value is presented bold. You can save every tag present on the form. When the VB programm is stopt, the logging is also halted. Be aware that the information for Database logging is send to the board, so when the VB programm is started again, the logging to the database will continue as long as the board isn't reset or logging is turned of by the user via de context menu. See also the example below.
Click here for a demo video of the debug application
See also the example picture of the form below:
The yellow background on the form presents -in this case- a forced digital I/O. See the documentation under chapter "HMI- Arduino - Sketch", Auto- Handmode. Below an example of the contextmenu for forcing I/O.
See also the declaration of the I/O and the FSM code:
And part the code of the FSM:
The monitor is updated (nov 2016) and contains some extra information, e.g. a progress bar for received messages from the board, and a bar representing the buffered messages on the PC; the PC is buffering messages for a retry when no acknowledge is received from the board for prior send messages.
New is also the use of parameters for the shortcut of the executable. The following parameters can be added to the shortcut of the executable:
The default comport is COM5 and the default baudrate is 9600 bps. When a parameter is not added to the shortcut, the system will use the default. You have to set the monitor parameter to YES for automatic loading of the I/O fields. When this parameter is omitted you can use the VB programm as a template for your DIY GUI form.
The Debug App contains also plotter functionality. This is a beta version; when using the plotter; define all 3 possible pins.