Keil™, An ARM® Company

µVision® User's Guide

DEFINE

SyntaxDescription
DEFINE type identifierDefines 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.

TypeDescription
CHARA signed character (signed char).
DOUBLEA double precision floating-point number (double).
FLOATA single precision floating-point number (float).
INTA signed integer (signed int).
LONGA 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.