Tuesday, 1 March 2016

Cycle:3 Microcontroller Programs

1.   Addition of 8 bit numbers using 8051
Program:
ORG 0X00
MOV A,#03H
MOV R0,#02H
ADD A,R0
END
                                       2.SUBTRACTION:
ORG 0X00
MOV A,#05H
MOV B,#03H
SUBB  A,R0
END
                                            3.MULTIPLICATION

ORG 0X00
MOV A,#04H
MOV B,#02H
MUL AB
END

                                            4.DIVISION:
org 0x00
mov A,#12
mov B,#03
div AB
end

                                       5.FACTORIAL
ORG 0X00
MOV A,#01H
MOV R1,#05H
L1:MOV B,R1
MUL AB
DJNZ R1,L1
END

                                 6.PACKED AND UNPACKED
ORG 0X00
MOV A, 50H
ANL A, #0FH
MOV 52H,A
MOV A, 50H
RL A
RL A
RL A
RL A
ANL A,#0FH
MOV 53H,A
END

                                       7.PERFORM RL/RR/RLC/RRC
i)RR:
ORG 0X00
MOV A,#02H
RR A
END
Input :
OUTPUT:

ii)RL:
ORG 0X00
MOV A,03H
RL A
END
Input :
OUTPUT:

iii)RLC:
ORG 0X00
MOV A,#04H
RLC  A
END
Input :
OUTPUT:

iv)RRC:
org 0x00
mov a,#04h
rrc a
end
Input :
OUTPUT:





No comments:

Post a Comment