0% found this document useful (0 votes)
13 views2 pages

Lab 2 Led Button

The lab focuses on implementing an ARM assembly program to control LED blinking based on button presses. Students will learn about GPIO configuration, debouncing, and memory-mapped I/O while writing code to monitor button states and control LED behavior. The assignment includes creating an assembly file, implementing a delay function, and documenting the code and observations in a lab report.

Uploaded by

furkansenool
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)
13 views2 pages

Lab 2 Led Button

The lab focuses on implementing an ARM assembly program to control LED blinking based on button presses. Students will learn about GPIO configuration, debouncing, and memory-mapped I/O while writing code to monitor button states and control LED behavior. The assignment includes creating an assembly file, implementing a delay function, and documenting the code and observations in a lab report.

Uploaded by

furkansenool
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
You are on page 1/ 2

EE 304 – Embedded Systems Lab (Rev 1.

1 - 2023) MB

Button-Controlled LED Blinking


Objective
The objective of this lab is to implement a program in Arm assembly that
controls the blinking of an LED based on the state of a button press.

Prerequisites
 Understanding of branching instruction, memory read-write, and
subroutines in assembly.
 Understanding of button and LED interfaces, including
configuration.

Pre-Lab Questions
 How can a microcontroller's GPIO pins be configured to interface
with external devices such as buttons and LEDs?
 Explain the concept of debouncing when dealing with button input
in microcontroller applications.
 Explain the concept of memory-mapped I/O and how it is different
from port-mapped I/O. Provide an example of a situation where
you would prefer to use memory-mapped I/O over port-mapped
I/O, and vice versa.

Lab Assignment
In this lab, you will write an ARM assembly program to achieve the
following tasks:
1. Continuously monitor the state of the pushbuttons connected to
Port D Pin4 and Pin5 using the GPIO input register.
2. Implement a delay function to control the blink rate of the LEDs.
3. When Pin4 is pressed, toggle the states of the LEDs connected to
Pin0 and Pin1 by writing to the GPIO output register.
4. When Pin5 is pressed, make the LEDs connected to Pin0 and Pin1
blink once.

Instructions
1. Create a new assembly file named "ButtonLEDControl.s" within
your Keil uVision project.
EE 304 – Embedded Systems Lab (Rev 1.1 - 2023) MB

2. Write the ARM assembly code to implement the above tasks. You
can use the provided code as a reference.
3. Include startup_stm32f10x_cl.s file (you can download it from
github).

1. EXPORT __main
2. EXPORT SystemInit
3.
4. AREA led_button, CODE, READONLY
5.
6. SystemInit PROC ; Code for clock setting and GPIO configuration
7. ; Configure GPIO pins and clocks here
8. ; ...
9.
10.
11. BX LR
12. ENDP
13.
14. delay PROC ; Delay subroutine
15. ; Implement the delay function here
16. ; ...
17.

18. BX LR
19. ENDP
20.
21. ; Start of the main program
22. __main PROC
23. ; Main program logic here
24. ; ...
25.
26.
27. BX LR
28. ENDP

Submission
1. Include the assembly code (ButtonLEDControl.s) as part of your
lab report. Ensure that your code is well-documented with
comments explaining each section.
2. Explain how you implemented the delay function and its effect on
LED blinking.
3. Include any observations or challenges encountered during the
lab.

You might also like