proteus仿真液晶显示芯片资料
我现在在学mcs-51,在proteus上仿真,关于液晶显示屏这块,在网上找不到关于像LM3229之类显示屏的使用手册,就是关于引脚的使用,什么特殊寄存器之类的介绍,哪位有能给我发一下吗?在此感谢了!!859494254@qq.com
[解决办法]
上面我说道3229是128x64 其实它也是240x128的
lcd的指令操作大同小异的 随便参考一个都可以 就是写指令 写数据 读标志和读数据一般不用的
指令名称 控制状态 指令代码 参 运行时间
CD RD RW D7 D6 D5 D4 D3 D2 D1 D0 数
读状态字 1 0 1 S7 S6 S5 S4 S3 S2 S1 S0 无 -
地址指针设置 1 1 0 0 0 1 0 0 N2 N1 N0 2 状态检测
显示区域设置 1 1 0 0 1 0 0 0 0 N1 N0 2 状态检测
显示方式设置 1 1 0 1 0 0 0 CG N2 N1 N0 无 32x1/Fosc
显示状态设置 1 1 0 1 0 0 1 N3 N2 N1 N0 无 32x1/Fosc
光标形状设置 1 1 0 1 1 0 0 0 N2 N1 N0 无 32x1/Fosc
数据自动读写设置 1 1 0 1 0 1 1 0 0 N1 N0 无 32x1/Fosc
数据一次读写设置 1 1 0 1 1 0 0 0 N2 N1 N0 1 32x1/Fosc
屏读(一字节)设置 1 1 0 1 1 1 0 0 0 0 0 无 状态检测
屏拷贝(一行)设置 1 1 0 1 1 1 0 1 0 0 0 无 状态检测
位操作 1 1 0 1 1 1 1 N3 N2 N1 N0 无 状态检测
数据写操作 0 1 0 数据 无 状态检测
数据读操作 0 0 1 数据 无 状态检测
lcd的CE端接地 RD端悬空(因为一般不用读操作 没意义啊)只有10根线与单片机连接
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
#define DATA_PORT P1
char code tab_image[40][32];//汉字字模数组
sbit CD=P2^4; //数据(L)/命令(H)选择
sbit WRIT=P2^6; //写,低电平有效
void delay_lcd(uchar t)
{
for(;t!=0; t--);
}
void write_data(uchar dat)
{
CD=0; //数据
WRIT=0; //写
DATA_PORT=dat; //把数据送到P口
delay_lcd(1); //当晶振较高时加延时
WRIT=1; //关写
}
//--------------------------------------------
// 写命令函数
//--------------------------------------------
void write_com(uchar com)
{
CD=1; //命令
WRIT=0;
DATA_PORT=com;
delay_lcd(1); //当晶振较高时加延时
WRIT=1;
}
void clr_lcd(uchar x,uchar y,uint length)
{
uint i,place;
place=x*30+y;
write_data(place&0xff);
write_data(place/256);
write_com(0x24); //设置
for(i=0;i<length;i++)
write_data(0xff); //写入空格,清屏
write_com(0xb2); //关闭自动写
}
void lcd_init()
{
write_data(0);
write_data(0); //图形首地址
write_com(0x42); //图形首地址设置
write_data(30);
write_data(0);
write_com(0x43); //图形区域设置
write_com(0x80); //设置为OR模式
write_com(0x98); //关闭文本显示,开图形显示
}
//下面是写一个16x16的汉字
void write_hanzi(uchar x,uchar y,uchar a,uchar b,uchar tab_image[][32],uchar k)
{
uint place;
uchar i,j;
place=x*30+y;
for(i=0;i<b;i++) //b行数据
{
write_data(place&0xff); //写地址低8位
write_data(place/256); //写地址高8位
write_com(0x24); //设置地址
write_com(0xb0); //设置数据自动写
for(j=0;j<a/8;j++) //a/8列数据
{write_data(tab_image[k][(a/8)*i+j]);}
write_com(0xb2); //自动复位
place=place+30; //换行
}
main()
{
lcd_init();
write_hanzi(0,4,16,16,tab_image,0);
write_hanzi(0,6,16,16,tab_image,0);
write_hanzi(0,8,16,16,tab_image,1);
write_hanzi(0,10,16,16,tab_image,2);
write_hanzi(0,12,16,16,tab_image,3);
write_hanzi(0,14,16,16,tab_image,4);
write_hanzi(0,16,16,16,tab_image,5);
write_hanzi(0,18,16,16,tab_image,6);
write_hanzi(0,20,16,16,tab_image,7);
write_hanzi(0,22,16,16,tab_image,0);
while(1)
{
}
}
char code tab_image[40][32]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,
0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//=
0x20,0x00,0x22,0x04,0x3F,0x7E,0x48,0x44,0x08,0x44,0xFF,0xC4,0x10,0x44,0x14,0x7C,
0x22,0x44,0x42,0x10,0x9F,0xF8,0x10,0x10,0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,//智
0x10,0x80,0x10,0x88,0x24,0x98,0x44,0xA0,0xFE,0xC0,0x02,0x84,0x7C,0x84,0x44,0x7C,
0x7C,0x00,0x44,0x88,0x44,0x98,0x7C,0xA0,0x44,0xC0,0x44,0x82,0x54,0x82,0x48,0x7E,//能
0x08,0x80,0x08,0x80,0x08,0x80,0x10,0x88,0x10,0x98,0x30,0xA0,0x50,0xC0,0x90,0x80,
0x11,0x80,0x12,0x80,0x14,0x80,0x10,0x80,0x10,0x82,0x10,0x82,0x10,0x7E,0x10,0x00,//化
0x00,0x08,0x7F,0xFC,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x24,0xFF,0xFE,
0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x10,0x20,0x10,0x20,0x20,0x20,0x40,0x20,//开
0x10,0x10,0x08,0x18,0x04,0x20,0x04,0x48,0x7F,0xFC,0x01,0x00,0x01,0x00,0x01,0x04,
0xFF,0xFE,0x01,0x00,0x02,0x80,0x02,0x80,0x04,0x40,0x08,0x30,0x30,0x0E,0xC0,0x04,//关
0x02,0x00,0x02,0x00,0x02,0x10,0x7F,0xF8,0x42,0x10,0x42,0x10,0x7F,0xF0,0x42,0x10,
0x42,0x10,0x7F,0xF0,0x42,0x10,0x02,0x00,0x02,0x04,0x02,0x04,0x01,0xFC,0x00,0x00,//电
0x00,0x04,0x47,0xFE,0x34,0x20,0x14,0x20,0x84,0x44,0x65,0xFE,0x25,0x04,0x0D,0xFC,
0x15,0x04,0x25,0xFC,0xE4,0x20,0x24,0xA8,0x29,0xA6,0x2A,0x22,0x30,0xA0,0x20,0x40,//源
0x02,0x00,0x01,0x08,0x7F,0xFC,0x01,0x00,0x42,0x44,0x27,0x88,0x11,0x10,0x22,0x48,
0x4F,0xE4,0x01,0x20,0x01,0x04,0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00//率
};