8051 Assembly Program Code for Sorting Odd and Even Numbers - AT89C51 - Keil
The program is compiled in Keil for 8051 - AT89C51 in assembly language.
Program to sort odd and even numbers,
Flowchart:-
Program:-
ORG 0000H
CLR A
MOV R4,30H
MOV R0,#31H
MOV R5,#50H
MOV R6,#70H
LOOP: MOV A,@R0
CLR C
RRC A
JNC EVEN
RLC A
ODD: MOV R1,R5
MOV @R1,A
INC R5
INC R0
DJNZ R4,LOOP
SUMP FINISH
EVEN: RLC A
MOV R1,R6
MOV @R1,A
INC R0
INC R6
DJNZ R4,LOOP
SJMP FINISH
FINISH : SJMP FINISH
END
Output:-
For more ASM programs - click here