• 大小: 27KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-22
  • 语言: C/C++
  • 标签: 51单片机  光立方  

资源简介

KEIL MDK工程代码,用C语言编写51单片机控制4*4*4阶光立方,能够在光立方上显示任意的立体形状,很炫酷,博主课程设计项目,实测可用!!

资源截图

代码片段和文件信息

//公    司:Alpha
//作    者:张虎
//工程名称:4阶光立方驱动程序
//MCU:stc12c5a60s2
//时间:2015/4/18
//版本:v1.0

//硬件连接关系
// P2.0--->X1    P1.0--->Y1    P0.0--->Z1
// P2.1--->X2    P1.1--->Y2    P0.1--->Z2
// P2.2--->X3    P1.2--->Y3    P0.2--->Z3
// P2.3--->X4    P1.3--->Y4    P0.3--->Z4
//说明:X、Y、Z表示led灯的三维坐标,且都是输出高电平有效

#include 
#include 
#define uint unsigned int
#define uchar unsigned char
#define frame 147                //设置动画的默认帧数为32帧
#define coordinate 8 //设置一帧图像包含的坐标点用8字节表示

//硬件端口定义
#define X_axle P2
#define Y_axle P1
#define Z_axle P0

//图像数据
uchar code image_source[frame][coordinate]=
    {
0x100x000x310x000x730x100xF70x31    //填满动画
0x100x000x310x000x730x100xFF0x31
0x100x000x310x000x730x100xFF0x71
0x100x000x310x000x730x100xFF0x73
0x100x000x310x000x730x100xFF0xF3
0x100x000x310x000x730x100xFF0xF7
0x100x000x310x000x730x100xFF0xFF
0x100x000x310x000xF30x100xFF0xFF
0x100x000x310x000xF70x100xFF0xFF
0x100x000x310x000xF70x300xFF0xFF
0x100x000x310x000xF70x310xFF0xFF
0x100x000x310x000xFF0x310xFF0xFF
0x100x000x310x000xFF0x710xFF0xFF
0x100x000x310x000xFF0x730xFF0xFF
0x100x000x310x000xFF0xF30xFF0xFF
0x100x000x310x000xFF0xF70xFF0xFF
0x100x000x310x000xFF0xFF0xFF0xFF
0x100x000x710x000xFF0xFF0xFF0xFF
0x100x000x730x000xFF0xFF0xFF0xFF
0x100x000x730x100xFF0xFF0xFF0xFF
0x100x000xF30x100xFF0xFF0xFF0xFF
0x100x000xF70x100xFF0xFF0xFF0xFF
0x100x000xF70x300xFF0xFF0xFF0xFF
0x100x000xF70x310xFF0xFF0xFF0xFF
0x100x000xFF0x310xFF0xFF0xFF0xFF
0x100x000xFF0x710xFF0xFF0xFF0xFF
0x100x000xFF0x730xFF0xFF0xFF0xFF
0x100x000xFF0xF30xFF0xFF0xFF0xFF
0x100x000xFF0xF70xFF0xFF0xFF0xFF
0x100x000xFF0xFF0xFF0xFF0xFF0xFF
0x300x000xFF0xFF0xFF0xFF0xFF0xFF
0x310x000xFF0xFF0xFF0xFF0xFF0xFF
0x310x000xFF0xFF0xFF0xFF0xFF0xFF
0x710x000xFF0xFF0xFF0xFF0xFF0xFF
0x710x000xFF0xFF0xFF0xFF0xFF0xFF
0x730x000xFF0xFF0xFF0xFF0xFF0xFF
0x730x100xFF0xFF0xFF0xFF0xFF0xFF
0xF30x100xFF0xFF0xFF0xFF0xFF0xFF
0xF70x100xFF0xFF0xFF0xFF0xFF0xFF
0xF70x300xFF0xFF0xFF0xFF0xFF0xFF
0xF70x310xFF0xFF0xFF0xFF0xFF0xFF
0xF70x310xFF0xFF0xFF0xFF0xFF0xFF
0xFF0x310xFF0xFF0xFF0xFF0xFF0xFF
0xFF0x710xFF0xFF0xFF0xFF0xFF0xFF
0xFF0x730xFF0xFF0xFF0xFF0xFF0xFF
0xFF0xF30xFF0xFF0xFF0xFF0xFF0xFF
0xFF0xF70xFF0xFF0xFF0xFF0xFF0xFF
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF
0x080x880x000x000x000x000x000x00    //S流水动画
0x880x800x000x000x000x000x000x00
0xC80x000x000x000x000x000x000x00
0xE00x000x000x000x000x000x000x00
0x700x000x000x000x000x000x000x00
0x310x000x000x000x000x000x000x00
0x110x100x000x000x000x000x000x00
0x010x110x000x000x000x000

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       7235  2015-04-18 15:19  cube4\cube4

     文件       5295  2015-04-18 15:19  cube4\cube4.hex

     文件         57  2015-04-18 15:19  cube4\cube4.lnp

     文件       7901  2015-04-18 15:19  cube4\cube4.M51

     文件       6195  2015-04-18 15:19  cube4\cube4.plg

    .......     55657  2015-04-18 15:25  cube4\cube4.uvopt

    .......     13399  2015-04-18 15:20  cube4\cube4.uvproj

    .......     55645  2015-04-18 15:20  cube4\cube4_uvopt.bak

    .......         0  2015-04-18 09:48  cube4\cube4_uvproj.bak

     文件       9216  2015-04-18 15:25  cube4\main.c

     文件      15435  2015-04-18 15:19  cube4\main.LST

     文件       7583  2015-04-18 15:19  cube4\main.OBJ

     文件         34  2015-04-18 15:19  cube4\main.__i

     文件       6376  2009-05-07 14:37  cube4\STARTUP.A51

     文件      14048  2015-04-18 13:09  cube4\STARTUP.LST

     文件        749  2015-04-18 13:09  cube4\STARTUP.OBJ

     目录          0  2015-04-18 15:25  cube4

----------- ---------  ---------- -----  ----

               204825                    17


评论

共有 条评论