Numeric Constants and Radix

MPASM Assembler

Numeric Constants and Radix

MPASM assembler supports the following radix forms for constants: hexadecimal, decimal, octal, binary, and ASCII. The default radix is hexadecimal; the default radix determines what value will be assigned to constants in the object file when a radix is not explicitly specified by a base descriptor.

Note: The radix for numeric constants can be different from the default radix specifed with the directives radix or list r=. Also, allowable default radices are limited to hexadecimal, decimal, and octal.

Constants can be optionally preceded by a plus or minus sign. If unsigned, the value is assumed to be positive.

Note: Intermediate values in constant expressions are treated as 32-bit unsigned integers. Whenever an attempt is made to place a constant in a field for which it is too large, a truncation warning will be issued.

The following table presents the various radix specifications:

Table: Radix Specifications
Type
Syntax
Example
Decimal
D'<digits>'
.'<digits>'
D'100'
.'100'
Hexadecimal
H'<hex_digits>'
0x<hex_digits>
H'9f'
0x9f
Octal
O'<octal_digits>'
O'777'
Binary
B'<binary_digits>'
B'00111001'
ASCII
A'<character>'
'<character>'
A'C'
'C'


Microchip Technology Inc.
Microchip's Web Site
Voice: (480) 792-7200
Fax: (480) 899-9210
Microchip's E-mail Address
PreviousNext