单片机驱动19264液晶显示汉字c程序
    

19264液晶是一种比12864大一点点的单色液晶,这里我给大家介绍一下用stc系列单片机驱动他显示汉字的原理

效果图

由于网页空间篇幅有限本文只列出了部分代码,完整版本请从http://www.51hei.com/f/19264.rar处下载

#include

#include

#define uchar unsigned char

#define uint unsigned int

uint ee;

uchar f;

sbit lcd_cs3=p1^0;//片选信号右 低有效

sbit lcd_cs2=p1^1;//片选信号中 低有效

sbit lcd_cs1=p1^2;//片选信号左 低有效

sbit lcd_e =p1^3;//使能信号

sbit lcd_rw =p1^4;//读写选择

sbit lcd_rs =p1^5;//数据命令选择端 h数据 l命令

sbit lcd_rst=p1^6;// 液晶复位引脚 低有效 低的话 就一直复位了

//p2八位数据线

uchar code cc[]={

/*---------------小----------------*/

0xff,0xff,0xff,0xff,0xbf,0xdf,0xef,0xe7,0xf3,0xf9,0xfb,0xff,0xff,0xff,0xff,0xff,

0xfe,0xfe,0xfe,0xfe,0xf6,0xf2,0xe6,0xee,0xde,0xbe,0x7e,0xfe,0xfe,0xfe,0xfa,0xfd,

/*---------------鹏----------------*/

0xef,0xdf,0x83,0x9b,0xab,0xab,0xb3,0xbf,0x81,0xfd,0xfd,0x05,0xfd,0xeb,0xf7,0xff,

0xff,0x88,0xaa,0xaa,0x88,0xaa,0xaa,0xaa,0x88,0xaa,0xaa,0xaa,0xaa,0x46,0xec,0xff,

/*---------------工----------------*/

0xff,0xff,0xff,0xf7,0xf7,0xf7,0xf7,0x07,0xfb,0xfb,0xfb,0xfb,0xff,0xff,0xff,0xff,

0xff,0xef,0xef,0xef,0xef,0xef,0xef,0xf0,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xff,0xff,

/*---------------作----------------*/

0x7f,0xbf,0xdf,0x07,0xf8,0xbf,0xcf,0xe3,0x0c,0x6f,0x6f,0xb7,0xb7,0xf7,0xff,0xff,

0xff,0xff,0xff,0x80,0xff,0xff,0xff,0xff,0x80,0xfb,0xfb,0xfd,0xfd,0xfd,0xff,0xff,

/*---------------室----------------*/

0xff,0xff,0xe7,0xd7,0x57,0x97,0xd6,0xd9,0x6b,0x6b,0x2b,0x73,0xfb,0xff,0xff,0xff,

0xff,0xbf,0xbf,0xb6,0xb6,0xb6,0xb6,0xc0,0xdb,0xdb,0xdb,0xde,0xdf,0xff,0xff,0xff,

/*---------------开----------------*/

0xff,0x7f,0x7f,0x7b,0x7b,0x03,0xbd,0xbd,0xbd,0x01,0xbd,0xbd,0xbf,0xbf,0xff,0xff,

0xff,0xbf,0xdf,0xef,0xf3,0xfc,0xff,0xff,0xff,0x80,0xff,0xff,0xff,0xff,0xff,0xff,

/*---------------发----------------*/

0xff,0xff,0xdf,0xc1,0xdf,0x1f,0x60,0x6f,0x6f,0xad,0x2b,0xef,0xef,0xff,0xff,0xff,

0xdf,0xef,0xb7,0xbb,0xdc,0xdd,0xeb,0xf7,0xf3,0xed,0xde,0xbf,0xbf,0xbf,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,

};

