代码如下: /******** 2009-1-23 采用中断方式 Chow ********/ #include<reg52.h> #define uchar unsigned char;
uchar code tab_lcd[]={ 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82, 0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1, 0x86,0x8e,0x89,0xc1,0xf1,0xc8,0x7f, };//共阳LCD 数字表:0--f
uchar code tab_dx[8]={ 0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe };//LCD段选开关 unsigned int i,j; sbit d1 = P1^1;
void delay(unsigned int z) { for(i=0; i<z; i++); }
void exter0() interrupt 0//中断0 { d1 = 0; }
int main() { EA = 1; EX0 = 1; while(1){ for(j=0; j<16; j++){ P2 = tab_dx[j%8]; P0 = tab_lcd[j]; delay(50000); d1 = 1; } } return 0; } 程序启动后, 我将P3.2口即int0 于 Gnd 用杜邦线连接,lcd并没有中断停止,而是比原来显示速度慢了许多,拔去后恢复正常。
请问lcd为何没有停止,而是变慢了? |