在數碼管動態顯示中,延時時間長了數碼管不能正確顯示,咋回事呢? 程序如下: /*******************-******************* 數碼管顯示1 2012年5月12日 **************************************/ #include<reg51.h> #define uchar unsigned char #define uint unsigned int uchar code d1[] = {0xf9,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0}; //字碼0-7 數碼管共陽 uchar code d2[] = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; /********************************************************/ void delay(void) //延時 { uchar i,j; for(i = 0 ; i < 1; i++) for(j = 0 ; j < 600 ; j++); //時間調短,可以顯示出0-7,如果長了就能顯示一個了(現在就只有一個數碼管顯示) } /*****************************************************/ void main() { uchar i; P0 = 0xff; P2 = 0xff; while(1) { for(i = 0 ; i < 8 ; i++) //循環點亮 { P0 = d1; P2 = d2; delay(); P0=0xff; } } } 當延時時間長了就不能正確顯示:0-7了,只有一個數碼管亮,不知道是咋回事。求好心人給幫忙看看,謝謝。 |