; ascii to decimal
; input R1
ORG 0H
MOV R1,#39 ;Input ascii code in decimal
MOV A,R1
LCALL CONV
SJMP $
CONV: CLR C
SUBB A,#41
MOV A,R1
JC DGT
CLR C
SUBB A,#37 ;ASCII(CHAR)
RET
DGT: CLR C
SUBB A,#30 ;ASCII(NUMBER)
RET
END
Related topics:
8051 Program - decimal to hex | 8051 Program - hex to decimal 8bit | 8051 Program - decimal to ascii | 8051 Program - hex to ascii | 8051 Program - ascii to hex | 8051 Program - bcd to ascii | 8051 Program - ascii to bcd | 8051 Program - bcd to hex 8bit | 8051 Program - hex to bcd 8bit | 8051 Program - hex to bcd 12bit | 8051 Program - memory subroutines | 8051 Program - math subroutines | 8051 Program - conversion subroutines
List of topics: 8051
No comments:
Post a Comment