本帖最后由 hongdongyu 于 2014-4-17 13:12 编辑
int main(void)
{
DDRA |= (1<<0);
PORTA |= (1<<0); //开始拉高PA0
DDRA &= ~(1<<0);
DDRA |= (1<<7);
PORTA |= (1<<7); //LED on
GIMSK |= (1<<5); //PCIE1置位
GIFR |= (1<<5); //PCIF置位,清除中断标志
PCMSK0 |=(1<<0); //使能PCINT0
PCMSK1 = 0; //其余PCINT屏蔽
while(1)
{
}
}
ISR(PCINT_vect)
{
PORTA &= ~(1<<7); //led off
_delay_ms(1000);
}
PA0接一个button到地,一开始拉高,按下电平产生变化,产生引脚中断,PA7接的灯就灭掉。
仿真不成功,哪位帮忙看看
PS:用的是attiny861,规格书太大,传不上来 |