MANUAL 21EC46X Microcontroller
MANUAL 21EC46X Microcontroller
Write an ALP to move a block of n bytes of data from source (20h) to destination (40h) using
Internal RAM.
ORG 000H
MOV R0, #20H
MOV R1, #40H
MOV R3, #0AH
BACK: MOV A,@R0
MOV @R1, A
INC R0
INC R1
DJNZ R3, BACK
END
EXPT: 2
WRITE AN ALP TO MOVE A BLOCK OF N BYTES OF DATA FROM SOURCE 2000H TO
DESTINATION 2050H USING EXTERNAL RAM
ORG 0000H
MOV DPTR,#2000H
MOV R0,#50H
MOV R1,#20H
MOV R2,#05H
BACK:MOVX A,@DPTR
PUSH DPH
PUSH DPL
MOV DPH,R1
MOV DPL,R0
MOVX @DPTR,A
INC DPTR
MOV R1,DPH
MOV R0,DPL
POP DPL
POP DPH
INC DPTR
DJNZ R2,BACK
END
EXPT:3
Write an ALP To exchange the source block starting with address 20h, (Internal
RAM) containing N(05) bytes of data with destination block starting with address
40h (Internal RAM).
ORG 000H
MOV R0, #20H
MOV R1, #40H
MOV R3, #05H
BACK: MOV A,@R0
MOV @R1, A
INC R0
INC R1
DJNZ R3, BACK
END
EXPT: 4
Write an ALP to exchange the source block starting with address 10h (Internal
memory), containing n (06) bytes of data with destination block starting at location
00h (External memory).
ORG 0000H
MOV R0,#10H
MOV DPTR,#2000H
MOV R2,#06H
BACK:MOVX A,@DPTR
MOV B,@R0
XCH A,B
MOVX @DPTR,A
MOV @R0,B
INC R0
INC DPTR
DJNZ R2,BACK
END
EXPT 5
Write an ALP to add the byte in the RAM at 34h and 35h, store the result in the
register R5 (LSB) and R6 (MSB), using Indirect Addressing Mode.
ORG 0000H
MOV R0,#34H
MOV R6,#00H
BACK:MOV A,@ R0
INC R0
MOV B,@ R0
ADD A,B
JNC SKIP
INC R6
SKIP:MOV R5,A
EXIT:SJMP EXIT
END
EXPT NO 6:
Write an ALP to subtract the bytes in Internal RAM 34h & 35h store the result in
register R5 (LSB)& R6 (MSB).
ORG 0000H
MOV R0,#34H
MOV A,@ R0
INC R0
MOV B,@ R0
subb A,B
MOV R5,A
JNC EXIT
DEC R6
EXIT:SJMP EXIT
END
.
EXPT:7
Write an ALP to multiply two 8-bit numbers stored at 30h and 31h and store16-
bit result in 32h and 33h of Internal RAM.
ORG 0000H
MOV A,30H
MOV B,31H
MUL AB
MOV 32H,A
MOV 33H,B
END
EXPT 8
Write an ALP to perform division operation on 8-bit number by 8-bit number.
ORG 0000H
MOV R0,#30H
MOV A,@R0
INC R0
MOV B,@R0
DIV AB
INC R0
MOV @R0,A
INC R0
MOV @R0,B
END
EXPT:11 https://www.youtube.com/watch?v=ANSJKWb7h9k
Expt:12
Write an ALP to find Largest & Smallest number from a given array starting
from 20h & store it inInternal Memory location 40h.
ORG 0000H
MOV R0,#20H
MOV R1,#40H
MOV B,#00H
REPEAT:MOV A,@ R0
CJNE A,B,TEST
TEST:JC SKIP1
MOV B,A
SKIP1:INC R0
DJNZ R1,REPEAT
STOP:SJMP STOP
END
EXPT:13 DECIMAL Up COUNTER
ORG 0000H
MOV A,#00H
BACK:ACALL DELAY
ADD A,#01H
DA A
JNZ BACK
HERE:SJMP HERE
DELAY:MOV R1,#0FFH
DECR1:MOV R2,#0FFH
DECR2:MOV R3,#50H
DJNZ R3,$
DJNZ R2,DECR2
DJNZ R1,DECR1
RET
END
https://www.youtube.com/watch?v=pw0P0cjKVXg
EXPT:14 DECIMAL DOWN COUNTER
ORG 0000H
MOV A,#00H
BACK: ACALL DELAY
ADD A,#99H
DA A
JNZ BACK
HERE:SJMP HERE
DELAY:MOV R1,#0FFH
DECR1:MOV R2,#0FFH
DECR2:MOV R3,#50H
DJNZ R3,$
DJNZ R2,DECR2
DJNZ R1,DECR1
RET
END
https://www.youtube.com/watch?v=x9YWslEuRk4
Experiment no 15 Hexadecimal up counter
MOV A,#00H
BACK:ACALL DELAY
INC A
JNZ BACK
HERE :SJMP HERE
DELAY:MOV R1,#0FFH
DECR1: MOV R2,#0FFH
DECR: MOV R3,#0FFH
DJNZ R3,$
DJNZ R2,DECR
DJNZ R1,DECR1
RET
END
Experiment no 16 Hexadecimal Down counter
MOV A,#00H
BACK:ACALL DELAY
DEC A
JNZ BACK
HERE :SJMP HERE
DELAY:MOV R1,#0FFH
DECR1: MOV R2,#0FFH
DECR: MOV R3,#0FFH
DJNZ R3,$
DJNZ R2,DECR
DJNZ R1,DECR1
RET
END
https://www.youtube.com/watch?v=lOtl2wPOfQo