找回密码
 立即注册

QQ登录

只需一步,快速开始

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

4个74hc573驱动16*16点阵 单片机源码及proteus仿真

[复制链接]
跳转到指定楼层
楼主
给51黑电子论坛的朋友们们分享一个51单片机驱动16*16点阵的例子,用了4个74hc573驱动芯片,电路图如下:

仿真工程文件及源程序下载:
16x16_led点阵.rar (67.38 KB, 下载次数: 64)


源程序:
  1. #include <reg51.h>
  2. #include<intrins.h>
  3. /*  数据端接口定义 */
  4. sbit  sck = P2^0;                 //输入时钟
  5. sbit  row_dat = P2^1;         //行数据时钟
  6. sbit  row_buf_sck = P2^2; //行锁存
  7. //sbit  row_mr = P2^4;          //移位寄存器清零端
  8. //sbit  row_oe = P2^5;        //输出使能
  9. /*  选通端接口定义 */
  10. sbit  col_dat = P2^6;          //列数据时钟
  11. sbit  col_buf_sck = P2^3; //列锁存

  12. unsigned int code sel[16] = {0xff7f,0x7fff,0xffbf,0xbfff,0xffdf,0xdfff,0xffef,0xefff,
  13.                                                          0xfff7,0xf7ff,0xfffb,0xfbff,0xfffd,0xfdff,0xfffe,0xfeff};

  14. unsigned char code hanzi[33][32] =
  15. {
  16. {0x08,0x02,0x08,0x44,0x0F,0xA8,0xF8,0x10,0x08,0x68,0x0F,0x84,0x02,0x02,0x3C,0x42,  
  17. 0x08,0x42,0x08,0x42,0xFF,0xFE,0x08,0x42,0x08,0x42,0x08,0x42,0x00,0x02,0x00,0x00},//姓
  18. {0x00,0x20,0x04,0x20,0x04,0x20,0x08,0x40,0x10,0x7F,0x28,0xC2,0xE6,0xC2,0x21,0x42,  
  19. 0x22,0x42,0x24,0x42,0x28,0x42,0x30,0x42,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00},//名
  20. {0x12,0x22,0x0A,0x22,0x47,0xA4,0x28,0x24,0x00,0x28,0x04,0xB0,0x59,0x20,0x42,0xFF,  
  21. 0x7C,0x20,0x41,0x30,0x40,0xA8,0x7F,0x24,0x00,0x24,0x10,0x22,0x0C,0x22,0x00,0x00},//梁
  22. {0x00,0x01,0x7F,0xE2,0x40,0x0C,0x5F,0xF0,0x40,0x08,0x7F,0xE6,0x00,0x00,0x02,0x00,  
  23. 0x07,0x7F,0x1A,0x42,0xE2,0x42,0x02,0x42,0x0A,0x42,0x06,0x7F,0x03,0x00,0x00,0x00},//贻
  24. {0x00,0x41,0x10,0x42,0x10,0x8C,0x11,0x00,0x12,0x00,0x14,0x08,0x18,0x06,0xFF,0xE0,  
  25. 0x18,0x08,0x14,0x06,0x12,0x00,0x11,0x00,0x10,0x88,0x10,0x47,0x00,0x40,0x00,0x00},//杰
  26. {0x08,0x20,0x08,0x22,0x08,0x41,0xFF,0xFE,0x08,0x80,0x09,0x00,0x00,0x00,0xFC,0xFF,  
  27. 0x12,0x92,0x12,0x92,0x22,0x92,0x22,0x92,0x22,0x92,0x42,0xFF,0x0E,0x00,0x00,0x00},//指
  28. {0x00,0x20,0x00,0x20,0x7E,0x20,0x49,0x20,0x49,0x30,0x49,0x2C,0x49,0x20,0x49,0x20,  
  29. 0x49,0x22,0x49,0x21,0x49,0xFE,0x79,0x20,0x01,0x20,0x07,0x20,0x00,0x20,0x00,0x00},//导
  30. {0x04,0x20,0x25,0x50,0x25,0x92,0x25,0x11,0xFF,0x7E,0x25,0xA0,0x2D,0x20,0x14,0x21,  
  31. 0x21,0x02,0x0E,0x04,0xF1,0xC8,0x10,0x30,0x10,0xCC,0x1F,0x02,0x10,0x01,0x00,0x00},//教
  32. {0x00,0x00,0x3F,0xE1,0x00,0x02,0x00,0x0C,0xFF,0xF0,0x00,0x00,0x40,0x00,0x47,0xF8,  
  33. 0x44,0x00,0x44,0x00,0x7F,0xFF,0x44,0x10,0x44,0x08,0x47,0xF0,0x40,0x00,0x00,0x00},//师
  34. {0x00,0x01,0x00,0x21,0x7C,0x21,0x44,0x42,0x44,0xA2,0x7D,0x92,0x46,0x8C,0x44,0x84,
  35. 0x44,0x88,0x7C,0x90,0x44,0xA0,0x44,0xC0,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//罗
  36. {0x00,0x10,0x00,0x20,0x00,0xC0,0x07,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0xFF,0xFE,  
  37. 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x00,0x70,0x00,0x00},//小
  38. {0x02,0x00,0x22,0x00,0x2A,0x00,0x2A,0xFF,0x2A,0xA8,0x2A,0xA8,0x2A,0xA8,0xFE,0xA8,  
  39. 0x2A,0xA8,0x2A,0xAA,0x2A,0xA9,0x2A,0xFE,0x2A,0x00,0x22,0x00,0x02,0x00,0x00,0x00},//青
  40. {0x20,0x00,0x27,0xFF,0x24,0x00,0x24,0x10,0x26,0x90,0x25,0x90,0x24,0x90,0xFC,0xFE,  
  41. 0x24,0x90,0x25,0x90,0x26,0x90,0x24,0x12,0x24,0x01,0x27,0xFE,0x20,0x00,0x00,0x00},//南
  42. {0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,  
  43. 0x92,0x92,0x92,0x92,0x92,0x92,0xFE,0x92,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00},//昌
  44. {0x04,0x01,0x04,0x01,0x04,0x02,0x04,0x04,0x04,0x08,0x04,0x30,0x04,0xC0,0xFF,0x00,  
  45. 0x04,0xC0,0x04,0x30,0x04,0x08,0x04,0x04,0x04,0x02,0x04,0x01,0x04,0x01,0x00,0x00},//大
  46. {0x02,0x20,0x0C,0x20,0x88,0x20,0x69,0x20,0x09,0x20,0x09,0x22,0x89,0x21,0x69,0x7E,  
  47. 0x09,0x60,0x09,0xA0,0x19,0x20,0x28,0x20,0xC8,0x20,0x0A,0x20,0x0C,0x20,0x00,0x00},//学
  48. {0x24,0x10,0x24,0x60,0x25,0x80,0x7F,0xFF,0xC5,0x00,0x44,0x80,0x00,0x20,0x44,0x20,  
  49. 0x33,0x20,0x00,0x20,0x00,0x20,0xFF,0xFF,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00},//科
  50. {0x02,0x20,0x0C,0x20,0x88,0x20,0x69,0x20,0x09,0x20,0x09,0x22,0x89,0x21,0x69,0x7E,  
  51. 0x09,0x60,0x09,0xA0,0x19,0x20,0x28,0x20,0xC8,0x20,0x0A,0x20,0x0C,0x20,0x00,0x00},//学
  52. {0x08,0x20,0x08,0x22,0x08,0x41,0xFF,0xFE,0x08,0x80,0x09,0x01,0x10,0x01,0x11,0x02,  
  53. 0x11,0xC2,0x11,0x34,0xFF,0x08,0x11,0x14,0x11,0x62,0x11,0x81,0x10,0x01,0x00,0x00},//技
  54. {0x00,0x08,0x08,0x10,0x08,0x20,0x08,0x40,0x08,0x80,0x0B,0x00,0x0C,0x00,0xFF,0xFF,  
  55. 0x0C,0x00,0x0B,0x00,0x48,0x80,0x38,0x40,0x08,0x20,0x08,0x10,0x00,0x08,0x00,0x00},//术
  56. {0x02,0x20,0x0C,0x20,0x88,0x20,0x69,0x20,0x09,0x20,0x09,0x22,0x89,0x21,0x69,0x7E,  
  57. 0x09,0x60,0x09,0xA0,0x19,0x20,0x28,0x20,0xC8,0x20,0x0A,0x20,0x0C,0x20,0x00,0x00},//学
  58. {0x00,0x00,0x7F,0xFF,0x44,0x20,0x5A,0x10,0x61,0xE0,0x08,0x01,0x30,0x82,0x24,0x8C,  
  59. 0x24,0xF0,0xA4,0x80,0x64,0x80,0x24,0xFC,0x24,0x82,0x28,0x82,0x30,0x8E,0x00,0x00},//院
  60. {0x00,0x80,0x01,0x00,0x06,0x00,0x1F,0xFF,0xE0,0x00,0x00,0x00,0x20,0x00,0x24,0x9F,  
  61. 0x24,0x92,0xA4,0x92,0x64,0x92,0x24,0x92,0x24,0x92,0x24,0x9F,0x20,0x00,0x00,0x00,},//信
  62. {0x00,0x02,0x00,0x0C,0x00,0x00,0x3F,0xC0,0x2A,0x9C,0x2A,0x82,0x6A,0x82,0xAA,0xA2,  
  63. 0x2A,0x9A,0x2A,0x82,0x2A,0x82,0x3F,0xCE,0x00,0x00,0x00,0x10,0x00,0x0C,0x00,0x00},//息
  64. {0x02,0x20,0x0C,0x20,0x88,0x20,0x69,0x20,0x09,0x20,0x09,0x22,0x89,0x21,0x69,0x7E,  
  65. 0x09,0x60,0x09,0xA0,0x19,0x20,0x28,0x20,0xC8,0x20,0x0A,0x20,0x0C,0x20,0x00,0x00},//学
  66. {0x24,0x10,0x24,0x60,0x25,0x80,0x7F,0xFF,0xC5,0x00,0x44,0x80,0x00,0x20,0x44,0x20,  
  67. 0x33,0x20,0x00,0x20,0x00,0x20,0xFF,0xFF,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00},//科
  68. {0x02,0x00,0x22,0x00,0x2A,0x7E,0xA6,0x44,0x62,0x44,0x22,0x44,0x26,0x44,0x2A,0x7E,  
  69. 0x22,0x00,0x02,0x00,0x7F,0xFF,0x40,0x10,0x44,0x08,0x5B,0x10,0x60,0xE0,0x00,0x00},//部
  70. {0x00,0x00,0x00,0x00,0x1F,0xF8,0x11,0x10,0x11,0x10,0x11,0x10,0x11,0x10,0xFF,0xFE,  
  71. 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x1F,0xF9,0x00,0x01,0x00,0x0F,0x00,0x00},//电
  72. {0x01,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x02,0x41,0x01,0x47,0xFE,  
  73. 0x45,0x00,0x49,0x00,0x51,0x00,0x61,0x00,0x41,0x00,0x01,0x00,0x01,0x00,0x00,0x00},//子
  74. {0x00,0x80,0x01,0x00,0x06,0x00,0x1F,0xFF,0xE0,0x00,0x00,0x00,0x20,0x00,0x24,0x9F,  
  75. 0x24,0x92,0xA4,0x92,0x64,0x92,0x24,0x92,0x24,0x92,0x24,0x9F,0x20,0x00,0x00,0x00},//信
  76. {0x00,0x02,0x00,0x0C,0x00,0x00,0x3F,0xC0,0x2A,0x9C,0x2A,0x82,0x6A,0x82,0xAA,0xA2,  
  77. 0x2A,0x9A,0x2A,0x82,0x2A,0x82,0x3F,0xCE,0x00,0x00,0x00,0x10,0x00,0x0C,0x00,0x00},//息
  78. {0x00,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x3F,0xFC,  
  79. 0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x00,0x04,0x00,0x00},//工
  80. {0x24,0x10,0x24,0x60,0x25,0x80,0x7F,0xFF,0xC4,0x80,0x44,0x60,0x00,0x02,0x7C,0x92,  
  81. 0x44,0x92,0x44,0x92,0x44,0xFE,0x44,0x92,0x44,0x92,0x7C,0x92,0x00,0x82,0x00,0x00},//程
  82. };


  83. void send_data_row(unsigned int dat);  /*  发送行数据端数据函数  */


  84. void send_data_col(unsigned int dat);  /*  发送列选通端数据函数  */

  85. void display(unsigned char *p);

  86. void delay(unsigned int m);

  87. void main()
  88. {
  89.         unsigned char i,j;
  90. //        row_mr = 1;
  91. //        row_oe = 0;
  92.         while(1)
  93.         {

  94.                 for(i=0;i<33;i++)                        //33个代码
  95.                 {
  96.                         for(j=0;j<15;j++)           //循环显示汉字十遍
  97.                         
  98.                         display(hanzi[i]);           //显示一个汉字
  99.                 }
  100.         }
  101. }

  102. void send_data_row(unsigned int dat)
  103. {
  104.         unsigned char i;
  105.         
  106.         for(i=0;i<16;i++)
  107.         {
  108.                 sck = 0;
  109.                 row_dat = dat&0x8000;                //temp<<=1;
  110.                 dat = dat<<1;                                //ds = CY;
  111.                 sck = 1;
  112.         }
  113.         row_buf_sck = 0;
  114.         _nop_();
  115.         _nop_();
  116.         row_buf_sck = 1;
  117. }

  118. void send_data_col(unsigned int dat)
  119. {
  120.         unsigned char i;        
  121.         for(i=0;i<16;i++)
  122.         {
  123.                 sck = 0;
  124.                 col_dat = dat&0x8000;
  125.                 dat = dat<<1;
  126.                 sck = 1;
  127.         }
  128.         col_buf_sck = 0;
  129.         _nop_();
  130.         _nop_();
  131.         col_buf_sck = 1;
  132. }

  133. void delay(unsigned int m)
  134. {
  135.         unsigned char i;
  136.         for(;m>0;m--)
  137.         {
  138.                 for(i=0;i<124;i++)
  139.                 {;}
  140.         }
  141. }

  142. void display(unsigned char *p)         
  143. {
  144.         unsigned char i;
  145. //        unsigned int temp;
  146.         for(i=0;i<32;i++)
  147.         {
  148.                 if(i<16)
  149.                 {
  150.                         send_data_row(0x0000);
  151.                 //        temp = sel[i]|0xff00;
  152.                         send_data_col(sel[i]);
  153.                         send_data_row(*p);
  154.                         p++;
  155.                         delay(2);
  156.                 }
  157.                 else
  158.                 {
  159.                         send_data_row(0x0000);
  160.                 //        temp = (sel[i]<<8)|0x00ff;
  161.                         send_data_col(sel[i-16]);
  162.                         send_data_row((*p)<<8);
  163.                         p++;
  164.                         delay(2);
  165.                 }                        
  166.         }
  167. }
复制代码

评分

参与人数 2黑币 +6 收起 理由
莫笑丶良 + 1 说好的573???假
那一天下 + 5 很给力!

查看全部评分

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

使用道具 举报

沙发
ID:266190 发表于 2017-12-24 21:03 | 只看该作者
这个74HC595驱动LED点阵呀!并不是74HC573
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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