📄 1.c
字号:
#include"at89x51.h"
void ms(unsigned int Delay)
{
unsigned int a;
for(;Delay>0;Delay--)
{
for(a=0;a<114;a++){;}
}
}
void main(void)
{
unsigned char a;
unsigned char shu[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
P2=0;
P3=255;
while(1)
{
P2=a;
ms(300);
while(1)
{
P0_3=0;
P1=shu[a/200];
ms(1);
P0_3=1;
P0_2=0;
P1=shu[a/20%10]-128;
ms(1);
P0_2=1;
P0_1=0;
P1=shu[a/2%10];
ms(1);
P0_1=1;
P0_0=0;
P1=0xc1;
ms(1);
P0_0=1;
if(!P3_2||!P3_0||!P3_3) break;
}
if(!P3_3)
{
if(a>20) a-=20;
else a=0;
}
if(!P3_0)
{
if(a<=220) a+=20;
else a=240;
}
if(!P3_2&&a<=238) a+=2;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -