您现在的位置: 主页 > MCU > 单片机技术应用 > 外中断C51程序 -
本文所属标签:
#keil#   #Keil C51代码#   #c51中断程序代码#   
为本文创立个标签吧:

外中断C51程序 -

来源: 网络用户发布,如有版权联系网管删除 2018-09-07 

[导读]没有中断时以流水灯显示,外中断0使左右4个LED交替闪烁,外中断1使LED闪亮,#includeunsigned char code design[]={0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x00};void Delay(unsigned int i){ unsigned int j;

没有中断时以流水灯显示,外中断0使左右4个LED交替闪烁,外中断1使LED闪亮,

本文引用地址: http://www.21ic.com/app/mcu/201808/784894.htm

#include

unsigned char code design[]={0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x00};

void Delay(unsigned int i){

unsigned int j;

for(;i>0;i--)

for(j=0;j<125;j++);

}

void main(){

unsigned char i;

EA=1;

EX0=1;

EX1=1;

IT0=1; //脉冲触发方式

IT1=0; //使用电平触发

PX0=0;

PX1=0;

while(1){

for(i=0;i<=9;i++){

P1=design[i];

Delay(500);

}

}

while(1);

}

void int0_int(void) interrupt 0{

EX0=0;

P1=0xf0;

Delay(5000);

P1=0x0f;

Delay(5000);

EX0=1;

}

void int1_int(void) interrupt 2{

EX1=0;

P1=0x00;

Delay(5000);

P1=0xff;

Delay(5000);

EX1=1;

}




              查看评论 回复



 

"外中断C51程序 -"的相关文章

网站地图

围观()