ATMEGA8的外部中断INT1初始化

ATMEGA8的外部中断INT1初始化C程序怎么写? ICC平台

//ICC-AVR application builder : 2008-10-20 23:12:35
// Target : M8
// Crystal: 8.0000Mhz

#include <iom8v.h>
#include <macros.h>

void port_init(void)
{
PORTB = 0x00;
DDRB = 0x00;
PORTC = 0x00; //m103 output only
DDRC = 0x00;
PORTD = 0x00;
DDRD = 0x00;
}

#pragma interrupt_handler int1_isr:3
void int1_isr(void)
{
//external interupt on INT1
}

//call this routine to initialize all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();

MCUCR = 0x00;
GICR = 0x80;
TIMSK = 0x00; //timer interrupt sources
SEI(); //re-enable interrupts
//all peripherals are now initialized
}

//
void main(void)
{
init_devices();
//insert your functional code here...
}
温馨提示:答案为网友推荐,仅供参考
相似回答