试了很多次,用各种条件都没成功
#include<reg52.h>
unsigned char code LED[32]={0x7e,0xbd,0xdb,0xe7,
0x7f,0xbf,0xdf,0xef,
0xf7,0xfb,0xfd,0xfe,
0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f,
0xff,0xff,0x00,0x00,
0x55,0x55,0xaa,0xaa,
0xff,0xff,0x00,0x00
};//rom允许情况可以无限添加
void Delay(unsigned int t); //函数声明
/*------------------------------------------------
主函数
------------------------------------------------*/
main()
{
unsigned char i,j;
j=2;
i=0;
//定义一个无符号字符型
//局部变量 i 取值范围 0~255
while(j--)
{
for(i=0;i<32;i++)
{
P1 = LED[i];
Delay(20000);
} 数组
}
}
/*------------------------------------------------
延时函数,含有输入参数 unsigned int t,无返回值
unsigned int 是定义无符号整形变量,其值的范围是
0~65535
------------------------------------------------*/
void Delay(unsigned int t)
{
while(--t);
}
|