SECTION V-3: Data Format Representation Decimal Numbers

There are 2 ways to represent decimal numbers in a PIC assembler, One way is as follows.

MOVLW D'12' ;WREG = 00001100 or 0C in Hex



The lowercase d will work also. This is different from other assemblers such as the 8051 and x86, In those assemblers, to indicate decimal numbers we simply use the decimal e.g, 12 and nothing before or after it, while in the PIC assembler, 12 is the default for hex numbers.

MOVLW D'37' ;WREG = 25H , 37 in Decimal and 25 in Hex
ADDLW D'17' ;WREG = 37 + 17 = 54, 54 in Decimal and 36H in Hex




The other way to represent decimal numbers is to use ".value"

MOVLW .12 ;WREG = 00001100 = 0CH = 12




More From