找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3703|回复: 1
收起左侧

51单片机控制8个16*16点阵屏显示汉字不能同时实现

[复制链接]
ID:211952 发表于 2017-6-16 20:16 | 显示全部楼层 |阅读模式
#include<reg52.h>
sbit R1=P0^0;
sbit R2=P2^0;
sbit R3=P0^1;
sbit R4=P2^1;
sbit R5=P0^2;
sbit R6=P2^2;
sbit R7=P0^3;
sbit R8=P2^3;

//数据输入
sbit CLK=P3^0;
sbit STB=P3^1;
char code table1[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/
0x04,0x09,0x8A,0x08,0x42,0x08,0x42,0x08,0xA2,0xFF,0x22,0x08,0x3E,0x49,0x22,0x7F,
0x22,0x41,0x22,0x7F,0x3E,0x41,0x22,0x7F,0x22,0x08,0xA2,0xFF,0x3E,0x08,0x00,0x08,/*"朝",0*/
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0xFE,0xFF,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x3F,0xF8,0x00,0x10,0x00,/*"千",1*/
0x08,0x40,0x14,0x40,0x04,0x40,0x04,0x42,0x14,0x51,0x94,0x4A,0xA4,0x4A,0x44,0x44,
0x44,0x44,0x44,0x44,0xFC,0x7F,0x40,0x04,0x40,0x04,0x40,0x04,0xFE,0xFF,0x00,0x00,/*"两",2*/
0x00,0x10,0xFE,0x13,0x20,0x10,0x20,0x50,0x20,0xF0,0x20,0x1C,0xFC,0x11,0x00,0x10,
0x02,0xFF,0x84,0x90,0x48,0x50,0x30,0x40,0x10,0xFC,0x08,0x20,0xFC,0x21,0x00,0x20,/*"轻",3*/ };
char code table2[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/
0x20,0x00,0x20,0x44,0x20,0x7C,0x20,0x44,0x20,0x44,0xFC,0x45,0x20,0x44,0x20,0x7C,
0xFE,0x11,0x50,0x10,0x88,0xFC,0x00,0x10,0xFC,0x11,0x20,0x70,0x20,0x1C,0x40,0x08,/*"辞",0*/
0x00,0x00,0xFE,0xFF,0x00,0x01,0x00,0x01,0x00,0x01,0xF8,0x3F,0x00,0x01,0x00,0x01,
0xF8,0x3F,0x08,0x21,0x08,0x21,0xF8,0x3F,0x08,0x21,0x08,0x21,0xF8,0x3F,0x00,0x00,/*"里",1*/
0x80,0x00,0x80,0x80,0x80,0x40,0x80,0x40,0x80,0x20,0xFE,0x3F,0x80,0x20,0x80,0x20,
0xF8,0x2F,0x00,0x20,0xFC,0x3F,0x00,0x00,0xF8,0x3F,0x08,0x21,0x08,0x21,0x00,0x01,/*"岸",2*/
0x20,0x80,0x50,0x40,0x10,0x20,0x10,0x20,0x10,0x11,0x10,0x11,0x10,0x12,0x10,0x10,
0xFE,0xFF,0x10,0x11,0x10,0x11,0x10,0x12,0x10,0x10,0xF0,0x1F,0x00,0x04,0x00,0x02,/*"舟",3*/};
char code table3[]={
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0xFE,0xFF,0x00,0x01,0x00,0x01,
0xF0,0x1F,0x10,0x10,0x10,0x10,0xF0,0x1F,0x10,0x10,0x10,0x10,0xF0,0x1F,0x00,0x00,/*"早",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/
0x08,0x20,0xF8,0x3F,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0xF8,0x3F,
0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0xF8,0x3F,0x00,0x04,0x00,0x02,0x00,0x01,/*"白",1*/
0x00,0x00,0x00,0x20,0xFE,0x2F,0x40,0x20,0x40,0x20,0x40,0xE0,0x40,0x10,0x40,0x10,
0x40,0x08,0x40,0x48,0x40,0x40,0x40,0x80,0x40,0x10,0xFC,0x17,0x00,0x20,0x00,0x00,/*"江",2*/
0x00,0x41,0x86,0xA1,0x48,0x1D,0x10,0x13,0x28,0x11,0xA4,0x90,0xF8,0x53,0x08,0x32,
0x08,0x12,0xF8,0x13,0x00,0x90,0xFE,0x57,0x40,0x20,0xF8,0x53,0x40,0x90,0x40,0x00,/*"猿",3*/
0x00,0x00,0xFC,0x1F,0x04,0x20,0x04,0x20,0x04,0x20,0x00,0x20,0x00,0x20,0x00,0x20,
0xF0,0x3F,0x10,0x20,0x10,0x20,0x10,0x00,0x10,0x00,0x10,0x00,0xF0,0x3F,0x00,0x00,/*"已",4*/};
char code table4[]={
0x06,0x1C,0x18,0x03,0xA0,0x40,0x40,0x20,0xA0,0x10,0x10,0x11,0x08,0x09,0x08,0x0A,
0xF8,0x07,0x00,0x04,0x00,0x02,0xFC,0x3F,0x00,0x22,0x08,0x11,0x10,0x11,0x00,0x01,/*"发",0*/
0x00,0x02,0x00,0x05,0x00,0x01,0x00,0x01,0xFE,0xFF,0x80,0x00,0x40,0x00,0xE0,0x0F,
0x06,0xC1,0x18,0x31,0x20,0x09,0x40,0x05,0x80,0x03,0xFC,0x7F,0x00,0x01,0x00,0x01,/*"李",1*/
0x00,0x01,0x00,0x01,0x20,0x11,0x50,0x11,0x10,0x11,0x10,0x11,0xF0,0x1F,0x04,0x81,
0x02,0x41,0xFE,0x7F,0x40,0x04,0x20,0x08,0x00,0x00,0xF8,0x3F,0x00,0x01,0x00,0x02,/*"帝",2*/
0x06,0x46,0x88,0x41,0x50,0x40,0x20,0x40,0x50,0x52,0x88,0x69,0xF8,0x48,0x42,0x4A,
0x44,0x49,0x88,0x50,0xFE,0x63,0x20,0x50,0x20,0x50,0xFC,0x49,0x20,0x78,0x20,0x00,/*"陵",3*/
0x00,0x80,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x20,0xF8,0x3F,0x08,0x21,
0x08,0x21,0xF8,0x3F,0x00,0x00,0xFC,0x7F,0x00,0x01,0xFE,0xFF,0x00,0x01,0x00,0x01,/*"声",4*/
0x00,0x00,0xFE,0x47,0x00,0x28,0x20,0x10,0x50,0x10,0x10,0x10,0x10,0x10,0x10,0x11,
0x10,0x11,0x10,0xF2,0x10,0x00,0x10,0x00,0xFE,0x17,0x10,0x10,0x10,0x20,0x10,0x00,/*"过",5*/};
char code table5[]={
0x08,0x20,0xF8,0x3F,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0xF8,0x3F,
0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0xF8,0x3F,0x00,0x04,0x00,0x02,0x00,0x01,/*"白",0*/
0x08,0x20,0xF8,0x3F,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0xF8,0x3F,
0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0xF8,0x3F,0x00,0x04,0x00,0x02,0x00,0x01,/*"白",1*/
0x60,0x04,0x10,0x84,0x08,0x44,0x84,0x24,0x02,0x15,0x22,0x16,0x10,0x0C,0x88,0x7F,
0x04,0x04,0x02,0x20,0x22,0x25,0x90,0x44,0x88,0x08,0x04,0x78,0x84,0x07,0x00,0x01,/*"彩",2*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFE,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"一",3*/
0x20,0x00,0x20,0x00,0x28,0x01,0x34,0x49,0x24,0x79,0x24,0x49,0xFC,0x49,0x24,0x4C,
0x22,0x4A,0xFE,0x4B,0x50,0x48,0x88,0x48,0x00,0x48,0xFC,0x79,0x20,0x00,0x40,0x00,/*"啼",4*/
0x40,0x80,0xA0,0x40,0x10,0x20,0x10,0x10,0x10,0x10,0x10,0x08,0x10,0x08,0x10,0x04,
0x10,0x04,0xF0,0x07,0x00,0x04,0x00,0x04,0x00,0x04,0xFE,0xFF,0x00,0x00,0x00,0x00,/*"万",5*/};
char code table6[]={
0x00,0x01,0x00,0x01,0x20,0x11,0x50,0x11,0x10,0x11,0x10,0x11,0xF0,0x1F,0x04,0x81,
0x02,0x41,0xFE,0x7F,0x40,0x04,0x20,0x08,0x00,0x00,0xF8,0x3F,0x00,0x01,0x00,0x02,/*"帝",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/
0x08,0x00,0x08,0x20,0xF8,0x7F,0x10,0x20,0x20,0x10,0x40,0x08,0x00,0x04,0x00,0x04,
0x00,0x02,0xFE,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x3F,0x00,0x00,/*"云",1*/
0x10,0x10,0xF0,0x1F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0xF0,0x1F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xF0,0x1F,0x00,0x00,/*"日",2*/
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x81,0x04,0x41,0x04,0x21,0x08,0x11,0x10,0x09,
0x20,0x05,0x40,0x03,0x00,0x01,0x00,0x01,0x80,0x00,0x80,0x00,0xFC,0x7F,0x00,0x00,/*"不",3*/
0x00,0x00,0xFE,0xFF,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF0,0x1F,0x10,0x11,0xF0,0x1F,
0x10,0x11,0xF0,0x1F,0x00,0x01,0xFE,0xFF,0x00,0x01,0x00,0x3F,0xF8,0x00,0x10,0x00,/*"重",4*/};
char code table7[]={
0x82,0x10,0x46,0x08,0x2A,0x49,0x92,0xE6,0x90,0x3C,0xA8,0x24,0xA8,0x24,0xA4,0x24,
0xA4,0x27,0x24,0x24,0x20,0xFC,0x20,0x24,0xFE,0x27,0x20,0x20,0x24,0x20,0x28,0x20,/*"城",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/
0x08,0x40,0x14,0x40,0x04,0x40,0xC4,0x47,0x44,0x44,0x44,0x44,0x44,0x44,0xC4,0x47,
0x44,0x44,0x44,0x44,0x44,0x44,0xC4,0x47,0x04,0x40,0x04,0x10,0xFC,0x13,0x00,0x20,/*"间",1*/
0x00,0x00,0xFE,0x47,0x00,0x28,0x40,0x10,0x40,0x10,0x40,0x10,0x44,0x14,0x44,0x12,
0x48,0x11,0xD0,0xF0,0x40,0x00,0x40,0x00,0x20,0x10,0x20,0x10,0xFC,0x23,0x00,0x00,/*"还",2*/
0x00,0x10,0xFE,0x1F,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0xFC,0x97,
0x40,0x50,0x40,0x30,0x40,0x30,0x40,0x10,0xFC,0x17,0x00,0x08,0x40,0x08,0x80,0x08,/*"住",3*/
0x00,0x00,0x08,0x00,0xF8,0x3F,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,
0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,/*"山",4*/};
char code table8[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/
0x00,0x00,0x00,0x20,0x00,0x10,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*",",0*/
0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x24,0x00,0x24,0x00,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"。",1*/
0x00,0x00,0x00,0x20,0x00,0x10,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*",",2*/
0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x24,0x00,0x24,0x00,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"。",3*/};
void delay(int z)
{  int x,y;  for(x=0;x<z;x++)   
for(y=0;y<110;y++); }
voidWriteByte(char dat ) {  
char i;
for(i=0;i<8;i++)  {   dat=dat>>1;

R1=CY;   
CLK=0;   
CLK=1;   } }
void main()
{  int num,move,speed;
while(1)  {   if(++speed>1)//移动速度控制   
{    speed=0;   
move++;   
if(move>512)//是否完成移位一个汉字
move=0;
   }
  for(num=0;num<16;num++)
  {   
  
     
  voidWriteByte (table[2*num+move*2]);  
  voidWriteByte(table[2*num+1+move*2]);  
           
  voidWriteByte (table[2*num+move*2]);  
  voidWriteByte(table[2*num+1+move*2]);
         
  voidWriteByte (table[2*num+move*2]);  
  voidWriteByte(table[2*num+1+move*2]);
        
   voidWriteByte (table[2*num+move*2]);  
  voidWriteByte(table[2*num+1+move*2]);
      
   voidWriteByte(table[2*num+move*2]);  
  voidWriteByte(table[2*num+1+move*2]);
         
  voidWriteByte (table[2*num+move*2]);  
  voidWriteByte(table[2*num+1+move*2]);
            P1=num;
  voidWriteByte (table[2*num+move*2]);  
  voidWriteByte(table[2*num+1+move*2]);
        
  voidWriteByte (table[2*num+move*2]);  
  voidWriteByte(table[2*num+1+move*2]);   
        
STB=1;   
STB=0;   
delay(1);   
}
}
}这是程序每次单独显示可以一起显示就不行了

回复

使用道具 举报

ID:96682 发表于 2017-6-17 00:06 | 显示全部楼层
LZ,这源代码与你的期望要求本来就不对口嘛
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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