Saturday, April 30, 2016

8051 Program – decimal to ascii

; decimal to ascii
; input R1 (0-9)
ORG 0H
MOV R1,#2;Input char
MOV A,R1
LCALL CONV
SJMP $
CONV: CLR C
SUBB A,#0Ah
MOV A,R1
JC DGT
ADD A,#37 ;ASCII(CHAR)
RET
DGT:ADD A,#30 ;ASCII(NUMBER)
RET
END



Related topics:
8051 Program - decimal to hex   |   8051 Program - hex to decimal 8bit   |   8051 Program - ascii to decimal   |   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