×
单片机 > 单片机程序设计 > 详情

ATmega32外部中断嵌套

发布时间:2020-05-29 发布时间:
|
#include
#include
#pragma data:code
const table[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,
               0x80,0x90,0xff};
#pragma interrupt_handler int0:2
void int0()
{
   PORTC&=~BIT(0);
  PORTA=table[0];
  while(1);
}      
#pragma interrupt_handler int1:3
void int1()
{
   PORTC&=~BIT(0);
  PORTA=table[1];
  SEI();
  while(1);
}      
#pragma interrupt_handler int2:19
void int2()
{
  PORTC&=~BIT(0);
 PORTA=table[2];
 SEI();
 while(1); 
}
void main()
{
   DDRA=0xff;
  PORTA=0xff;
  DDRC|=BIT(0);
  DDRB&=~BIT(2);
  PORTB|=BIT(2);
  DDRD&=(~BIT(3))&(~BIT(2));
  PORTD|=BIT(3)|BIT(2);
  SEI();
  GICR|=BIT(7)|BIT(6)|BIT(5);
  MCUCR|=BIT(3)|BIT(1);
  MCUCR&=(~BIT(2))&(~BIT(0));
  while(1);
}     
关键字:ATmega32  外部中断嵌套 

『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
C51 特殊功能寄存器SFR的名称和地址