0% found this document useful (0 votes)
11 views

Microcontroller Lab Experiment ALP

Microcontroller Lab experiment

Uploaded by

Shashidhar Naik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Microcontroller Lab Experiment ALP

Microcontroller Lab experiment

Uploaded by

Shashidhar Naik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Program-3

3.Write an ALP to interchange N byte of data stored from


memory location X with N bytes of data stored from memory
location Y
ORG 000H
MOV R0,#30H
MOV R1,#40H
MOV R2,#08H
UP:MOVA,@R0
MOV@R1,A
INC R0
INC R1
DJNZ R2,UP
END
Program-4
4.Write an ALP to exchange N byte of data stored from
memory location X with N bytes of data stored from memory
location Y
ORG 000H
MOV R0,#30H
MOV R1,#40H
MOV R2,#06H
BACK:MOVA,@R0
XCH A,@R1
XCH A,@R0
INC R0
INC R1
DJNZ R2,BACK
END
Program-5
5.Write an ALP to move a block of data stored from memory
location X to memory location Y without overlap
ORG 000H
MOV R0,#30H
MOV R1,#40H
MOV R2,#60H
REP:MOVA,@R0
MOV @R1,A
INC R0
INC R1
DJNZ R2,REP
END
Program-7
7.Write an ALP to find the given byte of data is
PALINDROME or not. If palindrome display FF at port 2
otherwise display 00
1) ORG 000H
2) PALIN EQU 50H
3) MOV A,PALIN
4) MOV R0,#00H
5) MOV R1,#00H
6) MOV R2,#08H
7) CLR C
8) REP:RLC A
9) MOV R1,A
10) MOV A,R0
11) RCC A
12) MOV R0,A
13)MOV A,R1
14)DJNZ R2,REP
15) MOV A,R0
16) CJNE A,PALIN,NPAL
17) MOV P2,#0FFH
18) HERE:SJMP HERE
19) NPAL:MOV P2,#00H
20) END
Program-8
8.Write an ALP to arrange a block of data in ascending /
desending order
1) ORG 000H
2) MOV R1,#09H
3)) AGAIN:MOV R0,#30H
4) MOV R2,#09H
5) UP:MOV A,@R0
6) INC R0
7) MOV B,@R0
8)CLR C
9) SUBB A,B
10) JC SKIP
11) DEC R0
12) MOV A,@R0
13) MOV @R0,B
14) INC R0
15) MOV @R0,A
16) SKIP:DJNZ R2,UP
17) DJNZ R1,AGAIN
19) HERE:SJMP HERE
20) END
Program-9
9.Write an ALP to convert the given two digit BCD number
to binary and display the value at PORT0
ORG 000H
BCD EQU 50H
BIN EQU 51H
MOV A,BCD
MOV R0,A
ANL A,#0FH
MOV R1,A
MOV A,R0
ANL A,#0F0H
SWAP A
MOV B,#0AH
MUL AB
ADD A,R1
MOV P0,A
END
Program-10
10.Write an ALP to convert the given two digit BCD number
into ASCII number. Store the result in memory location
ASCI1 and ASCI2
ORG 000H
BCD EQU 50H
ASCI1 EQU 51H
ASCI2 EQU 52H
MOV A,BCD
ANL A,#0FH
ADD A,#30H
MOV ASCI1,A
MOV A,BCD
ANL A,#0F0H
SWAP A
ADD A,#30H
MOV ASCI2,A
END
Program-11
11.Write an ALP to find largest / smallest number in an array
of data available from memory location X and length of array
is available in memory location LENGTH. Display the result
in memory location LARGE/SMALL
ORG 000H
RESULT EQU 60H
MOV R0,#30H
4) MOV R2,#X
MOV A,@R0
REP:INC R0
MOV B,@R0
8) CLR C
SUBB A,B
JNC SKIP
MOV A,B
12) SJMP FRONT
SKIP:ADD A,B
FRONT:DJNZ R2,REP
MOV RESULT,A
16)END
Program-12
12.Write an ALP for multibyte addition the numbers are
stored from memory location X and Y. Display the result
from location Z
ORG 000H
MOV R0,#30H
MOV R1,#40H
MOV R2,#06H
SETB PSW.3
MOV R0,#50H
CLR PSW.3
CLR C
BACK:MOV A,@R0
ADDC A,@R1
SETB PSW.3
MOV@R0,A
INC R0
CLR PSW.3
INC R0
INC R1
DJNZ R2,BACK
CLR A
SETB PSW.3
END

You might also like