新闻  |   论坛  |   博客  |   在线研讨会
12864点阵液晶显示测试程序(带字库)
tanhaijun88tcl | 2009-08-04 19:39:44    阅读:6894   发布文章

接口说明

1 12864-1

 

管脚号

管脚

方向

说明

1

VSS

-

逻辑电源地。

2

VDD

-

逻辑电源+5V。

3

V0

I

LCD调整电压,应用时接10K电位器可调端

4

RS

I

数据\指令选择:高电平:数据D0-D7将送入显示RAM;

低电平:数据D0-D7将送入指令寄存器执行。

5

R/W

I

\写选择: 高电平:读数据;低电平:写数据。

6

E

I

读写使能,高电平有效,下降沿锁定数据。

7

DB0

I/O

数据输入输出引脚。

8

DB1

I/O

数据输入输出引脚。

9

DB2

I/O

数据输入输出引脚。

10

DB3

I/O

数据输入输出引脚。

11

DB4

I/O

数据输入输出引脚。

12

DB5

I/O

数据输入输出引脚。

13

DB6

I/O

数据输入输出引脚。

14

DB7

I/O

数据输入输出引脚。

15

CS1

I

片选择信号,高电平时选择左半屏。

16

CS2

I

片选择信号,高电平时选择右半屏。

17

/RET

I

复位信号,低电平有效。

18

VEE

O

LCD驱动,负电压输出,对地接10K电位器

19

LEDA

-

背光电源,LED+(5V)。

20

LEDK

-

背光电源,LED-(0V)。

测试程序:
#include <reg52.h>

#define uint  unsigned int
#define uchar unsigned char
#define x1    0x80
#define x2    0x88
#define y     0x80
#define comm  0
#define dat   1

sbit rs = P1^1;   //H=data; L=command;
sbit rw = P1^2;   //H=read; L=write;
sbit  e = P1^3;   //input enable;
sbit psb= P1^4;   //H=并口; L=串口;
sbit rst= P1^5;   //Reset Signal 低电平有效

sbit busy=P2^7;   //lcd busy bit

void wr_lcd (uchar dat_comm,uchar content);
void chk_busy (void);
void delay (uint us);

uchar code tab1[]={
"    床前明月光, "
"  疑是地上霜,   "
"举头望明月,     "
"低头思故乡。    "
};

uchar code tab31[]={
"你的选择"
"没有错  "
};
uchar code tab32[]={
/*--  调入了一幅图像:D:\Backup\桌面\未命名1.bmp  --*/
/*--  宽度x高度=128x32  --*/
0xFF,0xFF,0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x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};


