# <!-- var kmNextPage = "uv3_db_exp_sysvariables.htm"; var kmPrevPage = "uv3_db_expressions.htm"; var kmNextPageTitle = "System Variables"; var kmPrevPageTitle = "Expressions"; var kmBreadCrumbs = "<a href=\"default.htm\">Home</a> &raquo; <a href=\"uv3_debugging.htm\">Debugging</a> &raquo; <a href=\"uv3_db_expressions.htm\">Expressions</a> &raquo; Constants"; kmSetupPaging (); kmNavButtons(); //--> Constants

The µVision3 accepts decimal constants, HEX constants, octal constants, binary constants, floating-point constants, character constants, and string constants.

## Binary, Decimal, HEX, and Octal Constants

By default, numeric constants are decimal or base ten numbers. When you enter 10, this is the number ten and not the HEX value 10h. The following table shows the prefixes and suffixes that are required to enter constants in base 2 (binary), base 8 (octal), base 10 (decimal), and base 16 (HEX).

Base Prefix Suffix Example
Binary: None Y or y 11111111Y
Decimal: None T or none 1234T or 1234
Hexadecimal: 0x or 0X H or h 1234H or 0x1234
Octal: 0 (zero) Q, q, O, or o 0777 or 777q or 777Q or 777o

Following are a few points to note about numeric constants.

• Numbers may be grouped with the dollar sign character ("\$") to make them easier to read. For example, 1111\$1111y is the same as 11111111y.
• HEX constants must begin prefixed with a leading zero when the first digit in the constant is A-F.
• By default, numeric constants are 16-bit values. They may be followed with an L to make them long, 32-bit values. For example: 0x1234L, 1234L, 1255HL.
• When a number is entered that is larger than the range of a 16-bit integer , the number is promoted automatically to a 32-bit integer.

## Floating-Point Constants

Floating-point constants are entered in one of the following formats.

number . number

number e[+|-] number

number . number [e[+|-] number]

For example, 4.12, 0.1e3, and 12.12e–5. In contrast with the C programming language, floating-point numbers must have a digit before the decimal point. For example, .12 is not allowed. It must be entered as 0.12.

## Character Constants

The rules of the C programming language for character constants apply to the µVision3 debugger. For example, the following are all valid character constants.

```'a', '1', '\n', '\v', '\x0FE', '\015'
```

Also escape sequences are supported as listed in the following table:

Sequence Description
\\ Backslash character ( \ ).
\" Double quote.
\' Single quote.
\b Backspace.
\f Form feed.
\n Newline.
\r Carriage return.
\t Tab.
\0nn Octal constant.
\Xnnn HEX constant.

## String Constants

The rules of the C programming language for string constants also apply to µVision3. For example:

```"string\x007\n"                      "value of %s = %04XH\n"
```

Nested strings may be required in some cases. For example, double quotes for a nested string must be escaped. For example:

```"printf (\"hello world!\n\")"
```

In contrast with the C programming language, successive strings are not concatenated into a single string. For example, "string1+" "string2" is not combined into a single string.

##### Important information

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