Creating a New Macro
To create a new macro for a Flowchart or State Diagram
Select the 'New' option from the 'Macro' ribbon or press Ctrl+M to create a new macro.
You can also create a new macro using the 'Macros' section of the Project Explorer by clicking the arrow next to the 'Macro' item to open up a menu, then selecting 'Add new' from the menu.
Your created macros will be displayed in a list in 'Macros' section of the Project Explorer, here you can add new local variables and constants as well as parameters if you did not do so earlier, you can also delete or edit existing local variables, constants and parameters.
The Macro dialog will appear with the various options and information available to include:
Contents
Standard Features
Name
Enter a name for the macro. If the name that you enter for the new macro already exists, then Flowcode will prompt you for a different name.
Description
Enter a description of the macro and its functions. The description text will appear at the top of your macro flowchart above the Start icon.
Parameters
Adds a list of parameters that are required to be supplied to the macro. A parameter is an input to a macro and used to pass information to set the macro to do something specific.
These variables are local to the macro and so will be affixed with a . before the variable name. When you call a macro each parameter will need to have a valid macro.
Refer to component macros for examples of parameters in action.
Set the Name and type of the parameters.
Parameters can be added, edited or deleted.
Variables
Adds a list of variables that are required to be used by the macro. These variables are local to the macro and so will be affixed with a . before the variable name.
These variables will only exist while you are inside the macro and so allows the overall RAM usage of your program to be lowered.
Constants
Add, edit and delete constants which are only available to the selected macro.
Return type
Specify the return type, or "No return variable" if the macro does not return a value. The return variable is referenced in your macro by referring to the .Return local variable.
Private Flag
When creating a new macro for a component using the customized code feature you will be given a tick box allowing the macro to be private.
If the macro is set to be private then the macro will not appear in the main Flowcode component macro list.
This is useful for creating invisible helper functions such as the LCD RawSend function.
Video instructions
See the Adding Macros video for information on creating a macro, the video shows the creation of a macro in a practical manner which covers the available functionality such as adding a parameter to the macro as well as creating a variable whilst also differentiating from global and local variables and constants.
Advanced Features
Adding multiple parameters of the same type
When adding parameters of certain types you can specify multiple variables at once by adding the names of the parameters with comma separated syntax.
Variable names can be separated with or without spaces
Pressing OK will allow the parameters to be automatically generated.
This syntax also works when creating local and global variables.