我想在中断0 工作5秒后led灯熄灭。如何加入代码?
//-----(没有按键按下灯处于熄灭状态)-----
while(1)
{
P1 =0xff;
}
}
//中断0(低)左右4只LED交替闪烁
void int0(void) interrupt 0 using 0
{
while(1)
{
P1 = 0x0f;
Delay_ms(500);
P1 = 0xf0;
Delay_ms(500);
}
}
//中断1(高)LED闪烁3次
void int1(void) interrupt 2 using 1
{
uint m;
for(m=0;m<3;m++)
{
P1 = 0xff;
Delay_ms(500);
P1 = 0;
Delay_ms(500);
}
}
```
是这个意思吗
//中断0(低)左右4只LED交替闪烁
void int0(void) interrupt 0 using 0
{
int i;
// 交替闪烁5秒
for(i = 0; i < 5; i++)
{
P1 = 0x0f;
Delay_ms(500);
P1 = 0xf0;
Delay_ms(500);
}
// 全部熄灭
P1 =0xff;
}
我记得有个人也发出了同样的悬赏,我写了段程序提交了。第二天,这个悬赏消失了。
那个问题是有两个按键S14,S10
S14按下启动流水灯,按下5秒关闭流水灯
S10按下灯闪三次
按键以中断形式工作