You are on page 1of 1

Addis Ababa University

Addis Ababa Institute of Technology


School of Electrical & Computer Engineering

ECEG- 4501 Microcomputers & Interfacing

Lab2: ARM Based MCU Programming: GPIO Programming

1. LED Blink

The first program controls an LED connected to the general purpose I/O (GPIO) pin P0.8 of the
microcontroller. The program turns the LED ON and OFF continuously with a delay of 1 second.

 Run the LED blink simulation and try to figure out how everything works.

2. LED Chaser (GPIO Output)

 Modify the LED blink program in such a way that LEDs connected to pins P0.8 – P0.13 turn ON
one after the other with 1 second delay.

(P0.8 ON (others OFF) delay 1 sec P0.9 ON (others OFF) delay 1 sec  P0.10 ON
(others OFF)  delay 1 sec …P0.13 (others OFF) delay 1 sec)

3. Toggle an LED with a button (GPIO Input)

This exercise demonstrates how to read a digital GPIO pin on the microcontroller.

 Write a program that toggles the LED connected to pin P0.8 when the button connected to pin
P0.14 is pressed. Use IO0PIN register to read the value of a pin. Your program should go
something like this:

Configure
P0.14 as Input

Read Button
Pin (P0.14)

Button NO
Pressed?

YES

Toggle LED

Registers: IO0DIR, IO0SET, IO0CLR, IO0PIN 1|Page

You might also like