#include
#include
#define uchar unsigned char
#define uint unsigned int
uchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};
//延时
void DelayMS(uint x)
{
uchar t;
while(x--) for(t=0;t<120;t++);
}
//主程序
void main()
{
uchar i=0;
P0=0x00;
while(1)
{
P0=~DSY_CODE[i];
i=(i+1)%10;
DelayMS(300);
}
}
为了方便大家更好的学习,您还可以关注畅学电子和EDA的公众号,每天推送相关知识,希望能对你的学习有所帮助!