Jan 17, 2016

8051 Assembly Program Code to find Square Root - AT89C51 - Keil


The program is compiled in Keil for 8051 - AT89C51 in assembly language.

Program to find square root of a number,

Flowchart:-


Program:-

ORG 0000H
MOV R0,#40H
MOV R1,#01H
MOV R2,#00H
MOV A,@R0
LOOP: SUBB A,R1
INC R2
JZ ANSWER
JC FALSE
INC R1
INC R1
SJMP LOOP
FALSE: MOV 50H, #0FFH
SJMP $
ANSWER: MOV 50H,R2
SJMP $
END

Output:-



For more ASM programs - click here