8051 Program To Addition Of 10 Data Bytes

To make the program of the addition of 10 data bytes, first, we need to store 10 values.

We take DB (define bit instruction) from 0030H it stores the data, and you can take any hexadecimal value.

We use R1, where we are going to get our results at the end.

R2 is used when the carry is generated during the addition.

R3 is used for counting. With the addition of each number R3 should be decremented by 1.

	ORG 0030H
	DB 01H,02H,03H,01H,02H,03H,01H,02H,03H,01H
	ORG 0000H
	MOV R1,#00H //ADDITION
	MOV R2,#00H //CARRY
	MOV R3,#09H //COUNTING
	MOV DPTR,#0030H
	CLR A
	MOVC A,@A+DPTR
	MOV R1,A
BACK:   CLR A
	INC DPTR
	MOVC A,@A+DPTR
	ADD A,R1
	MOV R1,A
	JNC NEXT
	INC R2
NEXT:   DJNZ R3,BACK
STOP:	SJMP STOP
	END
ASM
asm addition of 10 data bytes string

Leave a Comment