回覆列表
  • 1 # 小逗娛樂匯

    #include <reg52.h>#include <intrins.h>#include <stdio.h>#include <math.h>#define uchar unsigned char#define uint unsigned intuint code wei[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};uint code duan[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};uchar s[8];sbit wela=P2^0;sbit dula=P2^1;uint weishu;void delayms(unsigned int i)//延時函式{ unsigned int j; for(;i>0;i--) for(j=100;j>0;j--);} void display(uint num){uint i;for(i=0;i<num;i++){P0=0xff;wela=1;P0=wei[i];wela=0;P0=0x00;dula=1;P0=duan[s[i]];dula=0;delayms(2);}}void main(){ uint num1=1,num2=6; while(1) { sprintf(s,"%d",num1);weishu++; sprintf(s+weishu,"%d",num2);weishu++;while(1){display(weishu);}}}

  • 中秋節和大豐收的關聯?
  • 怎麼樣改掉寶寶做事不專心的毛病?