AMPIRE12864液晶屏显示汉字

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
0x02,0x42,0x42,0x23,0x22,0x12,0x0A,0x07,0x0A,0x12,0x22,0x62,0xC3,0x42,0x02,0x00,
/*--文字:学--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x30,0x10,0x12,0x5C,0x54,0x50,0x51,0x5E,0xD4,0x50,0x18,0x57,0x32,0x10,0x00,
int i;//page页其实就是行,是行计数器页指针共九位计数器,高三位为X,低六位为Y
mun=mun*32;
pianxuan(screen) ;//片选看哪个段
write_c(0x40+(lie*16));//一个汉字占用两个字节
write_c(0xb8+(page*2)); //一个字节显示
for (i=0;i<16;i++)
0x22,0x22,0x12,0x12,0x0A,0xFF,0x42,0x22,0x06,0x0B,0x12,0x2A,0x66,0xC2,0x42,0x00,
/*--文字:樊--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x80,0x48,0x28,0xFF,0x28,0x02,0xAC,0x44,0xAA,0x00,0x48,0x28,0xFF,0x28,0x48,0x00,
0xFF,0x00,0x02,0x04,0x83,0x41,0x31,0x0F,0x01,0x01,0x7F,0x81,0x81,0x81,0xF1,0x00,
};
void xunhuan (uint x)
{
int y,z;
for(y=x;y>0;y--)
for (z=120;z>0;z--);
}
void write_c(uchar c)//写指令端
while(1);
}
在protues中的Βιβλιοθήκη Baidu真原理图,
真实情况下的仿真效果
0x00,0xFF,0x40,0x48,0x48,0x48,0x48,0x4F,0x48,0x49,0x4E,0x48,0x40,0xFF,0x00,0x00,
/*--文字:湖--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x10,0x21,0x86,0x60,0x90,0x90,0xFF,0x90,0x90,0x00,0xFE,0x92,0x92,0xFE,0x00,0x00,
{
write_d(a[mun++]);
}
write_c(0x40+(lie*16));
write_c(0xb8+(page*2)+1);
for (i=0;i<16;i++)
{
write_d(a[mun++]);
}
}
void LCD_init()
{
write_c(0x3f);//显示开启
write_c(0xc0); //显示起始行,从第一位开始,从0到63
{
LCD_RW=0;
LCD_RS=0;
LCD_EN=1;
P1=c;
LCD_EN=0;
xunhuan(1);
LCD_EN=1;
//xunhuan(5);
}
void write_d(uchar d)//写数据
{
LCD_RW=0;
LCD_RS=1;
LCD_EN=1;
P1=d;
LCD_EN=0;
xunhuan(1);
sbit CS1=P2^1;
sbit CS2=P2^2;
uchar code a[]={
/*--文字:中--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0xFC,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0x08,0xFC,0x08,0x00,0x00,
0x00,0x00,0x07,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x02,0x02,0x07,0x00,0x00,0x00,
/*--文字:国--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0xFE,0x02,0x0A,0x8A,0x8A,0x8A,0xFA,0x8A,0x8A,0x8A,0x0A,0x02,0xFE,0x00,0x00,
for(y=0;y<64;y++)
{
write_d(0x00);//选择全部清屏
}
}
}
/*
LCD显示汉字字库函数
*/
void lcd_display_hanzi(uchar screen,uchar page,uchar lie,uint mun)
{//screen:选择屏幕参数,page:选择页参数0-3,lie列参数0-3,mun:显示第几个汉字的参数
0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0xFF,0x00,0x00,0x10,0x20,0x1F,0x00,0x00,0x00,
/*--文字:襄--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x02,0xA2,0xAE,0xAA,0xFA,0xAE,0xA3,0xA2,0xFE,0xAA,0xAA,0xAE,0x22,0x02,0x00,
CS2=1;
break;
}
}
void qinping(screen)//清屏,从第一行第一列开始
{
uint x,y;//页的设置位
pianxuan(screen);//选择哪个清屏
for(x=0xb8;x<0xc0;x++)
{
write_c(x);//页初始值为0XB8到0xc0共八页
write_c(0x40);//列的初始地址为0x40,共64列
0x10,0x30,0x18,0x08,0x04,0x7F,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x40,0x78,0x00,
/*--文字:省--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x10,0x90,0x88,0x86,0xC0,0xC0,0xBF,0xA0,0x90,0x90,0x8A,0x84,0x18,0x00,0x00,
0x00,0xFF,0x04,0x08,0x04,0x03,0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,
/*--文字:市--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x04,0x04,0x04,0xE4,0x24,0x24,0x25,0xFE,0x24,0x24,0x24,0x24,0xE4,0x04,0x04,0x00,
write_c(0xb8);//设置页得地址从0到7
write_c(0x40); //设置列的地址,从第一位开始,从0到63
}
void main()
{
LCD_init();
qinping(0);
lcd_display_hanzi(0,0,0,0);//LCD显示汉字
lcd_display_hanzi(0,0,1,1);//LCD显示汉字
#include <reg52.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit LCD_RS=P3^5;//数据和命令端
sbit LCD_EN=P3^4;//使能端
sbit LCD_RW=P3^3;
0x00,0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00,
/*--文字:院--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0xFE,0x02,0x32,0x4A,0x86,0x0C,0x24,0x24,0x25,0x26,0x24,0x24,0x24,0x0C,0x04,0x00,
0x04,0xFC,0x03,0x00,0x1F,0x10,0x10,0x90,0x5F,0x30,0x0F,0x40,0x80,0x7F,0x00,0x00,
/*--文字:北--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x20,0x20,0x20,0x20,0xFF,0x00,0x00,0x00,0xFF,0x40,0x20,0x30,0x18,0x10,0x00,
0x01,0x01,0x00,0x00,0xFF,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0xFF,0x00,0x00,0x00,
/*--文字:襄--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x02,0xA2,0xAE,0xAA,0xFA,0xAE,0xA3,0xA2,0xFE,0xAA,0xAA,0xAE,0x22,0x02,0x00,
LCD_EN=1;
//xunhuan(5);
}
void pianxuan(screen) //片选
{
switch(screen)
{
case 0:
CS1=0;
CS2=0;
break;
case 1:
CS1=1;
CS2=0;
break;
case 2:
CS1=0;
CS2=1;
break;
case 3:
CS1=1;
lcd_display_hanzi(1,0,3,7);//LCD显示汉字
lcd_display_hanzi(2,1,0,8);//LCD显示汉字
lcd_display_hanzi(2,1,1,9);//LCD显示汉字
lcd_display_hanzi(2,1,2,10);//LCD显示汉字
lcd_display_hanzi(2,1,3,11);//LCD显示汉字
lcd_display_hanzi(0,0,2,2);//LCD显示汉字
lcd_display_hanzi(0,0,3,3);//LCD显示汉字
lcd_display_hanzi(1,0,0,4);//LCD显示汉字
lcd_display_hanzi(1,0,1,5);//LCD显示汉字
lcd_display_hanzi(1,0,2,6);//LCD显示汉字
0x22,0x22,0x12,0x12,0x0A,0xFF,0x42,0x22,0x06,0x0B,0x12,0x2A,0x66,0xC2,0x42,0x00,
/*--文字:阳--*/
/*--宋体12;此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0xFE,0x02,0x22,0x5A,0x86,0x00,0xFE,0x42,0x42,0x42,0x42,0x42,0xFE,0x00,0x00,
相关文档
最新文档