The new configuration tool is available in the download section of the website; release AFSM 2.x. The tool is part of the second release of the Arduino Finite State Machine software. The second release of the AFSM exist of the Configurator, the AFSM debugger and the Sketch. In the first release of the AFSM, the configuration and the definition of the I/O had to be done by hand in the UserConfiguration.h file and had to be done according to certain rules. The rules are now build into the configuration tool. The benefit is that I/O will always be defined in the right way and is made much easier.
Description of the Configurator
See the picture below for an overview of the screen:
The configurator can be started in Visual Studio when the project of choice is opened. It is also possible to get the executable from the project folder (release or debug version). Click here for more information about the executables.
Getting/saving project data
With the "Get old configuration" button, the actual project data is fetched and presented in the boxes. Once the button is pressed, it is deactivated. When all changes are made in the configuration, press the "Generate new" button. The UserConfiguration.h and the UserFiniteStateMachine.h files are rewriten.
Be aware of build and upload the sketch to the connected 2560MEGA board after saving the new writen files.
TAG, I/O point definition.
NOTE: TAG's are the way the AFSM is communicating with the I/O pins and TAG's have to be used in all predefined functions for the finite state machine. For every TAG a controlmodule is defined in the AFSM. Once the TAG is defined you can use it all over the AFSM software. Infact, after the definition of the TAG, it is possible to present the I/O in the serial monitor and also on HMI (the AFSM Windows 10 debugger). It is also possible to trend the TAG in the HMI plotter and if needed; writen to the database (without extra coding!).
As you can see, with the configurator you can define all predefined I/O types of the AFSM. Specials are the ultrasonics, 2 Digital pins have to be coupled and for the temperature sensors, the DS18B20 is supported via just one PWM pin. In general the working of the configuration; input a TAG name for the I/O point in the text field located under the specific I/O type and press the "Add" button. Then goto the outer left listbox with the arduino Pins and drag/drop the specif pin on the TAG. For the ultrasonic you have to drag/drop 2 pins on the TAG (one for the trigger pin and one for the echo pin). As already mentioned, when defining a temperature sensor, just one pin has to be dropped on the first sensor. When defining another temperature sensor, the same pin will be used, the pin will be added automatically. Typical for DS18B20 sensors.
When an arduino pin is dragged from the pin list and dropped on the TAG, the pin is not longer available in the pin list and cannot be used for another TAG. To remove a TAG from the I/O list, simply right click on the TAG; a popup is presented with the question to remove the TAG. After removing, the pin will be available again in het pin list box. Be aware; there is not a check on the presence of the removed TAG in UserFiniteStateMachine.h (maybe from version2.6).
In the Finite State list box, new states can be defined by input of the name in the text box and press the "Add" button. When the "Generate new" button is pressed and there are new states defined, a new code block is writen into the UserFiniteStateMachine.h file. See the example code block below of the new defined state "LED-OFF":
It is also possible to remove an already state from the list box with a right click. A check is done on the existens of the state in the UserFiniteStateMachine.h file. When it already exists, the removing of the state from the list box is blocked.
On the right side of the Configurator, is also the box with check buttons for activating of certain software in the AFSM. There are 4 checkboxes at the moment:
- I2C, activate the I2C protocol. Used for I2C devices.
- HMI serial, used for activation of the serial communication with e.g. the HMI.
- GPS, actvate the software for communication with a GPS device on TX/RX3.
- Intercard, activation of the software for intercard communication, see also project "notification call system"
Example of a filled Configuration screen
It is always possible to edit the header files (UserConfigurator.h and UserFiniteStateMachine.h) by hand. You can find the files in the Visual Studio environment under Sketch/header files. Some parts of the files must be present to not crash the Configurator or make a non working header file. The parts that have to be left unchanged -and are used by the Configuration tool- are clearly noted in the header files. Don't delete or change these parts.
Infact the UserFiniteStateMachine.h contains the code for the machine and you have to edit this file by hand to make beautiful/stable controls.