SECTION V-4: Data Format Representation ASCII Character

Use the letter A to represent the ASCII data in PIC assembler.

MOVLW A'2' ;WREG = 00110010 or 32 in Hex

 

 

Lowercase 'a' can also use. This is different from other assemblers such as the 8051 and x86. In those assemblers, single quotes are used for single ASCII characters and double quotes are used for a string.

MOVLW A'9' ;WREG = 39H, which is hex number for ASCII '9'
ADDLW A'1'

;WREG = 39H + 31H = 70H

;31 Hex is for ASCII '1'

MOVLW '9' ;WREG = 39H, another way for ASCII

 

 

 

 

 

To define ASCII strings, more then one character, we use th DB, define byte directive.

More From Iamtechnical.com

Advertisement:

SiteLock