Calculator in 8051 - Assembly Program Code - AT89C51 - Keil
The program is compiled in Keil for 8051 - AT89C51 in assembly language.
Program to create simple calculator in 8051 by assembly language,
Flowchart:-
Program:-
ORG 0000H
MOV R0,#50H
MOV A,@R0
MOV R6,A
MOV R0,#51H
MOV R1,#52H
CINE A,#01H,SUB1
MOV A,@R0
ADD A,@R1
MOV 53H,A
SJMP HERE
SUBI: CJNE A,#02H,MULI
MOV A,@R0
SUBB A,@R1
MOV 53H,A
SJMP HERE
MULI: CJNE A,#03H,DIV1
MOV A,@R0
MOV B,A
MOV A,@R1
MUL AB
MOV 54H,A
MOV 6H,B
SJMP HERE
DIV1: CJNE A,#04H,ERROR
MOV A,@R1
MOV B,A
MOV A,@R0
DIV AB
MOV 53H,A
MOV 54H,B
SJMP HERE
ERROR: MOV A,#11H
MOV 60H,A
HERE: SJMP HERE.
END
Outp1ut:-
For more ASM programs - click here