0% found this document useful (0 votes)
8 views8 pages

Example Programs

The document contains programming examples for the 8051 microcontroller, demonstrating the use of assembly language instructions. It includes code snippets for data manipulation in RAM, looping constructs, and conditional jumps. The examples illustrate basic operations such as moving data, incrementing values, and counting occurrences in memory.

Uploaded by

sethu101286
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views8 pages

Example Programs

The document contains programming examples for the 8051 microcontroller, demonstrating the use of assembly language instructions. It includes code snippets for data manipulation in RAM, looping constructs, and conditional jumps. The examples illustrate basic operations such as moving data, incrementing values, and counting occurrences in memory.

Uploaded by

sethu101286
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

8051 :

PROGRAMMING
EXAMPLES
*
Assume the starting memory location in RAM is 40H.
ORG 0
MOV R3,#10
MOV R1,#40H
MOV DPTR,#0500H
THERE:MOV A,#0
MOVC A, @ A+DPTR
MOV @R1,A
INC R1
INC DPTR
DJNZ R3,THERE
HERE : SJMP HERE

ORG 0500H
DB “ABCDEFGHIJ”
END
MOV R5,#20
CLR A
MOV R2,#1
LOOP: ADD A,R2
INC R2
DJNZ R5,LOOP
MOV 40H,A
ORG 0
MOV R3,#50
MOV R4,#0
MOV R0,#34H
ENTR : MOV A,@R0
JZ COUNT
BACK: INC R0
DJNZ R3,ENTR
SJMP HERE
COUNT: INC R4
SJMP BACK
HERE: SJMP HERE
END

You might also like