Chinaunix首页 | 论坛 | 博客

分类: C#/.net

2015-04-06 12:57:44

点击(此处)折叠或打开

  1. #include <reg51.h>

  2. void delay_s()
  3. {
  4.     unsigned char a,b,c;
  5.     for(c=13;c>0;c--);
  6.         for(b=247;b>0;b--);
  7.             for(a=142;a>0;a--)     ;

  8. }
  9. void delay_ms()
  10. {
  11.     unsigned char a,b;
  12.     for(b=102;b>0;b--);
  13.         for(a=3;a>0;a--);                                                                        
  14. }
  15. int main()
  16. {
  17.     unsigned char SEG_CA[10] ={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
  18.     unsigned char SEG_CC[10] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};    
  19.  //    unsigned char SEG_CC[10] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};    


  20.     int count;
  21.     int i,j;
  22.     
  23.     for(i=0;i<10;i++)
  24.     {
  25.         for(j=0;j<10;j++)
  26.         {    
  27.             count=200;
  28.             while(count<500)
  29.             {
  30.                 P2=0xfe;
  31.                 P0=SEG_CC[j];
  32.                 delay_s();
  33.             
  34.                 if(i>0)
  35.                 {    
  36.                     P2=0xfd;

  37.                     P0=SEG_CC[i];
  38.                          
  39.                     
  40.                 }
  41.                 
  42.                 
  43.                 
  44.                     count++;
  45.                 
  46.             }
  47.         }
  48.     }
  49. }

阅读(2044) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

拾忆17652075852015-08-10 09:26:35

老伴真厉害