你的程序延时的数据类型选错了,我给你改过来了,而且你在仔细看看你的段码也有错误。
#include <reg51.h>
typedef unsigned char u8;
typedef unsigned int u16;
u8 code smgduan[16]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void delay(u16 t)
{
while(t--);
}
void main()
{
u8 i;
while(1)
{
P0=0xff;
delay(50000);
for(i=0;i<16;i++)
{
P0=~smgduan[i];
delay(50000);
}
}
}
|