找回密码
 立即注册

QQ登录

只需一步,快速开始

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

4x4x4立方光制作(原理图+源程序+制作教程 C语言开源)

  [复制链接]
跳转到指定楼层
楼主
ID:94097 发表于 2015-10-30 14:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
视频:





希望喜欢工作室作品的朋友将我们的作品和精神分享,我们坚持创新,坚持开源!转载和引用请注明出处,禁止用于商业目的。
光立方原理图:



14年注定是繁忙的一年,年初到现在,除了本职工作比较繁忙,再就是辅导学生参加单片机设计竞赛。加上最近比较泛滥,都没时间整理汇编教程。好像是在某一天,突然觉得这么浑浑噩噩下去实在是不行,于是鞭策自己跑到实验室,开始枯燥的码字。进过一段时间的努力,总算是小有收货。
这次给大家的带来的作品是4x4x4的立方光,可能大家觉得,之前我做的是8x8x8的,现在怎么越做越小了,其实不是这样的。现在我带领学生也在做16x16X16的立方光,但大的立方光就必须要用C语言写了,我的C语言学的时间不长,基本上都是用到什么才去学,为了能更好的实现16x16x16立方光的控制,所以我先做了一个4x4x4的立方光,用C语言编程,感悟一下C语言的控制方式。视频中的动画平不多,因为我实在是没时间来设计动画了,有想做的朋友可以自己再加动画。

制作步骤
一 材料请根据原理图自行购买
二制作工具

焊接灯珠一向是比较麻烦的,但借助自己制作的工具来焊接,可以节约大量的人力和时间,所以这里简要说明一向焊接模板的制作。
1

1是我用万能版加排针搭建的,排针直接横向的间距是7个洞,纵向的间距是8个洞,没2个排针为一组,一次焊接好16组就可以了。
接下来是灯珠管脚的弯折,最好是用平口镊子。灯珠的短管脚面向你,用镊子把所有管脚向右90度弯折,如图2

再把灯珠的长管脚(正极)向下90度弯折,如图
3

灯珠的弯折只需要这两步,然后就可以摆放到焊接模板上了,这里我以两个灯珠的摆放为例如图4

摆放好后,就可以焊接了,焊接好后,检查是否有开焊虚焊等问题。焊好的点阵如图4-1

驱动板的焊接,这次驱动电路我没使用任何IC,而是三极管直接驱动,之所以选用8550,是因为三极管开关电路中,8550是低电平导通,避免了单片机上电就导通的问题。8550可承受的电流较于其他90系列三极管较大,最适合做led驱动。
每组三极管的焊接如图所示
5

共阳极驱动三极管共需要16只,再加上4只回路控制,共20只,这里需要注意的是,共阳极三极管和回路三极管的焊接是不同的,详细请参照原理图。三极管的B极是通过单片机控制的,三极管的数量比较多,所以在板子背面就只能跳线了。
实物组装
焊接好最小系统,驱动电路后,就可以组装了。组装之前检查4个点阵高度是否一致,然后就直接插在母座上面。插好后,会发现灯珠的负极管脚还是悬空的。此时将每一层的负极管脚短接。注意!!!请参考下图6

这里要强调是,不是每个点阵的负极短接,而是两两点阵之间的负极管脚短接。这里所说的每一层是竖直高度的,而不是之前焊接好的点阵。
这样焊接好后,电路是不会点亮的,因为led灯珠此时的负极没有构成回路,换句话说,负极还是悬空的。此时就需要用废弃的管脚或跳线来把每一层的负极连接到万能板的回路三极管上。我是用元件管脚连接的,由于颜色问题,图片里看不清楚,所以我给大家做出了图示图7

实物焊接图
8

负极短接好后,就是连接到回路三极管了,我采用了跳线短接,即每一层的负极短接到万能板,再通过跳线连接到回路三极管的C极,这样立方光就有了电路回路(请根据原理图理解)
9



主程序:
  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. }
复制代码


更多资料请移步工作室百度网盘下载

工作室百度网盘: http://pan点baidu点com/share/home?uk=3691829170 包含工作室教学视频、教学资料和网络作品资料下载


4x4x4立方光.zip

3.21 MB, 下载次数: 168, 下载积分: 黑币 -5

评分

参与人数 2威望 +5 黑币 +3 收起 理由
suoai + 1 赞一个!
小白吕 + 5 + 2 赞一个!

查看全部评分

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

使用道具 举报

沙发
ID:95892 发表于 2015-12-12 23:47 来自手机 | 只看该作者
楼主那个B0.B1.B2.B3是接哪里的?
回复

使用道具 举报

板凳
ID:103515 发表于 2016-1-16 22:43 | 只看该作者
下载试试看
回复

使用道具 举报

地板
ID:123674 发表于 2016-5-28 13:49 | 只看该作者
51黑有你更精彩

回复

使用道具 举报

5#
ID:124608 发表于 2016-6-2 08:15 | 只看该作者
谢谢
回复

使用道具 举报

6#
ID:116662 发表于 2016-6-5 21:44 | 只看该作者
不错一直也想做一个但是看看这大堆的二极管焊接制作就胆小,楼主有耐心呀,高手
回复

使用道具 举报

7#
ID:125826 发表于 2016-6-8 11:56 | 只看该作者
很不错哎
回复

使用道具 举报

8#
ID:125826 发表于 2016-6-8 11:57 | 只看该作者
我也想做
回复

使用道具 举报

9#
ID:136172 发表于 2016-8-6 19:57 | 只看该作者
月儿弯~ 发表于 2015-12-12 23:47
**** 作者被禁止或删除 内容自动屏蔽 ****

请问你知道那个B0什么是接什么了么?
回复

使用道具 举报

10#
ID:151751 发表于 2017-3-24 00:04 | 只看该作者
感谢分享!!
回复

使用道具 举报

11#
ID:254637 发表于 2017-11-28 13:48 来自手机 | 只看该作者
试试看行不行
回复

使用道具 举报

12#
ID:255861 发表于 2017-12-1 12:29 来自手机 | 只看该作者
同问,B0是接哪儿的啊,是控制一列层吗?
回复

使用道具 举报

13#
ID:187096 发表于 2018-2-9 00:16 | 只看该作者
谢谢分享               
回复

使用道具 举报

14#
ID:286719 发表于 2018-3-23 20:53 | 只看该作者
如果是PCB的,就更好了
回复

使用道具 举报

15#
ID:443779 发表于 2018-12-11 08:18 | 只看该作者
谢谢楼主分享
回复

使用道具 举报

16#
ID:432687 发表于 2019-4-22 16:09 来自手机 | 只看该作者
灵感和学习效果的完美页面..我对这项创新感到非常惊讶好主意,和我们在一起!不幸的是,我不懂你的语言,我严重依赖翻译。谢谢分享。
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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