/*------------------初始化-----------------*/
void init_lcd (void)
{
  rst=1;
  psb=1;
  wr_lcd (comm,0x30);  /*30---基本指令动作*/  
  wr_lcd (comm,0x01);  /*清屏,地址指针指向00H*/
  wr_lcd (comm,0x06);  /*光标的移动方向*/
  wr_lcd (comm,0x0c);  /*开显示,关游标*/
}
/*---------------显示汉字或字符----------------*/
void chn_disp (uchar code *chn)
{
  uchar i,j;
  wr_lcd (comm,0x30);
  wr_lcd (comm,0x80);
  for (j=0;j<4;j++)
  {
    for (i=0;i<16;i++)
    wr_lcd (dat,chn[j*16+i]);
  }
}
/*-----------上半屏显示汉字或字符------------*/
void chn_disp1 (uchar code *chn)
{
  uchar i,j;
  wr_lcd (comm,0x30);
  wr_lcd (comm,0x80);
  j=0;
  for (i=0;i<16;i++)
  wr_lcd (dat,chn[j*16+i]);
  wr_lcd (comm,0x90);
  j=1;
  for (i=0;i<16;i++)
  wr_lcd (dat,chn[j*16+i]);
}
/*----------------显示图形-----------------*/
void img_disp (uchar code *img)
{
  uchar i,j;
  for(j=0;j<32;j++)
  {
    for(i=0;i<8;i++)
    {
      wr_lcd (comm,0x34);
      wr_lcd (comm,y+j);
      wr_lcd (comm,x1+i);
      wr_lcd (comm,0x30);
      wr_lcd (dat,img[j*16+i*2]);
      wr_lcd (dat,img[j*16+i*2+1]);
    }
  }
  for(j=32;j<64;j++)
  {
    for(i=0;i<8;i++)
    {
      wr_lcd (comm,0x34);
      wr_lcd (comm,y+j-32);
      wr_lcd (comm,x2+i);
      wr_lcd (comm,0x30);
      wr_lcd (dat,img[j*16+i*2]);
      wr_lcd (dat,img[j*16+i*2+1]);
    }
  }
  wr_lcd (comm,0x36);
}
/*-------------下半屏显示图形--------------*/
void img_disp1 (uchar code *img)
{
  uchar i,j;
  for(j=0;j<32;j++)
  {
    for(i=0;i<8;i++)
    {
      wr_lcd (comm,0x34);
      wr_lcd (comm,y+j);
      wr_lcd (comm,x2+i);
      wr_lcd (comm,0x30);
      wr_lcd (dat,img[j*16+i*2]);
      wr_lcd (dat,img[j*16+i*2+1]);
    }
  }
  wr_lcd (comm,0x36);
}
/*--------------显示点阵----------------*/
void lat_disp (uchar data1,uchar data2)
{
  uchar i,j,k,x;
  x=x1;
  for(k=0;k<2;k++)
  {
    for(j=0;j<16;j++)
    {
      for(i=0;i<8;i++)
      {
        wr_lcd (comm,0x34);
        wr_lcd (comm,y+j*2);
        wr_lcd (comm,x+i);
        wr_lcd (comm,0x30);
        wr_lcd (dat,data1);
        wr_lcd (dat,data1);
      }
      for(i=0;i<8;i++)
      {
        wr_lcd (comm,0x34);
        wr_lcd (comm,y+j*2+1);
        wr_lcd (comm,x+i);
        wr_lcd (comm,0x30);
        wr_lcd (dat,data2);
        wr_lcd (dat,data2);
      }
    }
    x=x2;
  }
  wr_lcd (comm,0x36);
}
/*-----------------------------------------------*/
//当data1=0xff,data2=0xff时,在x0,y0处反白显示16xl*yl.
void con_disp (uchar data1,uchar data2,uchar x0,uchar y0,uchar xl,uchar yl)
{
  uchar i,j;
  for(j=0;j<yl;j++)
  {
    for(i=0;i<xl;i++)
    {
      wr_lcd (comm,0x34);
      wr_lcd (comm,y0+j);
      wr_lcd (comm,x0+i);
      wr_lcd (comm,0x30);
      wr_lcd (dat,data1);
      wr_lcd (dat,data2);
    }
  }
  wr_lcd (comm,0x36);
}
/*--------------清DDRAM------------------*/
void clrram (void)
{
  wr_lcd (comm,0x30);
  wr_lcd (comm,0x01);
}
/*---------------------------------------*/
void wr_lcd (uchar dat_comm,uchar content)
{
  chk_busy ();
  if(dat_comm)
   {
    rs=1;   //data
    rw=0;   //write
   }
  else
   {
    rs=0;   //command
    rw=0;   //write
   }
  P2=content;   //output data or comm
  e=1;
  ;
  e=0;
}

void chk_busy (void)
{
  P2=0xff;
  rs=0;
  rw=1;
  e =1;
  while(busy==1);
  e =0;
}

void delay (uint us)   //delay time
{
  while(us--);
}
void delay1 (uint ms)
{
  uint i,j;
  for(i=0;i<ms;i++)
  for(j=0;j<15;j++)
  delay(1);
}
/*------------------主程序--------------------*/
void main ()
{
  SP=0x5f;
  init_lcd ();
  while (1)
  {
    lat_disp (0x00,0x00);
    chn_disp (tab1);
    con_disp (0xff,0xff,0x8c,0x80,2,16);
    delay1 (28000);
    clrram();
    lat_disp (0xcc,0xcc);
    delay1 (28000);
    lat_disp (0x00,0x00);
    chn_disp1 (tab31);
    img_disp1 (tab32);
    delay1 (28000);
    clrram();
    lat_disp (0xff,0x00);
    delay1 (28000);
    img_disp (tab5);
    delay1 (28000);
  }
}

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
weichenHi  2015-11-28 17:00:24 

谢谢博主分享

请各位多多指教!
推荐文章
最近访客