Lab Report # 1: Sheikh Muhammad Ismail
Lab Report # 1: Sheikh Muhammad Ismail
Lab Report # 1: Sheikh Muhammad Ismail
*************
Lab # 01 Introduction to Development Tools and
Lab Softwares
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.
Softwares Used
● Arduino
● Atmel Studio (Version 7)
● AVR Studio (Version 4)
● Proteus ISIS
● WinAVR (Version 2010)
Pre Lab
Get the following software installers from MP/VLSI lab and install them in your laptops. The
same software will be available in the Lab PCs.
Arduino:
Arduino is an open-source platform used for building electronics projects. It consists of both a
physical programmable circuit board and an IDE (Integrated Development Environment) that
runs on your computer. Most Arduino boards consist of an Atmel 8-bit AVR microcontroller
with varying amounts of flash memory, pins and features. Arduino is programmed using
the Arduino Software (IDE) which is a cross-platform application for windows, macOS and
Linux. It is connected to a PC via USB cable to upload computer code to the physical board.
This also provides power to the board, as indicated by a LED.
AVR Studio:
AVR Studio is an Integrated Development Environment (IDE) used to develop projects
(software part) for AVR microcontrollers. This IDE consists of a project management tool,
source filer editor, assembler and front-end for C/C++ programming, a debugger and a
hardware (MCU registers) Simulator. With AVR Studio, you can develop code in C as well as
in Assembly Language. Both approaches are different from each other. Each has its own merits
as you will learn during the coursework.
Atmel Studio:
Atmel Studio 7 is the integrated development platform (IDP) for developing and debugging
Atmel Atmel AVR microcontroller (MCU) applications. Atmel Studio 7 supports all AVR
MCUs. It gives you a seamless and easy-to-use environment to write, build and debug your
applications written in C/C++ or assembly code. It also connects seamlessly to Atmel
debuggers and development kits.
WinAVR:
WinAVR is a suite of executable, open source software development tools for the Atmel AVR
series of microprocessors hosted on the Windows platform. It includes the GNU GCC compiler
for C and C++. You will install this software (release 2010) on your PC/Laptop and it will be
used to compile your C/C++ code for the AVR microcontroller. IDEs such as AVR Studio will
automatically detect and use WinAVR installation and you will not need to run this software
yourself.
Proteus:
The Proteus Design Suite is a complete software solution for circuit simulation and PCB
design.Proteus can simulate electric/electronic and microcontroller based circuits. It supports
number of microcontrollers available in the market.
ATmega 328p:
The Atmel AVR ATmega328P is a low-power 8-bit microcontroller architecture.It has 131
Powerful Instructions. Most of them require single clock cycle for execution. It has 32K bytes
of In-System Programmable Flash Program memory with Read-While-Write capabilities, 1K
bytes EEPROM, 2K bytes SRAM, 23 general purpose I/O pins and 32 general purpose
working registers.
● DDRx (Data Direction Register) - Sets the direction of each pin as input or output.
● PORTx - Used to output/write values on a Port.
● PINx - Used to input/ read values from a Port.
Where x is the port B, C or D. All of these registers are 8-bit registers. Figure 1.1 shows the
three registers associated with Port B.
In-Lab
.
Figure 1.3 Compiling a Sketch in Arduino
Figure 1.5: Compiler selection and Project name description with location
3. In the next menu, select AVR Simulator in debug platform and ATmega328P in device
menu. After selection click finish as shown in Figure 1.6.
Figure 1.6: AVR microcontroller Selection
4. Layout shown in Figure 1.7 will appear on the screen. Layout will consist of source
Window, I/O window, message window and I/O toolbar.
Figure 1.8: How to create new project using Atmel Studio installed in Lab
2. After selecting New Project, the project wizard will appear. AVR Assembler is selected
for the assembly code and C/C++ is selected to compile C-code. In this tutorial, we will
use C-code so select C/C++ and then select GCC C Executable Project. Write project
name, select the path directory path to save files for this new project and Click ok
(Figure 1.9).
Figure 1.9: Compiler selection and Project name description with location
3. In the Device Selection window, select ATmega328P. Click OK to create the project as
shown in Figure 1.10.
1. Launch Proteus from start menu or by desktop icon. Proteus layout shown below will
appear on the screen as shown in Figure 1.12. There is a root sheet to draw circuit. The
device window will initially be empty and you need to pick components from library.
Proteus component library is equipped with lots of components and ICs including
microcontrollers. To pick necessary components required for circuit, click on small P in
device window.
Figure 1.12: Proteus ISIS overview of window
2. After Clicking Pick devices menu as in figure 1.13 will appear on the screen. There is a
keyword prompt which can refine your search. Write ATmega328P in keyword prompt
and result window will display components having keyword of ATmega328P. Double
click ATmega328P component in result window to add it to device list.
Figure 1.13: Pick Devices for circuit diagram
In Lab Task 4:
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) .
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.
There is error in avrio.h
Corrected Code
Atmel Studio
Avr
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.
Code:
Lab Assessment
Pre Lab /1
In Lab /5
Data
Post Lab /4 /4
Presentation
Writing Style /4