找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1572|回复: 0
打印 上一主题 下一主题
收起左侧

4光立方源程序

[复制链接]
跳转到指定楼层
楼主
ID:251316 发表于 2018-5-13 22:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 哈喽,夏天 于 2018-5-13 22:12 编辑
  1. #include"stc12c5a.h"
  2. #include"INTRINS.h"
  3. #include"basic.h"
  4. #define sNum 0
  5. #define eNum 1600
  6. void Delay100us();
  7. void Timer0Init(void);
  8. Word temp=sNum,count=0;
  9. Byte code table[]={0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  10.                    0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  11.                                    0xfe,0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  12.                                    0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  13.                                    0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  14.                                    0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,
  15.                                    0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,
  16.                                    0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xfe,0xfe,
  17.                                    0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xff,0xfe,0xfe,0xfe,
  18.                                    0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,
  19.                                    0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xfe,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,
  20.                                    0xfe,0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xfe,0xfe,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,//12
  21.                                    0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xff,0xfe,0xfe,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,//13
  22.                                    0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,//14
  23.                                    0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,//15
  24.                                    0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,//16

  25.                                    0xfc,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
  26.                    0xfc,0xfc,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
  27.                                    0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
  28.                                    0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
  29.                                    0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
  30.                                    0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfe,
  31.                                    0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,
  32.                                    0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfc,0xfc,
  33.                                    0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfc,0xfc,0xfc,
  34.                                    0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,
  35.                                    0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfc,0xfe,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,
  36.                                    0xfc,0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfc,0xfc,0xfe,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,
  37.                                    0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfe,0xfc,0xfc,0xfe,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,
  38.                                    0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,
  39.                                    0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
  40.                                    0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,//32

  41.                                    0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
  42.                    0xf8,0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
  43.                                    0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
  44.                                    0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
  45.                                    0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
  46.                                    0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xfc,
  47.                                    0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,
  48.                                    0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xf8,0xf8,
  49.                                    0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xf8,0xf8,0xf8,
  50.                                    0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,
  51.                                    0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xf8,0xfc,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,
  52.                                    0xf8,0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xf8,0xf8,0xfc,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,
  53.                                    0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xfc,0xf8,0xf8,0xfc,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,
  54.                                    0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,
  55.                                    0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
  56.                                    0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,//48

  57.                                    0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
  58.                    0xf0,0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
  59.                                    0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
  60.                                    0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
  61.                                    0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
  62.                                    0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf8,
  63.                                    0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,
  64.                                    0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf0,0xf0,
  65.                                    0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf0,0xf0,0xf0,
  66.                                    0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,
  67.                                    0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,
  68.                                    0xf0,0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,
  69.                                    0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf8,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,
  70.                                    0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,
  71.                                    0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
  72.                                    0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,//64

  73.                                    0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
  74.                                    0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
  75.                                    0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,// 67 全亮三次


  76.                                    0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,
  77.                                    0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,
  78.                                    0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,
  79.                                    0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,  //71

  80.                                    0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,
  81.                                    0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,
  82.                                    0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,
  83.                                    0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe, //75         上到下
  84.                                   
  85.                                    0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  86.                                    0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  87.                                    0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,
  88.                                    0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0, //79   前到后

  89.                                    0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,
  90.                                    0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,
  91.                                    0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,
  92.                                    0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,//83           右到左

  93.                                    0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
  94.                                    0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,
  95.                                    0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,
  96.                                    0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7, //87        下到上

  97.                                    0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,
  98.                                    0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,
  99.                                    0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  100.                                    0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,        //91

  101.                                    0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,
  102.                                    0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,
  103.                                    0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,
  104.                                    0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff, //95

  105.                    0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  106.                                    0xfc,0xfc,0xff,0xff,0xfc,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  107.                                    0xf8,0xf8,0xf8,0xff,0xf8,0xf8,0xf8,0xff,0xf8,0xf8,0xf8,0xff,0xff,0xff,0xff,0xff,
  108.                                    0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,//99


  109.                                   


  110.                                    };



  111. void main()
  112. {
  113.   Byte m=0xfe,i;
  114.   Timer0Init();
  115. while(1)
  116. {
  117.   
  118.   if(temp<eNum)
  119.   {
  120.   for(i=0;i<8;i++)
  121.   {
  122.     P0=m;
  123.         P1=table[temp+i];
  124.         m=_crol_(m,1);
  125.         Delay100us();
  126.         P1=0xff;
  127.   }
  128.    m=0xfe;
  129.    P0=0xff;

  130.      for(i=0;i<8;i++)
  131.   {
  132.     P2=m;
  133.         P1=table[temp+i+8];
  134.         m=_crol_(m,1);
  135.         Delay100us();
  136.         P1=0xff;
  137.   }
  138.    m=0xfe;
  139.    P2=0xff;
  140.    }
  141.    else
  142.    temp=sNum;
  143. }
  144. }

  145. void Timer0Init(void)                //5毫秒@11.0592MHz
  146. {
  147.         IE=0x82;
  148.         AUXR |= 0x80;                //定时器时钟1T模式
  149.         TMOD &= 0xF0;                //设置定时器模式
  150.         TMOD |= 0x01;                //设置定时器模式
  151.         TL0 = 0x00;                //设置定时初值
  152.         TH0 = 0x28;                //设置定时初值
  153.         TF0 = 0;                //清除TF0标志
  154.         TR0 = 1;                //定时器0开始计时
  155. }


  156. void T0_time() interrupt 1
  157. {
  158.    
  159.           TL0 = 0xA0;                //设置定时初值
  160.         TH0 = 0x15;                //设置定时初值
  161.         count++;
  162.         if(count==30)
  163.         {
  164.          count=0;
  165.          temp=temp+16;
  166.         }
  167. }

  168. void Delay100us()                //@11.0592MHz
  169. {
  170.         unsigned char i, j;

  171.         i = 2;
  172.         j = 15;
  173.         do
  174.         {
  175.                 while (--j);
  176.         } while (--i);
  177. }