uchar code dd[]={

/*---------------小----------------*/

0x00,0x00,0x00,0x00,0x40,0x20,0x10,0x18,0x0c,0x06,0x04,0x00,0x00,0x00,0x00,0x00,

0x01,0x01,0x01,0x01,0x09,0x0d,0x19,0x11,0x21,0x41,0x81,0x01,0x01,0x01,0x05,0x02,

/*---------------鹏----------------*/

0x10,0x20,0x7c,0x64,0x54,0x54,0x4c,0x40,0x7e,0x02,0x02,0xfa,0x02,0x14,0x08,0x00,

0x00,0x77,0x55,0x55,0x77,0x55,0x55,0x55,0x77,0x55,0x55,0x55,0x55,0xb9,0x13,0x00,

/*---------------工----------------*/

0x00,0x00,0x00,0x08,0x08,0x08,0x08,0xf8,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x00,

0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x0f,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,

/*---------------作----------------*/

0x80,0x40,0x20,0xf8,0x07,0x40,0x30,0x1c,0xf3,0x90,0x90,0x48,0x48,0x08,0x00,0x00,

0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x7f,0x04,0x04,0x02,0x02,0x02,0x00,0x00,

/*---------------室----------------*/

0x00,0x00,0x18,0x28,0xa8,0x68,0x29,0x26,0x94,0x94,0xd4,0x8c,0x04,0x00,0x00,0x00,

0x00,0x40,0x40,0x49,0x49,0x49,0x49,0x3f,0x24,0x24,0x24,0x21,0x20,0x00,0x00,0x00,

/*---------------开----------------*/

0x00,0x80,0x80,0x84,0x84,0xfc,0x42,0x42,0x42,0xfe,0x42,0x42,0x40,0x40,0x00,0x00,

0x00,0x40,0x20,0x10,0x0c,0x03,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,

/*---------------发----------------*/

0x00,0x00,0x20,0x3e,0x20,0xe0,0x9f,0x90,0x90,0x52,0xd4,0x10,0x10,0x00,0x00,0x00,

0x20,0x10,0x48,0x44,0x23,0x22,0x14,0x08,0x0c,0x12,0x21,0x40,0x40,0x40,0x00,0x00,

};

void lcd_init();

void wrile_com(uchar com);

void wrile_data(uchar dat);

void qpcz(uchar tt,rg) ; //液晶屏 清屏操作

void xyz(uchar q1,q2,q3);

void delay(uchar d0);

void main()

{

while(1)

{lcd_init();

qpcz(0x11,0xff);

delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);

delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);

qpcz(0x00,0x00);

xyz(0xc0,0xb8,0x60);

lcd_cs1=0;

lcd_cs2=1;

lcd_cs3=1;

for(f=0;f<224;f++)

{

if(f==64)

{lcd_cs1=1;

lcd_cs2=0;

lcd_cs3=1;

}

if(f==192)

{lcd_cs1=1;

lcd_cs2=1;

lcd_cs3=0;

}

switch(f) // 括号里面的语句和 case比较

{case 16:xyz(0xc0,0xb9,0x60); //比较一样

break;

case 32:xyz(0xc0,0xb8,0x70); //比较一样

break;

case 48:xyz(0xc0,0xb9,0x70); //比较一样

break;

case 64:xyz(0xc0,0xb8,0x40); //比较一样

break;

case 80:xyz(0xc0,0xb9,0x40); //比较一样

break;

case 96:xyz(0xc0,0xb8,0x50); //比较一样

break;

case 112:xyz(0xc0,0xb9,0x50); //比较一样

break;

case 128:xyz(0xc0,0xb8,0x60); //比较一样

break;

case 144:xyz(0xc0,0xb9,0x60); //比较一样

break;

case 160:xyz(0xc0,0xb8,0x70); //比较一样

break;

case 176:xyz(0xc0,0xb9,0x70); //比较一样

break;

case 192:xyz(0xc0,0xb8,0x40); //比较一样

break;

case 208:xyz(0xc0,0xb9,0x40); //比较一样

break;

}

// delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);

wrile_data(cc[f]);

}

xyz(0xc0,0xb8,0x60);

lcd_cs1=0;

lcd_cs2=1;

lcd_cs3=1;

xyz(0xc0,0xb8,0x60);

lcd_cs1=0;

lcd_cs2=1;

lcd_cs3=1;

for(f=0;f<224;f++)

{

if(f==64)

{lcd_cs1=1;

lcd_cs2=0;

lcd_cs3=1;

}

if(f==192)

{lcd_cs1=1;

lcd_cs2=1;

lcd_cs3=0;

}

switch(f) // 括号里面的语句和 case比较

{case 16:xyz(0xc0,0xb9,0x60); //比较一样

break;

case 32:xyz(0xc0,0xb8,0x70); //比较一样

break;

case 48:xyz(0xc0,0xb9,0x70); //比较一样

break;

case 64:xyz(0xc0,0xb8,0x40); //比较一样

break;

case 80:xyz(0xc0,0xb9,0x40); //比较一样

break;

case 96:xyz(0xc0,0xb8,0x50); //比较一样

break;

case 112:xyz(0xc0,0xb9,0x50); //比较一样

break;

case 128:xyz(0xc0,0xb8,0x60); //比较一样

break;

case 144:xyz(0xc0,0xb9,0x60); //比较一样

break;

case 160:xyz(0xc0,0xb8,0x70); //比较一样

break;

case 176:xyz(0xc0,0xb9,0x70); //比较一样

break;

case 192:xyz(0xc0,0xb8,0x40); //比较一样

break;

case 208:xyz(0xc0,0xb9,0x40); //比较一样

break;

}

//delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);

wrile_data(dd[f]);

}

xyz(0xc0,0xba,0x60);

lcd_cs1=0;

lcd_cs2=1;

lcd_cs3=1;

