6个16*16的点阵 显示6个汉字 仿真原理图如下(proteus仿真工程文件可到本帖附件中下载)
单片机源程序如下:
- #include<AT89X52.H>
- sbit ST=P3^5;
- sbit E1=P3^4;
- sbit MR=P3^7;
- char cashe[12];
- char code wd[12][16]={
- {0xFF,0xC0,0xFE,0xFE,0xFE,0xFE,0x80,0xFE,0xFD,0xFD,0xFB,0xF7,0xEF,0xDF,0x3F,0xFF},
- {0xFF,0x03,0xFF,0xFF,0xFF,0xFF,0x01,0x7F,0x7F,0x7F,0x7F,0x7F,0x7D,0x7D,0x81,0xFF},/*"无",0*/
- /* (16 X 16 , 宋体 )*/
- {0xDF,0xDF,0xDF,0xCF,0x57,0x58,0x5F,0xDF,0xDE,0xDE,0xDE,0xDD,0xDD,0xDB,0xDB,0xD7},
- {0x7F,0x6F,0x73,0x77,0x7F,0x01,0x5F,0x5F,0xDF,0xDF,0xDF,0xDF,0xDD,0xDD,0xE1,0xFF},/*"忧",1*/
- /* (16 X 16 , 宋体 )*/
- {0xFE,0xFE,0xFE,0xC0,0xDE,0xDE,0xC0,0xDE,0xDE,0xDE,0xC0,0xDE,0xFE,0xFE,0xFF,0xFF},
- {0xFF,0xFF,0xFF,0x07,0xF7,0xF7,0x07,0xF7,0xF7,0xF7,0x07,0xF7,0xFD,0xFD,0x01,0xFF},/*"电",2*/
- /* (16 X 16 , 宋体 )*/
- {0xFF,0xC0,0xFF,0xFF,0xFF,0xFE,0xFE,0xFE,0x00,0xFE,0xFE,0xFE,0xFE,0xFE,0xFA,0xFD},
- {0xFF,0x0F,0xDF,0xBF,0x7F,0xFF,0xFF,0xFB,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},/*"子",3*/
- /* (16 X 16 , 宋体 )*/
- {0xFF,0x83,0xBB,0xAB,0xAA,0xAA,0xA9,0xAB,0xAB,0xAA,0xEE,0xD7,0xDB,0xBB,0x7F,0xFF},
- {0x7F,0x3F,0x7F,0x01,0xFD,0xFD,0xBD,0xBD,0x5D,0xED,0x05,0xED,0xFD,0xFD,0xEB,0xF7},/*"购",4*/
- /* (16 X 16 , 宋体 )*/
- {0xEF,0xEF,0xAF,0xAE,0x82,0xAD,0x6B,0xEB,0xE6,0xCD,0x2B,0xEF,0xEE,0xED,0xEB,0xFF},
- {0x7F,0x7F,0x7F,0x03,0xAB,0xAB,0x6B,0x6B,0xDB,0xDB,0xBB,0x7B,0xFB,0xFB,0xD7,0xEF},/*"物",5*/
- /* (16 X 16 , 宋体 )*/
- };
- void del(int i)//============================//延时程序
- {while(i--);}
- aline() ////=======================发送一行的显示程序
- {
- char i=0;
- TI=0;
- for(i=0;i<12;i++)
- {SBUF=cashe[i];while(~TI);TI=0;} //将缓存中的信息转存入595的存储器中,到此不显示
- }
- main()
- {
- int m=0,n=0;
- TI=0;
- SM0=0;
- SM1=0;
- E1=0;
- while(1)
- for(m=0;m<16;m++) //共有16行 循环16次显示这16行 串行的595送出行的数据
- { //由74hc154选中要显示的行
- for(n=0;n<12;n++) //这个for循环用来向缓存数组中装载要显示的内容
- {cashe[11-n]=wd[n][m];} //将第m个字的第n行信息装载 ,因为595串接 数据第一个进去的会在最后一个595中,最后进去的会在第一个595中
- aline(); //将缓存中的一行信息载入595缓存中
- ST=0;ST=1; //595产生上升沿 输出595锁存的数据
- P2=m; //选中要显示的行输出数据
-
- del(100);//延时一段时间,以造成视觉暂存效应
- }
- }
复制代码
所有资料51hei提供下载:
四字点阵屏.rar
(837.39 KB, 下载次数: 35)
|