Professional Documents
Culture Documents
)
(SETH BALKRISHAN MEMORIAL)
Experiment No: 15
Date: 8th SEPT 2010
Aim: Write a microcontroller 8051 program to calculate square root of 8 bit number.
PROGRAM:
MOV A,30H
MOV B,#01H
MOV R3,A
BACK:MOV R2,B
DIV AB
MOV B,R2
CJNE A,B,L1
SJMP END
L1:MOV A,R3
INC B
CJNE R2,#10H,BACK
END:SJMP END
Opcode Operand
Result:
INPUT OUTPUT
MEMORY DATA LOCATION DATA
LOCATION ACCUMULATOR 0BH
30H 79H (A)
NOTE: Above assembly language coding is suitable for finding square roots of perfect
squares upto 255 i.e. FFH.