LAB 1 MP-146
LAB 1 MP-146
EEE-342
Class 5B
Objectives
• Learn to use software development tools such as Arduino, Integrated Development Environment (IDE) (Atmel
Studio, AVR Studio), Compiler (WinAVR), and Simulator (Proteus) for the AVR ATmega 328P
microcontroller.
Learn to program Arduino and ATmega328P
In-Lab
In-Lab Task 1: Arduino Learning Tutorial
1. Launch Arduino IDE.
2. Some built-in examples are included in Arduino software. Click on the toolbar menu: File > Examples >
Basics > Blink. This will turn an LED on Arduino board on and off with some delay.
3. Compile the sketch. After successful compilation, the code can be uploaded to the Arduino board.
Task 2: AVR Studio Learning Tutorial & Task 3: Atmel Studio Learning Tutorial
Code:
/*This code will configure Port B for output and then toggle Port B pin 3 with a delay of 1000ms*/
#include <avr/io.h> /*This header file includes the appropriate I/O definitions for the device */
Output:
a. The following code is written to generate fibonacci series output at PortB which is
given as (0, 1, 2, 3, 5, 8, 13, 21, 34, 55).
Code:
b. Build the following code in AVR Studio or Atmel Studio. Read the error messages,
identify and correct any syntax errors and rebuild the solution.
c. Use Debugging mode of AVR Studio or Atmel Studio to debug and correct the code
to get the desired output. In debug mode, open watch window to check the value of the
variables.
Conclusion: In this introductory lab, I got an overview about Arduino IDE, AVR studio (Microchip
Studio) and Proteus. This lab showed me how to create a project, run the program and upload it on Proteus
to simulate the circuit and make the hardware using the hex file. I learned how to program Arduino and
ATmega328p.