0% found this document useful (0 votes)
6 views4 pages

Experiment No 2

This document details an experiment on I/O port programming for the Atmega32 microcontroller using Proteus simulation, focusing on the methodology, results, and practical applications. It explains the role of AVR studio in developing embedded applications and demonstrates LED blinking as a basic project. The experiment emphasizes hands-on learning and the significance of I/O port programming in interfacing with sensors, control systems, and embedded networking.

Uploaded by

ShivOmRu Oberoi
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)
6 views4 pages

Experiment No 2

This document details an experiment on I/O port programming for the Atmega32 microcontroller using Proteus simulation, focusing on the methodology, results, and practical applications. It explains the role of AVR studio in developing embedded applications and demonstrates LED blinking as a basic project. The experiment emphasizes hands-on learning and the significance of I/O port programming in interfacing with sensors, control systems, and embedded networking.

Uploaded by

ShivOmRu Oberoi
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/ 4

Experiment No.

02

Experiment Name: I/O Port programming for Atmega32 with Proteus Simulation.

Objectives:
1. To introduce Atmega32 microcontroller's role in embedded systems.
2. To detail methodology for programming Atmega32's I/O ports in Proteus.
3. To present and analyze experimental results from Proteus simulation.

Theory: AVR studio is an Integrated Development Environment (IDE) developed by ATMEL


for developing different embedded applications based on 8-bit AVR microcontroller. It merges
all of the great features and functionality of Atmel Studio into Microchip’s well-supported
portfolio of development tools to give a seamless and easy-to-use environment for writing,
building and debugging applications written in C/C++ or assembly code. Microchip Studio can
also import Arduino® sketches as C++ projects to provide with a simple transition path from
makerspace to marketplace [1], [2].

LED blinking refers to the process of continuously turning an LED (Light Emitting Diode) and
off in a repetitive pattern. It is a simple and common demonstration in electronics and
microcontroller-based projects. Blinking an LED is an introductory Atmega32 project in which
we control an LED using Atmel studio.

Pull-down resistors work in the same manner as pull-up resistors, except that they pull the pin
to a logical low value. They are connected between ground and the appropriate pin on a device.
An example of a pull-down resistor in a digital circuit can be seen in the following figure.

Figure 2.1: Pull Down Resistor


In this figure, a pushbutton switch is connected between the supply voltage and a
microcontroller pin. In such a circuit, when the switch is closed, the microcontroller input is at
a logical high value, but when the switch is open, the pull-down resistor pulls the input voltage
down to ground (logical zero value), preventing an undefined state at the input. The pull-down
resistor must have a larger resistance than the impedance of the logic circuit, or else it might
be able to pull the voltage down by too much and the input voltage at the pin would remain at
a constant logical low value – regardless of the switch position [3].

1
Working Principle: Atmega32 is a very popular high performance 8-bit AVR
Microcontroller. For the I/O Port programming, two registers DDR and PORT are needed to
be used. DDR stands for Data Direction Register; it determines the direction (Input/Output) of
each pin on the microcontroller. HIGH at DDR register makes corresponding pin Output while
LOW at DDR register makes corresponding pin Input. PORT register is the output register
which determines the status of each pin of a particular port. HIGH at PORT register makes
corresponding pin Logic HIGH (5V) while LOW at PORT register makes corresponding pin
Logic LOW (0V) [3].

For I/O Port programming, the steps below were followed:

1. At first, Atmel studio was opened and Atmega32 microcontroller was selected.
2. The following code was written on the workspace-

#include <avr/io.h>
#define F_CPU 8000000UL
#include<util/delay.h>

int main(void)
{

DDRC &= ~(1<<PC0);


DDRC &= ~(1<<PC1);
DDRD |= (1<<PD0);
while (1)
{
if ((PINC & (1<<PC0)) && (PINC &(1<<PC1)))
{
PORTD |=(1<<PD0);
}
else
{
PORTD &= ~(1<<PD0);
}
_delay_ms(1000);
}
return 0;
}

3. After that ‘Build’ was clicked to generate the hex file.

2
4. Then the below circuit was designed in Proteus Simulation software.

Figure 2.2: Circuit Diagram for I/O Port programming for Atmega32 with
Proteus Simulation
5. At the very last, the code was simulated to the microcontroller.

Required Components:
(i) Atmega32 Microcontroller
(ii) LED-Yellow
(iii) Power
(iv) Ground
(v) Pull Down Resistor
(vi) Switches
(vii) Wire

Figure:

Figure 2.3: On State of LED to Demonstrate for I/O Port programming for
Atmega32 with Proteus Simulation

3
Discussion: The successful completion of this lab demonstrates a comprehensive
understanding of I/O port programming for the Atmega32 microcontroller using Proteus
simulation. Through meticulous methodology, the process of configuring and manipulating I/O
ports have been illustrated to interact with external devices. The presented experimental results
validate the effectiveness and functionality of the programmed I/O ports in various input/output
configurations.

Practical Uses:
1. Interface with Sensors and Actuators: I/O port programming enables
microcontrollers to interface with various sensors and actuators to gather data from the
environment and control physical devices.
2. Control Systems: I/O ports are employed in the implementation of control systems for
tasks such as temperature regulation, motor speed control, or robotic control, where
precise input/output signals are required to achieve desired system behavior.
3. Embedded Networking: I/O port programming allows microcontrollers to connect to
networks, enabling tasks such as data exchange, remote monitoring, or Internet of
Things (IoT) applications.

Conclusion: The knowledge gained from this experiment lays a solid foundation for further
exploration and application in embedded systems design and development. Overall, this
experiment underscores the importance of practical experimentation and simulation-based
learning in mastering microcontroller programming techniques. Furthermore, this experiment
highlights the importance of hands-on experimentation and simulation-based learning in
mastering microcontroller programming techniques.

References:

[1] Programming using AVR Studio [Online]. Available:


https://www.javatpoint.com/programming-avr-studio (2011-2021)

[2] Microchip Studio for AVR® and SAM Devices [Online]. Available:
https://www.microchip.com/en-us/tools-resources/develop/microchip-studio (1998-2024)

[3] Pull-up and Pull-down Resistors | Resistor Applications [Online]. Available:


https://eepower.com/resistor-guide/resistor-applications/pull-up-resistor-pull-down-
resistor/(2024)

You might also like