液晶12864简介
12864是128*64点阵液晶模块的点阵数简称。
基本参数
1、低电源电压(VDD:+3.0~+5.5V)。
2、显示分辨率:128×64 点。
3、内置汉字字库,提供8192 个16×16 点阵汉字。
4、内置128 个16×8 点阵字符。
5、2MHZ时钟频率。
6、显示方式:STN、半透、正显。
7、驱动方式:1/32DUTY,1/5BIAS。
8、视角方向:6 点。
9、背光方式:侧部高亮白色LED。
10、通讯方式:串行、并口可选。
11、内置DC-DC 转换电路,无需外加负压。
12、无需片选信号,简化软件设计。
13、工作温度: 0℃~+55℃ ,存储温度: -20℃~+60℃。
液晶12864接口
液晶12864显示图片程序源代码
/*******************12864显示图片*******************
* 处理器:51单片机
* 开发环境:keil
* 功能:12864显示图片
******************************************************/
#include <reg51.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
/*12864端口定义 */
#define LCD_data P0 //数据口
sbit LCD_RS = P1^0; //寄存器选择输入
sbit LCD_RW = P1^1; //液晶读/写控制
sbit LCD_EN = P2^5; //液晶使能控制
sbit LCD_PSB = P1^2; //串/并方式控制
unsigned char code zhu[]=
{
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF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FF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
};
#define delayNOP0(); {_nop_();_nop_();};
#define delayNOP1();{_nop_();_nop_();_nop_();_nop_();};
void delay(int In,int Out)
{
int i,j;
for(i=0;i<In;i++)
{for(j=0;j<Out;j++){;}}
}
/**********************************************************************/
/*检查LCD忙状态 */
/*lcd_busy为1时,忙,等待。lcd-busy为0时,闲,可写指令与数据。*/
/**********************************************************************/
bit lcd_busy()
{
bit result;
LCD_RS = 0;
LCD_RW = 1;
LCD_EN = 1;
delayNOP1();
result =(bit)(P0&0x80);
LCD_EN = 0;
return(result);
}
/*******************************************************************/
/*写指令数据到LCD */
/*RS=L,RW=L,E=高脉冲,D0-D7=指令码。 */
/*******************************************************************/
void lcd_wcmd(uchar cmd)
{
while(lcd_busy());
LCD_RS = 0;
LCD_RW = 0;
LCD_EN = 0;
delayNOP0();
P0 = cmd;
delayNOP1();
LCD_EN = 1;
delayNOP1();
LCD_EN = 0;
}
/*******************************************************************/
/*写显示数据到LCD */
/*RS=H,RW=L,E=高脉冲,D0-D7=数据。 */
/*******************************************************************/
void lcd_wdat(uchar dat)
{
while(lcd_busy());
LCD_RS = 1;
LCD_RW = 0;
LCD_EN = 0;
P0 = dat;
delayNOP1();
LCD_EN = 1;
delayNOP1();
LCD_EN = 0;
}
/*******************************************************************/
/* LCD初始化设定 */
/*******************************************************************/
void lcd_init()
{
LCD_PSB =1; //并口方式
lcd_wcmd(0x34); //扩充指令操作
delay(5,10);
lcd_wcmd(0x30); //基本指令操作
delay(5,10);
lcd_wcmd(0x0C); //显示开,关光标
delay(5,10);
lcd_wcmd(0x01); //清除LCD的显示内容
delay(5,10);
}
/*********************************************************************
函数名称:Draw_PM
功 能:在整个液晶屏幕上画图
参 数:无
返回值 :无
*********************************************************************/
void Draw_PM(const uchar *ptr)
{
uchari,j,k;
lcd_wcmd(0x34); //打开扩展指令集
i=0x80;
for(j=0;j<32;j++)
{
lcd_wcmd(i++);
lcd_wcmd(0x80);
for(k=0;k<16;k++)
{lcd_wdat(*ptr++);}
}
i = 0x80;
for(j=0;j<32;j++)
{
lcd_wcmd(i++);
lcd_wcmd(0x88);
for(k=0;k<16;k++)
{lcd_wdat(*ptr++);}
}
lcd_wcmd(0x36); //打开绘图显示
lcd_wcmd(0x30); //回到基本指令集
}
main()
{
lcd_init(); //初始化LCD
Draw_PM(zhu); //显示图片
while(1);
}