You are on page 1of 2

LAB 7

AVR C PROGRAMMING

OBJECTIVE:

 To write C programs for AVR.

REFERENCE:

 Mazidi and Naimi, “The AVR Microcontroller and Embedded System,” Chapter 7

MATERIALS:

 Arduino Uno, Arduino Nano, or any other AVR Trainer


 Atmel Studio

ACTIVITY 1

Write a program that toggles PB5 every second.

ACTIVITY 2

Connect a key to PC0. Check the key state. If the key is pressed, toggle PB5 every second.
Otherwise, turn it off.

ACTIVITY 3

Connect a Switch to a pin on one of the PORTs and an LED to another pin. Write and test a
program with the following components:

AVR

330

a) The LED toggles when the switch is pressed.


b) Store the last state of the LED in the EEPROM so that, if the microcontroller powers off,
it restores its last state when it powers on, again.
WORKSHEET
Name: Class:
Last Name: Lab#:

You might also like