找回密码
 立即注册

QQ登录

只需一步,快速开始

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

最新版单片机光立方制作资料

[复制链接]
跳转到指定楼层
楼主
全在附件里面,包括光立方原理图,源程序,取模软件,上位机软件,相关文档==,想要的东西基本在里面了,已经测试过没有问题。

电路原理图如下:


单片机源程序如下:
  1. /*---------------------------------------------------------------------------------------------------
  2. * 上升沿电子
  3. -----------------------------------------------------------------------------------------------------*/

  4. //Build target 'Target 1'
  5. //compiling stc8x8x8.c...
  6. //linking...
  7. //Program Size: data=17.1 xdata=355 code=53475
  8. //creating hex file from "stc8x8x8"...
  9. //"stc8x8x8" - 0 Error(s), 0 Warning(s).
  10. //没有关闭店字样的显示函数 FLASH_12        FLASH_14  FLASH_18 如果需要自己关闭函数即可





  11. #include "STC12C5A.H"  //包含单片机的头文件使用KEIL必须添加进来否则编译不了
  12. #include "intrins.h"   //包含NOP延时头文件
  13. #define uchar unsigned char         
  14. #define uint unsigned int         
  15. #define nop() _nop_();_nop_();

  16. void key_baihei_scan();  
  17. void key_shangwiej_scan();   
  18. void key_donghua_scan();        
  19. void key_yinyue_scan();
  20. void box(unsigned char x1,unsigned char z1,unsigned char y1,unsigned char x2,unsigned char z2,unsigned char y2,unsigned char fill,unsigned char le);
  21. /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
  22. sbit AD=P1^0;                 //定义音频输入接口
  23. sbit GM=P1^1;                 //定义光敏输入接口

  24. sbit K1=P0^0;                 //定义功能按键接口
  25. sbit K2=P0^1;                 //定义功能按键接口
  26. sbit K3=P0^2;                 //定义功能按键接口
  27. sbit K4=P0^3;                 //定义功能按键接口

  28. sbit PWM_POW=P4^4;   //定义PWM呼吸小夜灯和主板电源指示灯功能接口 低电平
  29. sbit IRIN=P3^2;           //红外线信号接口

  30. /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
  31. sbit M_HR_DS0=P1^4;          //模拟数据发送端口
  32. sbit M_LR_DS0=P1^5;          //模拟数据发送端口


  33. sbit M_HG_DS0=P1^6;          //模拟数据发送端口
  34. sbit M_LG_DS0=P0^7;          //模拟数据发送端口

  35. sbit CLK=P1^3;    //模拟时钟控制端口
  36. sbit SUO=P1^2;          //模拟锁存信号端口
  37. /*$-_-$_-_$-_-$_-_$-_-$_-_$-_-$_-_$-_-$_-_$-_-$_-_$-_-$_-_$-_-$_-_$-_-$_-_$-_-$_-_$*/

  38. sbit M_A=P3^4;          //行数据扫描信号
  39. sbit M_B=P3^5;          //行数据扫描信号
  40. sbit M_C=P3^6;          //行数据扫描信号
  41. sbit M_D=P3^7;          //行数据扫描信号
  42. sbit M_EN=P1^7;   //行数据扫描信号
  43. /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
  44. unsigned char displayck[]=
  45. {
  46. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  47. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  48. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  49. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  50. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  51. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  52. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  53. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  54. };
  55. unsigned char shuzu8X8[]=
  56. {
  57. 0XBD,0X85,0X85,0XBD,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
  58. 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
  59. 0XA1,0XA1,0XA1,0XBD,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
  60. 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
  61. };

  62. /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
  63. uchar xdata display[8][8];
  64. uchar xdata msd=4;
  65. uint ld=500;
  66. uchar test=0,key1=0,key2=0,key3=0,key4=0;
  67. bit pu;
  68. uchar xsdsq=0;
  69. uchar cd=0,cnt=0,errd_flag=0,read_flag=0,layerr=0,saom=0;
  70. unsigned char IRCOM[7];
  71. /*rank:A,1,2,3,4,I,心,U*/
  72. uchar code table_cha[8][8]=
  73. {
  74. 0x51,0x51,0x51,0x4a,0x4a,0x4a,0x44,0x44,
  75. 0x18,0x1c,0x18,0x18,0x18,0x18,0x18,0x3c,
  76. 0x3c,0x66,0x66,0x30,0x18,0x0c,0x06,0x7e,
  77. 0x3c,0x66,0x60,0x38,0x60,0x60,0x66,0x3c,
  78. 0x30,0x38,0x3c,0x3e,0x36,0x7e,0x30,0x30,
  79. 0x3c,0x3c,0x18,0x18,0x18,0x18,0x3c,0x3c,
  80. 0x66,0xff,0xff,0xff,0x7e,0x3c,0x18,0x18,
  81. 0x66,0x66,0x66,0x66,0x66,0x66,0x7e,0x3c,
  82. };
  83. /*the "ideasoft"*/
  84. /*rank:A,1,2,3,4,I,心,U*////开机的LOGO显示字符字模提取PLC2002
  85. uchar code table_cha_sj[8][8]=
  86. {
  87. 0x08,0x08,0x78,0x08,0x08,0x08,0x08,0xFF,/*"上",0*/
  88. 0x18,0x04,0x22,0x24,0xFF,0x24,0x24,0x24,/*"升",0*/
  89. 0x78,0x49,0xCE,0x00,0xFF,0x84,0x86,0xFD,/*"沿",0*/
  90. 0x3C,0x42,0xA5,0xDB,0x81,0x99,0x42,0x3C,/*"笑脸",0*/
  91. 0x3C,0x42,0xA5,0xDB,0x81,0x99,0x42,0x3C,/*"笑脸",0*/
  92. 0x08,0x2A,0x2A,0xFF,0x14,0x14,0x96,0x71,/*"光",0*/
  93. 0x08,0x7F,0x22,0x22,0x24,0x14,0x14,0xFF,/*"立",0*/
  94. 0x08,0xFF,0x04,0x7C,0x44,0x44,0x42,0x31,/*"方",0*/
  95. };
  96. /*rank:3,D,C,L,U,E,F,F,T*///开机的LOGO显示字符字模提取PLC2002
  97. uchar code table_cha_cu[9][8]=
  98. {
  99. 0x7E,0x40,0x40,0x7C,0x7C,0x40,0x40,0x7E,/*"3",0*/
  100. 0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,/*"D",0*/
  101. 0x00,0x3C,0x02,0x02,0x02,0x02,0x02,0x3C,/*"C",0*/
  102. 0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x7C,/*"L",0*/
  103. 0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,/*"U",0*/
  104. 0x00,0x7E,0x02,0x02,0x7E,0x02,0x02,0x7E,/*"E",0*/
  105. 0x78,0x04,0x04,0x04,0x7C,0x04,0x04,0x04,/*"F",0*/
  106. 0x78,0x04,0x04,0x04,0x7C,0x04,0x04,0x04,/*"F",0*/
  107. 0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,/*"T",0*/
  108. };
  109. uchar code table_id[40]=
  110. {
  111. 0x81,0xff,0x81,0x00,0xff,0x81,0x81,0x7e,
  112. 0x00,0xff,0x89,0x89,0x00,0xf8,0x27,0x27,
  113. 0xf8,0x00,0x8f,0x89,0x89,0xf9,0x00,0xff,
  114. 0x81,0x81,0xff,0x00,0xff,0x09,0x09,0x09,
  115. 0x01,0x00,0x01,0x01,0xff,0x01,0x01,0x00,
  116. };
  117. /*the "ideasoft"*///侧面移动显示字符取摸plc2002
  118. uchar code table_yd[120]={
  119. 0x08,0x08,0x78,0x08,0x08,0x08,0x08,0xFF,/*"上",0*/
  120. 0x18,0x04,0x22,0x24,0xFF,0x24,0x24,0x24,/*"升",0*/
  121. 0x78,0x49,0xCE,0x00,0xFF,0x84,0x86,0xFD,/*"沿",0*/
  122. 0x7E,0x2A,0x2A,0xFF,0xAA,0xAA,0xBE,0x40,/*"电",0*/
  123. 0x09,0x49,0x89,0xFD,0x0B,0x0B,0x09,0x08,/*"子",0*/
  124. 0x00,0x7C,0x92,0x92,0x92,0x92,0x7C,0x00,/*"8",0*/
  125. 0x00,0x42,0x24,0x18,0x18,0x24,0x42,0x00,/*"x",0*/
  126. 0x00,0x7C,0x92,0x92,0x92,0x92,0x7C,0x00,/*"8",0*/
  127. 0x00,0x42,0x24,0x18,0x18,0x24,0x42,0x00,/*"x",0*/
  128. 0x00,0x7C,0x92,0x92,0x92,0x92,0x7C,0x00,/*"8",0*/
  129. 0x88,0x4E,0x78,0x0F,0xF8,0x8E,0x88,0x48,/*"光",0*/
  130. 0x82,0x8E,0xF2,0x83,0xE2,0x9E,0x82,0x80,/*"立",0*/
  131. 0x82,0x42,0x3E,0x0B,0x8A,0x8A,0x7A,0x02,/*"方",0*/
  132. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  133. };
  134. /*railway*/
  135. uchar code dat[128]=
  136. {
  137. 0x00,0x20,0x40,0x60,0x80,0xa0,0xc0,0xe0,
  138. 0xe4,0xe8,0xec,0xf0,0xf4,0xf8,0xfc,0xdc,
  139. 0xbc,0x9c,0x7c,0x5c,0x3c,0x1c,0x18,0x14,
  140. 0x10,0x0c,0x08,0x04,0x25,0x45,0x65,0x85,
  141. 0xa5,0xc5,0xc9,0xcd,0xd1,0xd5,0xd9,0xb9,
  142. 0x99,0x79,0x59,0x39,0x35,0x31,0x2d,0x29,
  143. 0x4a,0x6a,0x8a,0xaa,0xae,0xb2,0xb6,0x96,
  144. 0x76,0x56,0x52,0x4e,0x6f,0x8f,0x93,0x73,
  145. 0x6f,0x8f,0x93,0x73,0x4a,0x6a,0x8a,0xaa,
  146. 0xae,0xb2,0xb6,0x96,0x76,0x56,0x52,0x4e,
  147. 0x25,0x45,0x65,0x85,0xa5,0xc5,0xc9,0xcd,
  148. 0xd1,0xd5,0xd9,0xb9,0x99,0x79,0x59,0x39,
  149. 0x35,0x31,0x2d,0x29,0x00,0x20,0x40,0x60,
  150. 0x80,0xa0,0xc0,0xe0,0xe4,0xe8,0xec,0xf0,
  151. 0xf4,0xf8,0xfc,0xdc,0xbc,0x9c,0x7c,0x5c,
  152. 0x3c,0x1c,0x18,0x14,0x10,0x0c,0x08,0x04,
  153. };
  154. /*railway 2*/
  155. uchar code dat2[28]=
  156. {
  157. 0x00,0x20,0x40,0x60,0x80,0xa0,0xc0,0xe0,
  158. 0xe4,0xe8,0xec,0xf0,0xf4,0xf8,0xfc,0xdc,
  159. 0xbc,0x9c,0x7c,0x5c,0x3c,0x1c,0x18,0x14,
  160. 0x10,0x0c,0x08,0x04,
  161. };
  162. /*railway 3*/
  163. uchar code dat3[24]=
  164. {
  165. 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x16,
  166. 0x26,0x36,0x46,0x56,0x66,0x65,0x64,0x63,
  167. 0x62,0x61,0x60,0x50,0x40,0x30,0x20,0x10,
  168. };
  169. /*3p char*/
  170. uchar code table_3p[3][8]=
  171. {
  172. 0xff,0x89,0xf5,0x93,0x93,0xf5,0x89,0xff,
  173. 0x0e,0x1f,0x3f,0x7e,0x7e,0x3f,0x1f,0x0e,
  174. 0x18,0x3c,0x7e,0xff,0x18,0x18,0x18,0x18,
  175. };
  176. /*3p char*///飘雪打字显示字符取摸plc2002
  177. uchar code table_3p_zf[11][8]={
  178. 0x88,0x4E,0x78,0x0F,0xF8,0x8E,0x88,0x48,/*"光",0*/
  179. 0x82,0x8E,0xF2,0x83,0xE2,0x9E,0x82,0x80,/*"立",0*/
  180. 0x82,0x42,0x3E,0x0B,0x8A,0x8A,0x7A,0x02,/*"方",0*/
  181. 0x00,0x7C,0x92,0x92,0x92,0x92,0x7C,0x00,/*"8",0*/
  182. 0x00,0x42,0x24,0x18,0x18,0x24,0x42,0x00,/*"x",0*/
  183. 0x00,0x7C,0x92,0x92,0x92,0x92,0x7C,0x00,/*"8",0*/
  184. 0x00,0x42,0x24,0x18,0x18,0x24,0x42,0x00,/*"x",0*/
  185. 0x00,0x7C,0x92,0x92,0x92,0x92,0x7C,0x00,/*"8",0*/
  186. 0x00,0x00,0xC3,0xFF,0xFF,0xC3,0x00,0x00,//i
  187. 0x0e,0x1f,0x3f,0x7e,0x7e,0x3f,0x1f,0x0e,
  188. 0x00,0x7F,0xFF,0x80,0x80,0xFF,0x7F,0x00,//u
  189. };
  190. unsigned int voivol(unsigned int n);
  191. void sendbyte(unsigned int num1,unsigned int num2,unsigned int num3,unsigned int num4);
  192. void fvb();
  193. void sendbyteck(unsigned int num1,unsigned int num2,unsigned int num3,unsigned int num4);
  194. /*initializtion
  195. That is to initialize the program .
  196. It is write to set the timer in c52 mcu.
  197. So the program can renovate the led_3d_cube in fixed time use the interrupt function.*/
  198. /*##########################################################################################*/
  199. uchar code number[]={//数字,滚动字幕使用,从上至下
  200.         0x00,0x40,0x40,0x40,0x40,0x40,0x7E,0x00,/*"L",0*/
  201.         0x00,0x7E,0x40,0x7E,0x40,0x40,0x7E,0x00,/*"E",1*/
  202.         0x00,0x7C,0x46,0x42,0x42,0x46,0x7C,0x00,/*"D",2*/
  203.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",3*/
  204.         0x00,0x3C,0x62,0x40,0x40,0x61,0x3E,0x00,/*"C",4*/
  205.         0x00,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,/*"U",5*/
  206.         0x00,0x7C,0x42,0x7C,0x42,0x41,0x7E,0x00,/*"B",6*/
  207.         0x00,0x7E,0x40,0x7E,0x40,0x40,0x7E,0x00,/*"E",7*/
  208.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",8*/
  209.         0x00,0x42,0x42,0x7E,0x42,0x42,0x42,0x00,/*"H",9*/
  210.         0x00,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,/*"U",10*/
  211.         0x00,0xC2,0x64,0x38,0x10,0x10,0x10,0x00,/*"Y",11*/
  212.         0x00,0x18,0x18,0x24,0x7E,0x42,0x81,0x00,/*"A",12*/
  213.         0x00,0x62,0x62,0x52,0x4A,0x46,0x46,0x00,/*"N",13*/
  214.         0x00,0x3C,0x62,0x40,0x4E,0x62,0x3E,0x00,/*"G",14*/
  215.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",15*/
  216.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",16*/
  217.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",17*/
  218.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"Y",18*/
  219.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",19*/
  220.         0x00,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,/*"H",20*/
  221.         0x00,0x44,0x44,0x44,0x44,0x44,0x38,0x00,/*"U",21*/
  222.         0x00,0x82,0x44,0x28,0x10,0x10,0x10,0x00,/*"Y",22*/
复制代码

上图资料下载: 888光立方资料.7z (8.05 MB, 下载次数: 24)

评分

参与人数 1黑币 +40 收起 理由
admin + 40 共享资料的黑币奖励!

查看全部评分

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

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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