Interrupt Exercise
Interrupt Exercise
Interrupt Exercise
* Gccmotor_control.c
*
* Created: 30/11/2020 3PM
* Include files are initially declared for the functions used in the
various modules in the program
* Use proteus simulation software to analyze the program and write your own
observations. Use your own actuations connected to PortC with pull up resistors
* Atmega32 microcontroller used in this exercise.
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
// calls, includes defined names for all of the SFRs on the Microcontroller
// contains two functions for causing the program to wait for certain periods of
time
// _delay_ms(xxx) (milliseconds). Note delay can also be in microseconds _delay_us
(yyy).
int i, temp;
ISR(INT0_vect)
{
_delay_ms(50); // Software debouncing
control
int main(void)
{
while(1)
{
if(PORTC>= 0x80)
PORTC= 1;
else
PORTC= PORTC << 1; // Shift to the left