请各位兄弟姐妹帮忙看一下,我的程序是想通过中断INT0点8个LED,编译没有错误。但是中断INT0一拉低,8个灯闪一下就灭了,为什么没有保持亮的状态呢? 俺们是新手,请大家指点一下,看看哪处出了问题?不胜感激!!!
程序如下:
#define uchar unsigned char #define uint unsigned int #define ulong unsigned long #include <reg52.h>
sbit P00 = P0^0; sbit P01 = P0^1; sbit P02 = P0^2; sbit P03 = P0^3; sbit P04 = P0^4; sbit P05 = P0^5; sbit P06 = P0^6; sbit P07 = P0^7;
bit ldelay=0;
void main(void) // 主程序 { uchar code LEDp[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; uchar LEDi; IT0=1; EX0=1; EA=1; if(ldelay==1) { ldelay=0; P0=LEDp[LEDi]; LEDi++; if(LEDi==8) { LEDi=0; } } }
//外中断0 int0() interrupt 0 { ldelay=1; } |