Monday, 7 October 2013

program to convert hexadecimal to ascii

        ORG 000H
        SJMP START
        RESULT EQU 30H
START : MOV A,#_H  /*enter the number to convert*/
        MOV B,A
        CLR C
        SUBB A,#0AH
        JC SKIP
        MOV A,B
        ADD A,#37H
        SJMP DOWN
 SKIP : MOV A,B
        ADD A,#30H
 DOWN : MOV RESULT,A
 STOP : SJMP STOP
        END

OUTPUT :

sl.no      HEX no.        ASCII
 1          01H            31
 2          03H            33
 3          0AH            41

No comments:

Post a Comment