单片机实验 利用外中断接口p3.3接一个外部中断输入,p1口连接8个发光二极管显示中断次数

如题所述

#include<reg52.h>
typedef unsigned char uchar;
typedef unsigned int uint;
void delay(uint t)
{while(--t);
}
void cycle(uchar s);
void main(void)
{
EA = 1;
EX0 = 1;
IT0 = 1;
P1= 0x00;
cycle(0);
while(1);
}
void cycle(uchar s)
{

while(1)
{
//P1=~(1<<s++);
P0=~(1<<s++); // P0 是流水灯
delay(15000);
if(s==8)
s=0;
delay(15000);
}
}
void int0() interrupt 0
{
P1++; // P1 是计数
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-10-16
那是多少时间显示中断次数
相似回答