Difference between revisions of "Creating a New Macro"

From Flowcode Help
Jump to navigationJump to search
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<sidebar>Sidebar: What Is a Macro?</sidebar>
+
:''See [[Macro Icon Properties]]''
Select the 'New' option from the Macro Menu or press '''Ctrl+M''' to create a new macro. You can also create a new macro through the [[Project Explorer]].
+
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.
  
The Macro dialog will appear with the following sections for filling in information, and adding options:
+
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:
  
 
[[File:Gen_Creating_a_New_Macro_01.png|right]]
 
[[File:Gen_Creating_a_New_Macro_01.png|right]]
  
'''Name'''
+
 
 +
__TOC__
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
==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.
 
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'''
+
===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.
 +
 
  
Enter a description of the macro and its functions.
+
===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.
  
'''Parameters'''
+
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.
  
Adds a list of parameters that are required to be supplied to the macro.
+
Refer to component macros for examples of parameters in action.  
  
 
Set the Name and type of the parameters.
 
Set the Name and type of the parameters.
Line 26: Line 60:
  
  
'''Variables'''
+
===Variables===
  
Adds a list of variables that are required to be used by the macro.
+
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'''
+
 
 +
===Constants===
  
 
Add, edit and delete constants which are only available to the selected macro.
 
Add, edit and delete constants which are only available to the selected macro.
  
  
'''Return type'''
+
===Return type===
  
Specify the return type, or "No return variable" if the macro does not return a value.  
+
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'''
+
===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.
+
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.
  
===Video instructions===
+
This is useful for creating invisible helper functions such as the LCD RawSend function.
 +
 
 +
 
 +
==Video instructions==
 
See the [http://www.youtube.com/watch?v=5Z3zbVR7ZZY&list=PLQDWBb7bxuCgg6aJgPJcfXBMzZdLILceQ 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.
 
See the [http://www.youtube.com/watch?v=5Z3zbVR7ZZY&list=PLQDWBb7bxuCgg6aJgPJcfXBMzZdLILceQ 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.
  
<div align="center">
+
 
{{#ev:youtube|5Z3zbVR7ZZY|640}}
+
==Advanced Features==
</div>
+
 
 +
 
 +
===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
 +
 
 +
[[File:Macro_AdVar.jpg]]
 +
 
 +
 
 +
Pressing OK will allow the parameters to be automatically generated.
 +
 
 +
[[File:Macro_AdVar2.jpg]]
 +
 
 +
 
 +
This syntax also works when creating local and global variables.

Latest revision as of 11:08, 22 March 2023

See Macro Icon Properties

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:

Gen Creating a New Macro 01.png











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

Macro AdVar.jpg


Pressing OK will allow the parameters to be automatically generated.

Macro AdVar2.jpg


This syntax also works when creating local and global variables.