0% found this document useful (0 votes)
22 views

Lab Report # 07

The document discusses loops and lookup tables in assembly language. It provides code examples to demonstrate adding numbers using loops, storing and shifting data between memory locations with loops, and searching for a character in a string using a lookup table. Lab exercises are presented to practice these concepts.

Uploaded by

Talha Aftab
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Lab Report # 07

The document discusses loops and lookup tables in assembly language. It provides code examples to demonstrate adding numbers using loops, storing and shifting data between memory locations with loops, and searching for a character in a string using a lookup table. Lab exercises are presented to practice these concepts.

Uploaded by

Talha Aftab
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

MTS-311 MICROCONTROLLER & EMBEDDED SYSTEMS

DE-43 MECHATRONICS ENGINEERING

SYNDICATE B

LAB REPORT # 7
LAB TITLE : LOOPS & LOOKUP TABLES

SUBMITTED BY:
1. MUHAMMAD USMAN REG NO. 385015
2. SAAD RAFIQUE REG NO. 394584

SUBMITTED TO: LE MUHAMMAD QASIM

1|Page
INTRODUCTION TO LOOPS IN ASSEMBLY
OBJECTIVES
• Understanding of Assembly language.
• To understand the software Keil uVision.
• Implementation of simple Codes.

SOFTWARE USED
• Keil µVision

INTRODUCTION
Learn the basic concepts of Assembly language
 Loop

Repeating a sequence of instructions a certain number of times is called a loop DJNZ


direct, label

The DJNZ instruction decrements the byte indicated by the first operand and, if the resulting value is not
zero, branches to the address specified in the second operand

LAB DEMONSTRATION
The following program will add 3 to ACC ten times.

Figure 1

2|Page
LAB EXERCISE
The program saves the data at the memory position 40 – 44. It assigns the load pointer to the 40 th memory
position, stores it in a register and assigns a value 5 to the other register. The loop ‘again’ executes and the
data is stored in A as long as the carry flag remains zero. The loop execute 5 times that is the value stored in
register R2.

Figure 2

3|Page
Figure 3

LAB TASK
The program stores the data in the memory position 20 – 30 and then shifts the data to the memory location 40 – 50 with
the use of the loops in the assembly language.

Figure 4

4|Page
Figure 5

LAB DEMONSTRATION

Figure 6

5|Page
Figure 7

6|Page
Figure 8

LAB TASK

Figure 9

LOOK UP TABLES

7|Page
The program searches a letter ‘g’ in a string [“hello gee” , 0]. String is NULL terminated. If g is in the string,
program should exit with “g” in accumulator A otherwise zero in accumulator A. Then copy contents of A to
R1.

Figure 11

LAB EXERCISE
The program adds the numbers (53, 49, 94, 56, 92, 65, 43, 83) and send the result to P1 and P2. The data is
stored at ROM addresses starting from 250H.

Figure 12

8|Page

You might also like