quanqihui吧 关注:52贴子:1,120
  • 2回复贴,共1
实现闪现的数字,设计2


1楼2013-07-02 15:16回复
    #include<reg52.h>unsigned char i=0,g=0,s=0;f=0;unsigned int j=0;unsigned char code L[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0X90};unsigned char code W[]={0xfe,0xfd,0xfb,0xf7,0xef,0xcf,0xbf,0x7f};
    void main(){TMOD=0x01;TH0=(65536-50000)/256;TL0=(65536-50000)%256;EA=1;ET0=1;TR0=1;while(1){for(s=1;s<g+1;s++){P2=W[g-s];P0=L[s];j=100;while(j--);}};}
    void tim0(void) interrupt 1 using 1{EA=0;i++;if(i==20){if(f==0){g++;if(g>7)f=1;}else{g--;if(g==0)f=0;}i=0;}TH0=(65536-50000)/256;TL0=(65536-50000)%256;EA=1;}


    2楼2013-07-02 15:17
    回复
      #include<reg52.h>
      unsigned char i=0,g=0,s=0;f=0;
      unsigned int j=0;
      unsigned char code L[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0X90};
      unsigned char code W[]={0xfe,0xfd,0xfb,0xf7,0xef,0xcf,0xbf,0x7f};
      void main()
      {TMOD=0x01;
      TH0=(65536-50000)/256;
      TL0=(65536-50000)%256;
      EA=1;
      ET0=1;
      TR0=1;
      while(1)
      {
      for(s=1;s<g+1;s++)
      {
      P2=W[g-s];
      P0=L[s];
      j=100;
      while(j--);
      }
      };
      }
      void tim0(void) interrupt 1 using 1
      {EA=0;
      i++;
      if(i==20)
      {
      if(f==0)
      {
      g++;
      if(g>7)f=1;
      }
      else
      {
      g--;
      if(g==0)
      f=0;
      }
      i=0;
      }
      TH0=(65536-50000)/256;
      TL0=(65536-50000)%256;
      EA=1;}


      3楼2013-07-02 15:21
      回复