[求助] 12864液晶屏(急需)

TSB41   2009-7-12 18:28 楼主
我现在特别需要“12864液晶屏”的详细资料的,知道的发给我增长一些与其相关的知识,谢谢。

回复评论 (2)

引用: 原帖由 TSB41 于 2009-7-12 18:28 发表
我现在特别需要“12864液晶屏”的详细资料的,知道的发给我增长一些与其相关的知识,谢谢。


这个贴应该可以帮忙:https://bbs.eeworld.com.cn/thread-72838-1-1.html
加油!在电子行业默默贡献自己的力量!:)
点赞  2009-7-13 08:20

回复 楼主 TSB41 的帖子

下面是12864的C程序

#include
#include
#define uchar unsigned char
#define uint unsigned char

sbit RS = P2^7;
sbit RW = P2^6;
sbit E = P2^5;
//sbit PSB = P3^1;
//sbit RES = P3^5;


#define FIRST_ADDR 5

uchar code pic1[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x01,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x03,
0x02,0x04,0x07,0x07,0x07,0x0B,0x0F,0x1F,0x0F,0x1F,0xBF,0x3E,0x2F,0x2E,0x2F,0x7C,
0x78,0xF8,0xF0,0xF0,0xF0,0x70,0x60,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x0D,0x0D,0x0B,0x0F,
0x0F,0x1B,0x1F,0x2F,0x3F,0x7D,0x79,0x58,0xF8,0x78,0xB0,0x30,0xF0,0x60,0x60,0xE0,
0xC0,0xC0,0xC0,0x80,0x80,0x80,0x80,0x00,0x00,0x76,0x7F,0xB7,0x5F,0xFF,0xD0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0x80,0x80,0xC0,0x40,0x40,0xE0,0x20,0xA0,0x50,0x50,0x30,0x10,0x28,0x28,
0x14,0x04,0x14,0x0F,0x0B,0x06,0x05,0x05,0x05,0x02,0xFF,0xFD,0xFF,0xFF,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0xE0,0xF8,0xD0,0xE8,0x78,0xCC,0xF6,
0xBA,0xBA,0x7D,0x59,0x1D,0x3D,0x37,0x35,0x1F,0x1B,0x18,0x08,0x08,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x23,0x3F,0x30,0x38,0x38,
0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x28,0x38,0x3F,0x3B,0x3D,
0x3C,0x28,0x3C,0x28,0x3C,0x28,0x3C,0x2C,0x3C,0x2C,0x3C,0x3C,0x3C,0x2C,0x3C,0x3C,
0x3C,0x3C,0x3C,0x3C,0x3F,0x3F,0x1C,0x18,0x18,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6D,0xFF,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x1A,0xDF,0x00,0xFF,0xD6,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x0F,0x7F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0xFC,0xF6,0x1F,0x02,
0x03,0x03,0x03,0x03,0x03,0x06,0x06,0x06,0x0D,0x7F,0x50,0xB0,0xFF,0x21,0xF1,0xBD,
0x1B,0x0D,0x05,0x07,0x06,0x06,0x06,0x06,0x0E,0x0E,0x16,0x1A,0x2B,0x2D,0x1E,0x78,
0x70,0xE0,0xA0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,
0x60,0x20,0x20,0x20,0x60,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x02,0x06,
0x04,0x0F,0x0C,0x0E,0x14,0x1A,0x14,0x1C,0x24,0x3C,0x3C,0x44,0x74,0x54,0x74,0x44,
0x44,0x44,0x54,0x56,0x56,0x54,0x5E,0x4E,0x5B,0x7D,0x7D,0x75,0x6D,0x67,0x24,0x13,
0x17,0x1B,0x0B,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x3C,0x60,0x80,0xBF,0xD8,0x90,0x30,0x70,0x30,
0xA0,0x20,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x80,0xC0,
0xC0,0xE0,0xE0,0x70,0xB8,0x7F,0x1F,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x18,0x0E,0x6F,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xFF,0xFC,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x60,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0x78,0xE9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xF8,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"未命名文件",0*/

};

//延时子程序
void nop(uchar t)
{
        while(t--);
}

void delay(uint t)
{
        uint x,y;
        for(x=0;x                 for(y=100;y>0;y--);
}

//测忙
void chk_busy()
{  RS=0;
   RW=1;
   E=1;
   while((P0&0x80)==0x80);
   E=0;
}

//写数据
void lcdwd(unsigned char dispdata)
{  chk_busy();
   _nop_();
   RS=1;
   _nop_();
   RW=0;
   E=1;
   P0=dispdata;
   nop(1);
   _nop_();
   E=0;
   _nop_();
   P0=0xff;
}

//写指令代码
void lcdwc(unsigned char cmdcode)
{  chk_busy();
   _nop_();
   RS=0;
   RW=0;
   E=1;
   P0=cmdcode;
   nop(1);
   _nop_();
   E=0;
   _nop_();
   P0=0xff;
}

//初始化
void lcdreset()
{
   lcdwc(0x30);       //选择基本指令集
   lcdwc(0x0c);       //开显示(无游标、不反白)
   lcdwc(0x01);       //清除显示,并且设定地址指针为00H
   lcdwc(0x06);       //指定在资料的读取及写入时,设定游标的移动方向及指定显示的移位
}

void hzkdis(unsigned char code *s)
{  while(*s>0)
   {  lcdwd(*s);
      s++;
      delay(5);
   }
}

//整屏显示
//当ii=0时显示上面128×32
//当ii=8时显示下面128×32
void lcdfill(unsigned char disdata)
{  unsigned char x,y,ii;
   for(ii=0;ii<9;ii+=8)
      for(y=0;y<0x20;y++)
         for(x=0;x<8;x++)
         {  lcdwc(0x36);
            lcdwc(y+0x80);        //行地址
            lcdwc(x+0x80+ii);     //列地址
            lcdwc(0x30);
            lcdwd(disdata);
           lcdwd(disdata);
         }
}

void Full_screen_pic(uchar *pic1)
{
        uchar i,j;
        for(i=0;i<8;i++)
        {
                for(j=0;j<32;j++)
                {
                        lcdwc(0x36);
                        lcdwc(0x80+j);
                        lcdwc(0x80+i);
                        lcdwc(0x30);
                        lcdwd(pic1[i*128+j]);
                        lcdwd(pic1[i*128+64+j]);
                        lcdwc(0x36);
                        lcdwc(0x80+j);
                        lcdwc(0x88+i);
                        lcdwc(0x30);
                        lcdwd(pic1[i*128+32+j]);
                        lcdwd(pic1[i*128+32+64+j]);
                }
               
        }
}
main()
{

    RW=0;
        lcdreset();       //初始化LCD屏
        lcdfill(0xff);
        Full_screen_pic(pic1);       
        while(1);
}
点赞  2009-7-17 20:41
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复