Keil Logo

DEFINE

The DEFINE command creates a symbol of a specified type. Symbols created with the DEFINE command are not placed in the memory space of the CPU. They are symbolic names for values and can be used exactly as any other public symbol; thus, they can hold input or return values of µVision functions.

Syntax Description
DEFINE type identifier Defines a symbol named identifier with the specified type.
DEFINE BUTTON "label", "cmd" Defines a Toolbox command button.

The identifier is the name of the symbol and must conform to the rules for variables or symbols. The possible symbol types are listed in the following table.

Type Description
CHAR A signed character (signed char).
DOUBLE A double precision floating-point number (double).
FLOAT A single precision floating-point number (float).
INT A signed integer (signed int).
LONG A signed long integer (signed long).

Example

>DEFINE CHAR TmpByte    /* define TmpByte to be a char value   */
>DEFINE FLOAT TmpFloat  /* define TmpFloat to be a float value */

>TmpFloat = 3.14159     /* give TmpFloat a value               */
>TmpFloat               /* display the value of TmpFloat       */
3.14159

DEFINE BUTTON

Use this command to add a button to the Toolbox window. A maximum of 16 buttons can be defined.

label is the name assigned to the button.

cmd is the µVision command assigned to the button. This command is executed when the button is clicked.

The DEFINE BUTTON command adds the button to the Toolbox window. Each button receives a button number, which is displayed in the Toolbox window. Use this number to remove the button from the Toolbox window.

Example

>DEFINE BUTTON "clr dptr", "dptr=0"
>DEFINE BUTTON "show main()", "u main"
>DEFINE BUTTON "show r7", "printf (\"R7=%02XH\\n\",R7)"

Note

  • The printf-command example above introduces nested strings. Escape double-quote characters (\") within the format string of printf to avoid syntax errors.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.