Write a asm program to perform 8 bit division

Опубликовано: 31 Октябрь 2024
на канале: TechProgrammingIdeas
246
0

Subscribe My channel to get more Updated Videos - https://bit.ly/35R1t3J
Program for Division using ATMega32 microprocessor (8 bit division/ program for Division )

Program
.INCLUDE "M32DEF.INC"
.ORG 0X00
.EQU NUM1 = 0X58
.EQU NUM2 = 0X10
.EQU QUO = 0X300
.EQU REM = 0X301
LDI R16,NUM1
LDI R17,NUM2
CLR R20
AGAIN: SUB R16,R17
INC R20
BRCC AGAIN
DEC R20
ADD R16,R17
STS QUO , R20
STS REM,R16
STOP: RJMP STOP

Steps

58/10 = 5.8

58-10 = 48 (n=1)
48-10 = 38 (n=2)
38-10 = 28 (n=3)
28-10 = 18 (n=4)
18-10 = 8 (n=5)
8-10 = -2 (n=6)

Quotient
6-1 = 5 - (n-1)
Remainder
-2+10 = 8



#MicrocontrollerProgramming

https://techprogrammingideas.blogspot...
PSC Study Materials and Previous Question Papers
http://www.mission2win.in/
Any doubts and help to type comments below