Professional Documents
Culture Documents
MNEMONICS
MOV DPTR,#4600
MOVX A,@DPTR
MOV R5,A
ANL A,#F0
SWAP A
MOV R1,A
MOV A,R5
ANL A,#0F
MOV R2,A
MOV A,R1
MOV F0,#0A
MUL AB
ADD A,R2
INC DPTR
MOVX @DPTR,A
SJMP HERE
HERE
Hexadecimal to BCD
LABEL
MNEMONICS
MOV DPTR,#4600
MOVX A,@DPTR
MOV F0,#64
DIV AB
INC DPTR
MOVX @DPTR,A
MOV A,F0
MOV F0,#0A
DIV AB
SWAP A
ADD A,F0
INC DPTR
MOVX @DPTR,A
HERE
SJMP HERE
Lab 7
Ex.No.7: ASCII To Decimal Conversion And Decimal To ASCII Conversion
7.1 Introduction:
The purpose of this experiment is to obtain the ASCII To Decimal and vice versa of a
given data using 8051 micro controller trainer kit.
7.2 Hardware Requirement:
The 8051 Microcontroller kit, Power supply.
7.3 Program Logic:
In this program, 8 bit two digit ASCII number system into decimal number system. Acronym
for the American Standard Code for Information Interchange. Pronounced ask-ee, ASCII is a code for
representing English characters as numbers, with each letter assigned a number from 0 to 127 into
decimal number and vice versa.
7.4 Program:
ASCII to DECIMAL:
LABEL
MNEMONICS
MOV DPTR,#4500
MOV A,#DATA
CLR C
SUBB A,#30
CLR C
SUBB A,#0A
JC STR
MOV A,#0FF
SJMP LOOP
STR
ADD A,#0A
LOOP
MOVX @DPTR,A
HERE
SJMP HERE
DECIMAL TO ASCII:
LABEL
MNEMONICS
MOV DPTR,#4500
MOVX A,@DPTR
MOV R0,#30
ADD A,R0
INC DPTR
MOVX @DPTR,A
HERE
SJMP HERE
Lab 8
MNEMONICS
MOV DPTR,#5600
MOVX A,@DPTR
MOV R1,A
MOV R2,#01
LOOP
MOV A,R1
MOV F0,R2
DIV AB
MOV R3,A
MOV R4,F0
SUBB A,R2
JZ RESULT
INC R2
SJMP LOOP
RESULT
MOV DPTR,#5700
MOV A,R3
MOVX @DPTR,A
HERE
SJMP HERE
1. Why are program counter and stack pointer are 16-bit registers?
2. What are register banks?
3. Mention any 3 applications of microcontroller?
4. How to program the microcontroller 89C51?
8.6 Post-Lab Questions:
1.
2.
3.
4.