Sunday, April 24, 2011

MICROCONTROLLER LAB PROGRAMS

MICROCONTROLLER

Half subtractor:


mov r0,#45h
mov r1,#5ah
mov r6,#50h
mov r5,#70h
mov r7,#00h
loop:
inc r0
inc r1
inc r6
inc r7
inc r5
mov a,@r0
cpl a
mov 60h,a
cpl a
xrl a,@r1
mov b,r0
mov 65h,r6
mov r0,65h
mov @r0,a
mov r0,b
anl a,@r1
mov b,r0
mov 66h,r5
mov r0,66h
mov @r0,a
mov r0,b
cjne r7,#04,loop
end

16 BIT ADDITTION:


MOV 50H,#00H
MOV R0,#40H
MOV B, @R0
INC R0
MOV A,@R0
INC R0
MOV 55H,@R0
MOV R1,55H
INC R0
MOV 56H,@R0
MOV R2,56H
ADDA,R2
MOV 46H,A
MOV A,R1
ADDC A,B
JNC L
INC 50H
MOV 44H
L: MOV 44H,A
END

32 BIT ADDITION:


org 00h
clr c
mov r2,#04h
mov r0,#40h
mov r1,#50h
setb psw.3
mov r0,#60h
clr psw.3
back:mov a,@r0
addc a,@r1
inc r0
inc r1
setb psw.3
mov @r0,a
inc r0
clr psw.3
djnz r2,back
end

RS FLIP FLOP:


org 0000h
mov r1,#00001111b 
mov r2,#00110011b
mov r3,#01010101b
mov a,r3
cpl a
anl a,r1
mov r4,a
mov a,r2
cpl a
anl a,r3
orl a,r4
mov p1,a
end

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...