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

LAB REPORT Lab 7 Loops

The document discusses loops and lookup tables in assembly language. It introduces simple loop commands that allow for efficient and structured code. The objectives are to understand and implement loop commands like DJNZ to understand their working and significance. Examples show adding values in a loop and storing data from memory locations in a register over 5 iterations. Tasks involve using loops and creating lookup tables.

Uploaded by

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

LAB REPORT Lab 7 Loops

The document discusses loops and lookup tables in assembly language. It introduces simple loop commands that allow for efficient and structured code. The objectives are to understand and implement loop commands like DJNZ to understand their working and significance. Examples show adding values in a loop and storing data from memory locations in a register over 5 iterations. Tasks involve using loops and creating lookup tables.

Uploaded by

Talha Aftab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Microcontrollers and Embedded Systems ( MTS - 311 ) LAB REPORT

Microcontrollers and Embedded


Systems
(MTS-311)

DE-43 Mechatronics
Syndicate – B

LAB REPORT
Introduction to Loops and Lookup Tables in
Assembly language

Names of Group Members:


 PC Talha Aftab CMS ID #398492
 NS Rayyan Naveed CMS ID #365733

Submitted to: LD Qasim

Page PAGE 3 of NUMPAGES 3


Microcontrollers and Embedded Systems ( MTS - 311 ) LAB REPORT

Introduction:

the introduction of simple loop commands allows us to create efficient and structured code.
These loop commands, often implemented through instructions like "LOOP" or "JMP"
(Jump), enable the repetition of a specific set of instructions for a number of iterations that
we define or until a certain condition is met. Simple loops streamline the execution of
repetitive tasks, enhancing code readability and reduces the complexity of the code. As a
crucial component of control in assembly language, mastering these loop commands will
enable us to create more concise and organized code, optimizing the performance of low-
level operations.

Objective:
Our objectives with this lab are to understand and implement loop command such as
DJNZ in our code in order to understand its working and significance in our codes.

Lab Work:
We started off with an example in which we added 3 to the accumulator 10 times:

Example 1

Page PAGE 3 of NUMPAGES 3


Microcontrollers and Embedded Systems ( MTS - 311 ) LAB REPORT

Example Number 2:
We wrote a code which stores data in memory positions 40 to 44,
initializing the load pointer to the 40th position. It loads this value into a register, assigns 5 to
another register, and executes the 'again' loop. Data is iteratively stored in register A as long
as the carry flag remains zero. The loop precisely iterates five times, corresponding to the
value in register R2, ensuring efficient data handling and controlled repetition in the
program's execution.

Example 2

Lab Task 1:

Page PAGE 3 of NUMPAGES 3


Microcontrollers and Embedded Systems ( MTS - 311 ) LAB REPORT

Lab Example 3:

Lab Task 2:

Lookup table Lab Example:


Page PAGE 3 of NUMPAGES 3
Microcontrollers and Embedded Systems ( MTS - 311 ) LAB REPORT

Lab Task 3:

Page PAGE 3 of NUMPAGES 3


Microcontrollers and Embedded Systems ( MTS - 311 ) LAB REPORT

Page PAGE 3 of NUMPAGES 3

You might also like