xyz(0xc0,0xba,0x60);

lcd_cs1=0;

lcd_cs2=1;

lcd_cs3=1;

for(f=0;f<224;f++)

{

if(f==64)

{lcd_cs1=1;

lcd_cs2=0;

lcd_cs3=1;

}

if(f==192)

{lcd_cs1=1;

lcd_cs2=1;

lcd_cs3=0;

}

switch(f) // 括号里面的语句和 case比较

{case 16:xyz(0xc0,0xbb,0x60); //比较一样

break;

case 32:xyz(0xc0,0xba,0x70); //比较一样

break;

case 48:xyz(0xc0,0xbb,0x70); //比较一样

break;

case 64:xyz(0xc0,0xba,0x40); //比较一样

break;

case 80:xyz(0xc0,0xbb,0x40); //比较一样

break;

case 96:xyz(0xc0,0xba,0x50); //比较一样

break;

case 112:xyz(0xc0,0xbb,0x50); //比较一样

break;

case 128:xyz(0xc0,0xba,0x60); //比较一样

break;

case 144:xyz(0xc0,0xbb,0x60); //比较一样

break;

case 160:xyz(0xc0,0xba,0x70); //比较一样

break;

case 176:xyz(0xc0,0xbb,0x70); //比较一样

break;

case 192:xyz(0xc0,0xba,0x40); //比较一样

break;

case 208:xyz(0xc0,0xbb,0x40); //比较一样

break;

}

// delay(250);delay(250);delay(250);delay(250);delay(250);

delay(250);

wrile_data(cc[f]);

}

qpcz(0xff,0xff);

delay(250);delay(250);delay(250);

}

}

void lcd_init()

{

lcd_rst=0;

delay(50);

lcd_rst=1;

delay(255);//等待复位

lcd_cs1=0;

lcd_cs2=0;

lcd_cs3=0;

wrile_com(0x3f);

}

void wrile_com(uchar com)

{ lcd_e=0; //

lcd_rw=0;//读写选择 写

lcd_rs=0;//数据命令 命令

lcd_e=1; //

p2=com;

_nop_();

lcd_e=0;

delay(5);

}

void wrile_data(uchar dat)

{ lcd_e=0; //

lcd_rw=0;//读写选择 写

lcd_rs=1;//数据命令 命令

lcd_e=1; //

p2=dat;

_nop_();

lcd_e=0;

delay(5);

}

void xyz(uchar q1,q2,q3)

{ wrile_com(q1);//显示起始行

wrile_com(q2);//页面地址

wrile_com(q3);//列地址设置

}

void qpcz(uchar tt,rg) //液晶屏 清屏操作

{uchar qw,qe,er;

lcd_cs1=0;

lcd_cs2=0;

lcd_cs3=0;

er=0xb8;

xyz(0xc0,0xb8,0x40);

for(qw=0;qw<8;qw++)

{

wrile_com(er);//页面地址

for(qe=0;qe<64;qe++)

{ wrile_data(tt);delay(rg); }

wrile_com(er++);//页面地址

}

}

void delay(uchar d0)

{uchar d1,d2;

for(d1=d0;d1>0;d1--)

for(d2=110;d2>0;d2--);

}

相关阅读
  • AT89C51单片机驱动液晶显示汉字C语
  • 单片机液晶汉字显示c语言程序
  • 单片机驱动ds1302时间ds18b20温度1
  • 单片机驱动DS1302时间DS18B20温度1
  • AT89C51单片机驱动128x64液晶显示C
  • 单片机驱动16*16点阵LED汉字显示c5
  • 单片机驱动16*16点阵led汉字显示c5
  • 单片机红外遥控+步进电机+1602液晶
  • 51单片机驱动AD7799程序(keil c)
  • 单片机液晶显示器程序
  • 【程序】基于AT89C52的液晶显示的
  • 基于单片机的AT2402的I2C总线读写
  • t6963c驱动程序-驱动代码
  • 基于MSP430单片机驱动NRF24L01无线
  • msp430单片机驱动LCD1602 C语言程
  • 单片机液晶显示程序
  • MST717C显示驱动芯片驱动TFT液晶显
  • 【程序】51单片机驱动AT45程序
  • 【程序】51单片机74hc595驱动串行l
  • 【程序】51单片机控制的电动自行车
  • 液晶显示器的C语言程序设计的内容
  • 【程序】51单片机控制LED显示汉字
  •  



     
     
         

    收录时间:2014年10月21日 20:35:43 来源:51hei 作者:不详
    上一篇:stc单片机外扩ram及8255需要注意的问题  (电脑版  手机版)
     
    创建分享人
    zrgsq91
    最新问题
     
    喜欢此文章的还喜欢
    Copyright by www.chinabaike.com;All rights reserved. 联系:QQ:469681782