0% found this document useful (0 votes)
11 views3 pages

Mal Report

Uploaded by

Mohsin Abbasi
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)
11 views3 pages

Mal Report

Uploaded by

Mohsin Abbasi
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/ 3

Microprocessor And Assembly Language

(CSC321)
LAB REPORT-I

Submitted to:
SIR RAHEEL AHMED
Submitted by:
MOHSIN IDREES
SP21-BAI-014

BACHELOR OF ARTIFICIAL INTELLIGENCE

COMSATS UNIVERSITY ISLAMABAD


Introduction to Assembly Language Programming
1. Introduction
This report outlines the activities and learning outcomes of the first laboratory session
focused on assembly language programming, which took place on March 1, 2024. The
primary task was to write an assembly program to control an LED’s blinking behavior.

2. Objective
The lab’s objective was to introduce the basics of assembly language and to write a program
that could theoretically result in a blinking LED if implemented on a microcontroller.

3. Equipment and Software Used

 Computer with Microchip Studio installed

4. Assembly Code Explanation


The assembly code written for the lab is as follows:

; 1st Assembly program


; Blink PORT-B
ldi r16,0x01 ; load 0x01 into a register r16
out DDRB,r16 ; configure PB0 as output: DDRB=0x01
forever:
ldi r19,0xFF ; load 0x01 into a register
out PORTB,r19 ; PB6=1
call delay_ms; Call delay subroutine
ldi r19,0x00 ; load 0x00 into a register
out PORTB,r19 ; Make PortB=0
call delay_ms; Call delay subroutine
jmp forever
delay_ms: ; delay subroutine defined
Page 9
ldi r31, 5
l1:
dec r31
brne l1
ret ; return from subroutine

Each instruction’s purpose and its role in the LED blinking sequence is annotated alongside
the code.

5. Compilation Process
The code was compiled in Microchip Studio to generate a hex file. This process translates the
assembly instructions into machine code that a microcontroller can execute.

6. Hex File Overview


The hex file is the final output of the compilation process and contains the machine code in a
format that can be uploaded to a microcontroller.

7. Theoretical Concepts Discussed


During the lab, we were explained the fundamental concepts of assembly language, such as
registers, memory addressing, and instruction sets. The significance of the hex file and its
role in programming microcontrollers was also discussed.

You might also like