8051 Assembly Program Code for Sorting in Descending Order - Keil - AT89C51


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

Program to sort numbers in descending order,

Flowchart:-


Program:-

ORG 0000
MOV R1,#40H
MOV R3,#04H
LOOP1 : MOV 02H,03H
MOV B,@R1
MOV 00H,01H
INC R0
LOOP2: MOV A,@R0
CJNE A,B,CHECK
MOV @R0,#00H
SJMP CONTINUE
CHECK :JC CONTINUE
MOV @R0,B
MOV @R1,A
MOV B,@R1
CONTINUE :INC R0
DJNZ R2,LOOP2
INC R1
DJNZ R3, LOOP1
SJMP $
END

Output:-



For more ASM programs - click here

Popular posts from this blog

Mini Militia Chat Codes - Shortforms

8051 Assembly Program Code for Sorting in Ascending Order - Keil -AT89C51