0% found this document useful (0 votes)
25 views3 pages

Interrupt Handling with Atmega 32

This document summarizes a lab assignment on handling interrupts using the Atmega 32 processor. It includes the student's name, class, objectives of learning basics of Proteus, Atmega 32, Atmel Studio and interrupts. It also lists the tools used, Proteus 8.0 and Atmel Studio 7.0. The task is to toggle an LED using the external interrupt INT0. The solution code configures INT0 to trigger an interrupt that toggles the LED port when called. Upon interrupt, the LED port is XOR'd to change its state. The conclusion confirms the interrupt toggles the LED.

Uploaded by

Burhan Ahmed
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)
25 views3 pages

Interrupt Handling with Atmega 32

This document summarizes a lab assignment on handling interrupts using the Atmega 32 processor. It includes the student's name, class, objectives of learning basics of Proteus, Atmega 32, Atmel Studio and interrupts. It also lists the tools used, Proteus 8.0 and Atmel Studio 7.0. The task is to toggle an LED using the external interrupt INT0. The solution code configures INT0 to trigger an interrupt that toggles the LED port when called. Upon interrupt, the LED port is XOR'd to change its state. The conclusion confirms the interrupt toggles the LED.

Uploaded by

Burhan Ahmed
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

MPI LAB

LAB 3
Handling interrupts on Atmega 32

Name : Burhan Ahmed Satti


Enrollment No. : 01-134172-065
Class : BSCS 4-A
Subject : MPI Lab
Lab Assistant : Muhammad Atif

Objectives
•Learning basics of Proteus
•Introduction to Atmega 32 processor
•Learning basics of Atmel studio
•Learning interrupts of atmega 32 processor

Tools Used
•Proteus 8.0
•Atmel Studio 7.0
BSCS 4-A Burhan Ahmed Satti 01-134172-065

Task No. 3.1


Using External interrupts INT0 to toggle led.
Solution
/**
* \file
*
* \brief Empty user application template
*
*/

/**
* \mainpage User Application template doxygen documentation
*
* \par Empty user application template
*
* Bare minimum empty user application template
*
* \par Content
*
* -# Include the ASF header files (through asf.h)
* -# "Insert system clock initialization code here" comment
* -# Minimal main function that starts with a call to board_init()
* -# "Insert application code here" comment
*
*/

/*
* Include header files for all drivers that have been imported from
* Atmel Software Framework (ASF).
*/
/*
* Support and FAQ: visit <a href="[Link] Support</a>
*/
#include <asf.h>
#include <avr/interrupt.h>

int main (void)


{
/* Insert system clock initialization code here (sysclk_init()). */

board_init();

DDRD = 0x00;
PIND = 0x00;

DDRA = 0xff;
PORTA = 0x00;
sei();
GICR=(1<<INT0);
/* Insert application code here, after the board has been initialized. */
while (1)
{

}
}
ISR(INT0_vect)
{
PORTA ^= 0xff;
}

HCI Lab Page 2 of 3


BSCS 4-A Burhan Ahmed Satti 01-134172-065

Result

Conclusion
The Interrupts toggles the LED whenever interrupt is triggered.

HCI Lab Page 3 of 3

You might also like