AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH
Faculty of Engineering
Lab Report
Experiment # 04
Experiment Title: Familiarization of assembly language program and Interrupts
in a microcontroller
Date of Perform: 2 March 2026 Date of Submission: 06 April 2026
Course Title: Microprocessor and Embedded Systems Lab
Course Code: EEE4103 Section: D
Semester: Spring 2025-26 Degree Program: BSc in CSE
Course Teacher: Protik Parvez Sheikh
Declaration and Statement of Authorship:
1. I/we hold a copy of this Assignment/Case Study, which can be produced if the original is lost/damaged.
2. This Assignment/Case Study is my/our original work; no part has been copied from any other student’s work or any other source except where
due acknowledgment is made.
3. No part of this Assignment/Case Study has been written for me/us by any other person except where such collaboration has been authorized.
by the concerned teacher and is acknowledged in the assignment.
4. I/we have not previously submitted or am submitting this work for any other course/unit.
5. This work may be reproduced, communicated, compared, and archived to detect plagiarism.
6. I/we permit a copy of my/our marked work to be retained by the Faculty Member for review by any internal/external examiners.
7. I/we understand that Plagiarism is the presentation of the work, idea, or creation of another person as though it is your own. It is a form of cheating and is a
very serious academic offense that may lead to expulsion from the University. Plagiarized material can be drawn from, and presented in, written, graphic, and
visual forms, including electronic data, and oral presentations. Plagiarism occurs when the origin of the source is not appropriately cited.
8. I/we also understand that enabling plagiarism is the act of assisting or allowing another person to plagiarize or copy my/our work.
* Student(s) must complete all details except the faculty use part.
** Please submit all assignments to your course teacher or the office of the concerned teacher.
Group # 03
Sl No Name ID PROGRAM SIGNATURE
1 Israt Jahan Anamika 23-50840-1 BSc in CSE
2 Anika Hossain Raisa 23-54127-3 BSc in CSE
3 Shafeen Ahmed 23-53276-3 BSc in CSE
4 Mahi Muqtadir 23-53303-3 BSc in CSE
5 MD Tahsin Ur Rahman 23-54884-3 BSc in CSE
Faculty use only
FACULTY COMMENTS
Marks Obtained
Total Marks
Table of Contents
Objectives 3
Apparatus 3
Experimental Setup 3
Codes 4-5
Experimental Results 5-6
Simulation Setup & Results 7
Discussion & Conclusion 8
References 8
Marking Rubrics (to be filled by Faculty):
Level Excellent Proficient Good Acceptable Unacceptable No Response
Category [5] [4] [3] [2] [1] [0]
Able to clarify the Able to clarify the
Able to clarify the
Able to clarify the understanding of the understanding of the lab
understanding of the lab Unable to clarify the
Title and understanding of the lab, lab experiment, but a experiment, but it lacks a
experiment, no issues are understanding of the
Objectives no issues are missing and few issues are few important issues of
missing but its formatting is lab experiment.
formatting is good. wrong, and its the experiment without
not good. formatting is bad. maintaining the format.
Able to explain the
Able to explain the Presents the
Able to explain the experimental codes Presents the experimental
experimental codes and experimental codes
Codes and experimental codes and but simulation codes but didn’t explain
simulation methods using but didn’t explain
Methods simulation methods using method using simulation methods using
Proteus but is not formatted simulation methods
Proteus very well. Proteus is not Proteus clearly.
well. explained well. using Proteus.
Key results and Major results, such as No Response/
Key results and images are Misses several key copied from
images are there. experimental and
Key results and images there. Figures/Tables have results and images. others/
Figures/Tables lack a simulation results’
are there. Figures/Tables all identifications, such as Figures/Tables lack identical
few identifications, images are not
Results have all identifications the axis labels, numbers, identification, such as the submissions
such as the axis included. Figures
and refer to them properly and captions with a few axis labels, numbers, and with gross
labels, numbers, and and tables are poorly
in the texts. minor errors; the texts refer captions; the texts don’t errors/image
captions; the texts constructed or not
them. refer them. refer them. presented. file printed
Proper interpretation of Proper interpretation of
Interpretation of Very poor
results and summarizes results and summarizes the Misses the interpretation
results is presented. interpretation of
Discussion the results to draw a results to draw a conclusion of key results. There is
However, there is a the results. No
and conclusion, discusses its but didn’t discuss its little connection between
disconnect between connection
Conclusion applications in real-life applications in real-life the results and
the results and between results and
situations to connect with situations to connect with discussion.
the report’s conclusion. the conclusion of the report. discussion. discussions.
Able to produce all Able to produce all Able to produce all Able to produce all Unable to produce all
Question and questions’ answers questions’ answers but questions’ answers questions’ answers but questions’ answers
Answer correctly maintaining the didn’t maintain the lab but wrong answers to wrong/missing answers and completely
lab report format. report format. a few questions. to multiple questions. wrong answers.
Total Marks
Comments
(25)
Page 2 of 8
Objectives:
The objective of this experiment is to get familiarized with Microcontroller.
a) Studying and learning basic programming commands of the STM32 Microcontroller Board.
b) Implementation of a traffic control system using STM32 Microcontroller Board.
c) Implementation of a blinking light system using STM32 Microcontroller Board
Apparatus:
1) Arduino IDE (2.0.1 or any recent version)
2) Arduino Microcontroller board
3) PC having an Intel processor
4) LED lights (Red, Green, Yellow, 1 pc each)
5) One 100 resistor
6) Three push switches
7) Jumper wires
Experimental Setup:
(a) (b)
Fig. 9 Experimental setup of an LED control system using an Arduino Microcontroller Board.
Page 3 of 8
Codes:
Part 3:
const byte ledPin = 13; // PB5
const byte interruptPin = 1; // PD1 (from ID)
volatile byte state = LOW;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}
void loop() {
digitalWrite(ledPin, state);
}
void blink() {
state = !state;
}
Part 4:
volatile boolean Output_Signal = true;
void isr() {
Output_Signal = !Output_Signal;
digitalWrite(12, Output_Signal); // PB4 (D12)
}
void setup () {
pinMode(12, OUTPUT); // PB4
pinMode(1, INPUT_PULLUP); // PD1
attachInterrupt(digitalPinToInterrupt(1), isr, RISING);
EICRA = 0b00000011; // Rising edge trigger
sei(); // Enable global interrupt
EIMSK = 0b00000010; // Enable INT1 (PD1)
}
void loop () {
digitalWrite(12, Output_Signal);
}
Page 4 of 8
Part 5:
bool LED_State = true;
void setup() {
pinMode(8, OUTPUT); // PB0
cli();
TCCR1A = 0;
TCCR1B = 0;
TCCR1B = 0b00000100; // Prescaler 256
TIMSK1 = 0b00000010; // Enable compare match A
OCR1A = 31249; // 500 ms delay
sei();
}
void loop() {
}
ISR(TIMER1_COMPA_vect) {
TCNT1 = 0;
LED_State = !LED_State;
digitalWrite(8, LED_State); // PB0 (D8)
}
Experimental Results:
Fig 1-2: Part-3 Interrupts occurs and LED turns OFF till the button is pressed .
Page 5 of 8
Fig 3-4: Part-4 Interrupts occurs and LED turns OFF when the button is pressed.
Fig 5-6: Part-5 Blinking an LED using a Timer1 ISR.
Page 6 of 8
Simulation Setup & Results:
Part 3:
Fig 7-8: Part-3 Interrupts occurs and LED turns OFF till the button is pressed .
Part 4:
Fig 9-10: Part-4 Interrupts occurs and LED turns OFF when the button is pressed.
Part 5:
Fig 11-12: Part-5 Blinking an LED using a Timer1 ISR.
Page 7 of 8
Discussion & Conclusion:
Discussion
In this experiment, assembly language programming and interrupt handling were implemented using an Arduino
microcontroller board based on the ATmega328P. Initially, LED blinking and push-button LED control were performed
using assembly language, where hardware registers such as DDRB, PORTB, DDRD, and PIND were directly manipulated
using instructions like SBI, CBI, SBIS, and RJMP. This provided a clear understanding of low-level microcontroller
operations and register-level control. Software delay was generated using nested loops, showing how timing depends on
instruction cycles and clock frequency (16 MHz). In the interrupt section, both external and Timer1 interrupts were
configured using registers such as TCCR1A, TCCR1B, TIMSK1, EICRA, and SREG. For Timer1, a prescaler of 256
reduced the clock to 62.5 kHz, giving a timer period of 16 μs, and the calculated OCR1A value of 31249 produced a
precise 500 ms delay. The Interrupt Service Routine (ISR) successfully toggled the LED state without blocking the main
loop, demonstrating the efficiency and responsiveness of hardware interrupts compared to polling. The experiment
therefore enhanced understanding of assembly programming structure, interrupt vectors, ISR execution, and timer-based
delay calculation.
Conclusion
The experiment successfully demonstrated assembly language programming and interrupt-based control in the
ATmega328P microcontroller system. Direct manipulation of I/O registers allowed precise control of LEDs and switches,
improving understanding of microcontroller architecture and instruction-level execution. The implementation of external
and Timer1 interrupts confirmed that interrupts provide faster response and more accurate timing compared to software
delay loops. Proper configuration of prescalers, compare registers, and interrupt vectors enabled reliable LED blinking
and push-button control. Overall, the objectives of studying assembly language programming, I/O port configuration,
interrupt handling, and timer-based delay generation were achieved successfully.
References:
1. Arxterra. “ATmega328P External Interrupts.” Available at: [Link]
2. Gammon, N. “Interrupts and Timers.” Available at: [Link]
3. AVR Freaks. “Newbie’s Guide to AVR Timers.” Available at: [Link]
4. MaxEmbedded. “AVR Timers – Timer0.” Available at: [Link]
Page 8 of 8