Tuesday, 27 October 2015

TIMER1 COMPARE INTERRUPT OF ATMEGA32

#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
ISR(TIMER1_COMPA_vect){
PORTA=0xff;
_delay_ms(500);
PORTA=0x00;
    //TIFR|=0X10;
}
ISR(TIMER1_COMPB_vect){
PORTB=0XFF;
_delay_ms(500);
PORTB=0X00;
TIFR|=0X08;
}
int main(void)
{
DDRA=0XFF;
DDRB=0XFF;
SREG=0X80;
TIMSK=0X18;
TCCR1A=0X00;
TCCR1B=0X05;
TCNT1H=0X00;
TCNT1L=0X00;
OCR1AH=0XB0;
OCR1AL=0X00;
OCR1BH=0XF0;
OCR1BL=0X00;
    while(1);
    }

No comments:

Post a Comment