Keil Logo

DEFINE

Syntax Description
DEFINE type identifier Defines a symbol named identifier with the specified type.
DEFINE BUTTON "label", "cmd" Define a Toolbox command button. The toolbox opens with View – Toolbox in the main menu.

The DEFINE command lets you create a symbol with a type that can be used to hold a value. Symbols created this way may be used to hold return values for µVision3 functions or to specify input to µVision3 functions.

Symbols created with the DEFINE command are not placed in the memory space of the simulated or target CPU. They are just symbolic names for values of a specified type. A symbol created by DEFINE may be used just like any other public symbol.

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).

The identifier is the name of the symbol. It must conform to the rules for variables or symbols.

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.

label is the name to assign to the button.

cmd is the µVision3 command or commands to assign to the button. This command is executed when the button is clicked.

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 defined in the last button definition shown above introduces nested strings. The double quote characters (") of printf's format string must be escaped (\") to avoid syntax errors.

When a button is defined, it is immediately added to the Toolbox window. Each button receives a button number which is displayed in the Toolbox window. This number is used to remove specific buttons from the Toolbox window.

  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.