程序如下:
#include<reg51.h>
unsigned int timecount;
unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code shuzu[]={
0x00,0x00,0x3e,0x41,0x41,0x41,0x3e,0x00, //0
0x00,0x00,0x00,0x00,0x21,0x7f,0x01,0x00, //1
0x00,0x00,0x27,0x45,0x45,0x45,0x39,0x00, //2
0x00,0x00,0x22,0x49,0x49,0x49,0x36,0x00, //3
0x00,0x00,0x0c,0x14,0x24,0x7f,0x04,0x00, //4
0x00,0x00,0x72,0x51,0x51,0x51,0x4e,0x00, //5
0x00,0x00,0x3e,0x49,0x49,0x49,0x26,0x00, //6
0x00,0x00,0x40,0x40,0x40,0x4f,0x70,0x00, //7
0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00, //8
0x00,0x00,0x32,0x49,0x49,0x49,0x3e,0x00, //9
0x00,0x00,0x7F,0x48,0x48,0x30,0x00,0x00, //P
0x00,0x00,0x7F,0x48,0x4C,0x73,0x00,0x00, //R
0x00,0x00,0x7F,0x49,0x49,0x49,0x00,0x00, //E
0x00,0x00,0x3E,0x41,0x41,0x62,0x00,0x00, //C
0x00,0x00,0x7F,0x08,0x08,0x7F,0x00,0x00, //H
0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00, //I
0x00,0x7F,0x10,0x08,0x04,0x7F,0x00,0x00, //N
0x7C,0x48,0x48,0xFF,0x48,0x48,0x7C,0x00 //中
};
void delay(unsigned int t)
{
while (t--)
{;}
}
void main(void)
{ unsigned char i,j,a;
while(1)
{
for(i=0;i<=136;i++) //循环扫描一遍136帧
for(a=0;a<=80;a++) //移动速度
{
for(j=0;j<=7;j++)
{
P0=shuzu[i+j];
P2=tab[j];
delay(10);
}
}
}
}
基于51单片机的~
1、首先编写一段简单的代码,如下图所示,编辑一段简单的输出语句。
2、依次点击菜单栏内的编译→组建→执行,确保这段成率可以正确执行。
3、从运行结果来看程序正确,没有问题,然后找到exe可执行程序看其是否有闪退现象。
4、将C语言代码保存后打开代码所在的文件夹,该文件夹内有一个名为【Debug】的文件夹,exe可执行程序就在此文件夹内。
5、打开【Debug】文件夹内的exe可执行程序,未出现闪退,可清晰查看到程序运行结果。
51单片机不支持多线程 嗨
延时也可以~能麻烦您给编写一段吗?我是初学者实在不会啊
追答你那个delay的函数就是延时啊,你要调用的时候就delay(100);就行啊,里面的那个数字你自己调一下。