找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4552|回復: 0
打印 上一主題 下一主題
收起左側

關于8x8x8階光立方資料

[復制鏈接]
跳轉到指定樓層
樓主
ID:180782 發(fā)表于 2018-5-28 18:45 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式

全部資料51hei下載地址:
573 2803 程序 原理圖 PCB_20130606213915.zip (1.76 MB, 下載次數(shù): 22)
上位機程序.zip (29.11 KB, 下載次數(shù): 12)
所有.pdf (185.51 KB, 下載次數(shù): 10)
PCB.pdf (570.92 KB, 下載次數(shù): 9)
原理圖.pdf (591.54 KB, 下載次數(shù): 10)


部分程序

  1. #include <REG52.H>
  2. #include <intrins.h>
  3. #define uchar unsigned char

  4. #define uint unsigned int

  5. uchar display[8][8];

  6. /*rank:A,1,2,3,4,I,心,U*/

  7. uchar code table_cha[8][8]={0x51,0x51,0x51,0x4a,0x4a,0x4a,0x44,0x44,0x18,0x1c,0x18,0x18,0x18,0x18,0x18,0x3c,0x3c,0x66,0x66,0x30,0x18,0xc,0x6,0xf6,0x3c,0x66,0x60,0x38,0x60,0x60,0x66,0x3c,0x30,0x38,0x3c,0x3e,0x36,0x7e,0x30,0x30,0x3c,0x3c,0x18,0x18,0x18,0x18,0x3c,0x3c,0x66,0xff,0xff,0xff,0x7e,0x3c,0x18,0x18,0x66,0x66,0x66,0x66,0x66,0x66,0x7e,0x3c};

  8. /*the "ideasoft"*/

  9. uchar code table_id[40]={0x81,0xff,0x81,0x00,0xff,0x81,0x81,0x7e,0x00,0xff,0x89,0x89,0x00,0xf8,0x27,0x27,0xf8,0x00,0x8f,0x89,0x89,0xf9,0x00,0xff,0x81,0x81,0xff,0x00,0xff,0x09,0x09,0x09,0x01,0x0,0x01,0x01,0xff,0x01,0x01,0x00};

  10. /*railway*/

  11. uchar code dat[128]={0x0,0x20,0x40,0x60,0x80,0xa0,0xc0,0xe0,0xe4,0xe8,0xec,0xf0,0xf4,0xf8,0xfc,0xdc,0xbc,0x9c,0x7c,0x5c,0x3c,0x1c,0x18,0x14,0x10,0xc,0x8,0x4,0x25,0x45,0x65,0x85,0xa5,0xc5,0xc9,0xcd,0xd1,0xd5,0xd9,0xb9,0x99,0x79,0x59,0x39,0x35,0x31,0x2d,0x29,0x4a,0x6a,0x8a,0xaa,0xae,0xb2,0xb6,0x96,0x76,0x56,0x52,0x4e,0x6f,0x8f,0x93,0x73,0x6f,0x8f,0x93,0x73,0x4a,0x6a,0x8a,0xaa,0xae,0xb2,0xb6,0x96,0x76,0x56,0x52,0x4e,0x25,0x45,0x65,0x85,0xa5,0xc5,0xc9,0xcd,0xd1,0xd5,0xd9,0xb9,0x99,0x79,0x59,0x39,0x35,0x31,0x2d,0x29,0x0,0x20,0x40,0x60,0x80,0xa0,0xc0,0xe0,0xe4,0xe8,0xec,0xf0,0xf4,0xf8,0xfc,0xdc,0xbc,0x9c,0x7c,0x5c,0x3c,0x1c,0x18,0x14,0x10,0xc,0x8,0x4};

  12. /*railway 2*/

  13. uchar code dat2[28]={0x0,0x20,0x40,0x60,0x80,0xa0,0xc0,0xe0,0xe4,0xe8,0xec,0xf0,0xf4,0xf8,0xfc,0xdc,0xbc,0x9c,0x7c,0x5c,0x3c,0x1c,0x18,0x14,0x10,0xc,0x8,0x4};

  14. /*railway 3*/

  15. uchar code dat3[24]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x16,0x26,0x36,0x46,0x56,0x66,0x65,0x64,0x63,0x62,0x61,0x60,0x50,0x40,0x30,0x20,0x10};

  16. /*3p char*/

  17. uchar code table_3p[3][8]={0xff,0x89,0xf5,0x93,0x93,0xf5,0x89,0xff,0x0e,0x1f,0x3f,0x7e,0x7e,0x3f,0x1f,0x0e,0x18,0x3c,0x7e,0xff,0x18,0x18,0x18,0x18};

  18. /*initializtion

  19. That is to initialize the program .

  20. It is write to set the timer in c52 mcu.

  21. So the program can renovate the led_3d_cube in fixed time use the interrupt function.*/

  22. void sinter()

  23. {

  24.          IE=0x82;

  25.          TCON=0x01;

  26.          TH0=0xc0;

  27.          TL0=0;

  28.          TR0=1;

  29. }

  30. void delay5us(void)   //誤差 -0.026765046296us STC 1T 22.1184Mhz
  31. {
  32.     unsigned char a,b;
  33.     for(b=7;b>0;b--)
  34.         for(a=2;a>0;a--);
  35. }

  36. void delay(uint i)

  37. {                                                                                                     

  38.          while (i--){
  39.                  delay5us();}//12t的mcu 注釋這個延時即可
  40. }

  41. /*To judge the num bit*/

  42. uchar judgebit(uchar num,uchar b)

  43. {

  44.          char n;

  45.          num=num&(1<<b);

  46.          if (num)

  47.          n=1;

  48.          else

  49.          n=0;

  50.          return n;

  51. }

  52. /*To figure out the round number*/

  53. uchar abs(uchar a)

  54. {

  55.          uchar b;

  56.          b=a/10;

  57.          a=a-b*10;

  58.          if (a>=5)

  59.          b++;

  60.          return b;

  61. }

  62. /*To figure out the absolute value*/

  63. uchar abss(char a)

  64. {

  65.          if (a<0)

  66.          a=-a;

  67.          return a;

  68. }

  69. /*The function can comparat the character.

  70. And remove the big one to the back.*/

  71. void max(uchar *a,uchar *b)

  72. {

  73.    uchar t;

  74.    if ((*a)>(*b))

  75.    {

  76.                    t=(*a);

  77.                    (*a)=(*b);

  78.                    (*b)=t;   

  79.    }

  80. }

  81. /*The function is to figure out the max number and return it.*/

  82. uchar maxt(uchar a,uchar b,uchar c)

  83. {

  84.          if (a<b)

  85.          a=b;

  86.          if (a<c)

  87.          a=c;

  88.          return a;

  89. }

  90. void clear(char le)

  91. {

  92.          uchar i,j;

  93.          for (j=0;j<8;j++)

  94.          {

  95.                    for (i=0;i<8;i++)

  96.                    display[j][i]=le;

  97.          }

  98. }

  99. void trailler(uint speed)

  100. {

  101.          char i,j;

  102.          for (i=6;i>=-3;i--)

  103.          {

  104.                    if (i>=0)

  105.                    {

  106.                             for (j=0;j<8;j++)

  107.                             display[j][i]=display[j][i+1];

  108.                    }

  109.                    if (i<4)

  110.                    {

  111.                             for (j=0;j<8;j++)

  112.                             display[j][i+4]=0;

  113.                    }

  114.                    delay(speed);

  115.          }

  116. }

  117. void point(uchar x,uchar y,uchar z,uchar le)

  118. {

  119.          uchar ch1,ch0;

  120.          ch1=1<<x;

  121.          ch0=~ch1;

  122.          if (le)

  123.          display[z][y]=display[z][y]|ch1;

  124.          else

  125.          display[z][y]=display[z][y]&ch0;

  126. }

  127. void type(uchar cha,uchar y)

  128. {        

  129.          uchar xx;

  130.          for (xx=0;xx<8;xx++)

  131.          {

  132.          display[xx][y]=table_cha[cha][xx];

  133.          }

  134. }

  135. /*The first variable is the distance from the midpoint.

  136. The second is the layer.

  137. the third is the flash speed of the time between each two point.

  138. The forth is the enable io,it controls weather draw or claen.*/

  139. void cirp(char cpp,uchar dir,uchar le)

  140. {

  141.          uchar a,b,c,cp;

  142.          if ((cpp<128)&(cpp>=0))

  143.          {

  144.                    if (dir)

  145.                    cp=127-cpp;

  146.                    else

  147.                    cp=cpp;

  148.                    a=(dat[cp]>>5)&0x07;

  149.                    b=(dat[cp]>>2)&0x07;

  150.                    c=dat[cp]&0x03;

  151.                    if (cpp>63)

  152.                    c=7-c;

  153.                    point (a,b,c,le);

  154.          }

  155. }

  156. void line(uchar x1,uchar y1,uchar z1,uchar x2,uchar y2,uchar z2,uchar le)

  157. {

  158.          char t,a,b,c,a1,b1,c1,i;

  159.          a1=x2-x1;

  160.          b1=y2-y1;

  161.          c1=z2-z1;

  162.          t=maxt(abss(a1),abss(b1),abss(c1));

  163.          a=x1*10;

  164.          b=y1*10;

  165.          c=z1*10;

  166.          a1=a1*10/t;

  167.          b1=b1*10/t;

  168.          c1=c1*10/t;

  169.          for (i=0;i<t;i++)

  170.          {

  171.                    point(abs(a),abs(b),abs(c),le);

  172.                    a+=a1;

  173.                    b+=b1;

  174.                    c+=c1;

  175.          }

  176.          point(x2,y2,z2,le);

  177. }

  178. void box(uchar x1,uchar y1,uchar z1,uchar x2,uchar y2,uchar z2,uchar fill,uchar le)

  179. {

  180.          uchar i,j,t=0;

  181.          max(&x1,&x2);

  182.          max(&y1,&y2);

  183.          max(&z1,&z2);

  184.          for (i=x1;i<=x2;i++)

  185.                    t|=1<<i;

  186.          if (!le)

  187.                    t=~t;

  188.          if (fill)

  189.          {

  190.                    if (le)

  191.                    {

  192.                             for (i=z1;i<=z2;i++)

  193.                             {

  194.                                      for (j=y1;j<=y2;j++)

  195.                                                display[j][i]|=t;

  196.                             }

  197.                    }

  198.                    else

  199.                    {

  200.                             for (i=z1;i<=z2;i++)

  201.                             {

  202.                                      for (j=y1;j<=y2;j++)

  203.                                                display[j][i]&=t;

  204.                             }

  205.                    }

  206.          }
復制代碼


詳細的都在壓縮包中,圖片點亮燈形狀等都有。
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表