Step 1 – Naming the Macro

 

Step 1 requires you to enter the macro’s name and to set up a few items defining the general nature of the macro which will affect the screens you see in later steps.

 

The Name is mandatory, must be unique within the project in which it will be used and follow the naming conventions of standard Proton labels.

 

If the macro will be returning data choose the format in which you want the macro to be called from the “Return” drop down. The choices are:

 

“None” the macro will not return a value

“In-Line” requires the macro to be called in the form

“Var = MacroName, Arg1, Arg2 etc….”

“Last Param” requires the macro to be called with the return variable as the last parameter in the parameter list.

 

See also restrictions on optional Arguments when using a return variable.

 

The Description is optional; any data you place in the Description field will be placed as comment ahead of the Macro code.

 

If all the parameters you will allow to be passed to the macro or returned from the macro can have alternative type casts – e.g. Byte, Word or DWord check “Allow Type Conversion”.  If this is not checked you will be able to define the cast for each parameter individually if necessary.

 

If you intend to have a help file which documents the use of the macro check Add Link to Help File.  You will be asked in a later step to enter the name and optionally the TopicID of the help file.

 

Define the Target PIC type with which this macro can be used.  If the macro is independent of the PIC type select the “Both” option, if it is only applicable to a 16 bit core device select “16 Bit”.

 

Typically a macro would call a previously written Basic routine; however, there may be instances when you would want to write your own assembler routine within the macro.  If “Build a Skeleton” is clicked the wizard will generate all the code for validating arguments passed to it or values returned from it but will not call any other code.

 

If you have an existing macro which you saved as a source macro you can reload it by clicking on “Existing”.  This will reload all the parameter settings for the macro you previously set up.