复制代码

一般常见的光立方源程序
#include"stc12c5a.h"
#include"INTRINS.h"
#include"basic.h"
#define sNum 0
#define eNum 1600
void Delay100us();
void Timer0Init(void);
Word temp=sNum,count=0;
Byte code table[]={0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
                   0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
                                   0xfe,0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
                                   0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
                                   0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
                                   0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,
                                   0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,
                                   0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xfe,0xfe,
                                   0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xff,0xfe,0xfe,0xfe,
                                   0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,
                                   0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xfe,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,
                                   0xfe,0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xfe,0xfe,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,//12
                                   0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xff,0xfe,0xfe,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,//13
                                   0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,//14
                                   0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,//15
                                   0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,//16

                                   0xfc,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
                   0xfc,0xfc,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
                                   0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
                                   0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
                                   0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
                                   0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfe,
                                   0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,
                                   0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfc,0xfc,
                                   0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfc,0xfc,0xfc,
                                   0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfe,0xfe,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,
                                   0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfc,0xfc,0xfe,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,
                                   0xfc,0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfc,0xfc,0xfe,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,
                                   0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfe,0xfc,0xfc,0xfe,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,
                                   0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,
                                   0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfe,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
                                   0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,//32

                                   0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
                   0xf8,0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
                                   0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
                                   0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
                                   0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
                                   0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xfc,
                                   0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,
                                   0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xf8,0xf8,
                                   0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xf8,0xf8,0xf8,
                                   0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xfc,0xfc,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,
                                   0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xfc,0xf8,0xf8,0xfc,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,
                                   0xf8,0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xf8,0xf8,0xfc,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,
                                   0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xfc,0xf8,0xf8,0xfc,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,
                                   0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xfc,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,
                                   0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xfc,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
                                   0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,//48

                                   0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
                   0xf0,0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
                                   0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
                                   0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
                                   0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
                                   0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf8,
                                   0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf0,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf0,0xf0,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf8,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf8,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf8,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf8,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,//64

                                   0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
                                   0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,// 67 全亮三次


                                   0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,
                                   0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,
                                   0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,
                                   0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,  //71

                                   0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,
                                   0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,
                                   0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,
                                   0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe, //75         上到下
                                   
                                   0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
                                   0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
                                   0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,
                                   0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0, //79   前到后

                                   0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,
                                   0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,
                                   0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,
                                   0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,//83           右到左

                                   0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
                                   0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,
                                   0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,
                                   0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7, //87        下到上

                                   0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,
                                   0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,
                                   0xff,0xff,0xff,0xff,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
                                   0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,        //91

                                   0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,
                                   0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,
                                   0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,
                                   0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff,0xf0,0xff,0xff,0xff, //95

                   0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
                                   0xfc,0xfc,0xff,0xff,0xfc,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
                                   0xf8,0xf8,0xf8,0xff,0xf8,0xf8,0xf8,0xff,0xf8,0xf8,0xf8,0xff,0xff,0xff,0xff,0xff,
                                   0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,//99


                                   


                                   };



void main()
{
  Byte m=0xfe,i;
  Timer0Init();
while(1)
{

  if(temp<eNum)
  {
  for(i=0;i<8;i++)
  {
    P0=m;
        P1=table[temp+i];
        m=_crol_(m,1);
        Delay100us();
        P1=0xff;
  }
   m=0xfe;
   P0=0xff;

     for(i=0;i<8;i++)
  {
    P2=m;
        P1=table[temp+i+8];
        m=_crol_(m,1);
        Delay100us();
        P1=0xff;
  }
   m=0xfe;
   P2=0xff;
   }
   else
   temp=sNum;
}
}

void Timer0Init(void)                //5毫秒@11.0592MHz
{
        IE=0x82;
        AUXR |= 0x80;                //定时器时钟1T模式
        TMOD &= 0xF0;                //设置定时器模式
        TMOD |= 0x01;                //设置定时器模式
        TL0 = 0x00;                //设置定时初值
        TH0 = 0x28;                //设置定时初值
        TF0 = 0;                //清除TF0标志
        TR0 = 1;                //定时器0开始计时
}


void T0_time() interrupt 1
{

          TL0 = 0xA0;                //设置定时初值
        TH0 = 0x15;                //设置定时初值
        count++;
        if(count==30)
        {
         count=0;
         temp=temp+16;
        }
}

void Delay100us()                //@11.0592MHz
{
        unsigned char i, j;

        i = 2;
        j = 15;
        do
        {
                while (--j);
        } while (--i);
}


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表