lcd19264驱动程序

lcd19264驱动程序,第1张

  19264,是液晶模组的分辨率,也就是有192*64个点,是点阵液晶。液晶模组的亮度可能会由于CCFL引线对金属壳的耦合分流而受到影响。逆变器的设计应该充分考虑这部分的漏电。有必要全面评估液晶模组和逆变器安装在主机设备中的情况,确保达到亮度要求。

  lcd19264驱动程序

  #include “Public.h”

  #define Fisrt 01

  #define Second 02

  #define Third 03

  /*定义LCD控制端口*/

  sbit LCD_RS = P0^7;

  sbit LCD_RW = P0^6;

  sbit LCD_CE = P0^5;

  sbit LCD_CSA = P0^4;

  sbit LCD_REST = P0^3;

  sbit LCD_CSB = P0^2;

  sbit LCD_CSC = P0^1;

  #define DATA_BUS P2

  /*******************************************************************

  函数功能说明:判断LCD忙函数

  1、

  2、

  3、

  *******************************************************************/

  void Read_busy(unsigned char Area)

  {

  unsigned char temp = 0;

  do

  {

  LCD_CE = 0;

  LCD_RW = 1;

  LCD_RS = 0;

  switch(Area)

  {

  case Fisrt:

  LCD_CSA = 0;

  break;

  case Second:

  LCD_CSB = 0;

  break; case Third:

  LCD_CSC = 0;

  break; default:break;

  }

  _nop_();

  LCD_CE = 1;

  _nop_();

  temp = DATA_BUS;

  LCD_CE = 0;

  LCD_RW = 0;

  switch(Area)

  {

  case Fisrt:

  LCD_CSA = 1;

  break;

  case Second:

  LCD_CSB = 1;

  break; case Third:

  LCD_CSC = 1;

  break;

  default:break;

  }

  LCD_CE = 1;

  }while(temp&0x80);

  }

  /*******************************************************************

  函数功能说明: 设置坐标

  1、 液晶分为三个区 A、B、C

  2、 设置每个区的坐标

  3、 送坐标到总线上

  *******************************************************************/

  void Set_Locatexy(unsigned char x_add,unsigned char y_add)

  {

  switch(x_add&0xc0)

  {

  case 0x00:

  Write_command(Fisrt,x_add&0x3f)

  break;

  case 0x40:

  break;

  case 0x80:

  break;

  default:break;

  }

  }

  /*******************************************************************

  函数功能说明: 写数据

  1、 液晶分为三个区 A、B、C

  2、 设置每个区的片选信号

  3、 送数据到总线上

  *******************************************************************/

  void Write_data(unsigned char Area_Num,unsigned char Lcd_data)

  {

  Read_busy(Area_Num);

  LCD_CE = 0;

  /*写入到LCM*/

  LCD_RW = 0;

  LCD_RS = 1; //数据

  switch(Area_Num)

  {

  case Fisrt:

  LCD_CSA = 0;

  break;

  case Second:

  LCD_CSB = 0;

  break; case Third:

  LCD_CSC = 0;

  break;

  default:break;

  }

  _nop_();

  LCD_CE = 1;

  _nop_();

  DATA_BUS = Lcd_data;

  _nop_();

  _nop_();

  LCD_CE = 0;

  LCD_RW = 1;

  switch(Area_Num)

  {

  case Fisrt:

  LCD_CSA = 1;

  break;

  case Second:

  LCD_CSB = 1;

  break;

  case Third:

  LCD_CSC = 1;

  break;

  default:break;

  }

  LCD_CE = 1;

  }

  /*******************************************************************

  函数功能说明: 写命令

  1、 液晶分为三个区 A、B、C

  2、 设置每个区的片选信号

  3、 送命令到总线上

  *******************************************************************/

  void Write_command(unsigned char Area_Num,unsigned char Lcd_Command)

  {

  Read_busy(Area_Num);

  LCD_CE = 0; /*写入到LCM*/

  LCD_RW = 0;

  LCD_RS = 0; //指 令

  switch(Area_Num)

  {

  case Fisrt:

  LCD_CSA = 0;

  break;

  case Second:

  LCD_CSB = 0;

  break;

  case Third:

  LCD_CSC = 0;

  break;

  default:break;

  }

  _nop_();

  LCD_CE = 1;

  _nop_();

  DATA_BUS = Lcd_Command;

  _nop_();

  _nop_();

  LCD_CE = 0;

  LCD_RW = 1;

  switch(Area_Num)

  {

  case Fisrt:

  LCD_CSA = 1;

  break;

  case Second:

  LCD_CSB = 1;

  break;

  case Third:

  LCD_CSC = 1;

  break;

  default:break;

  } LCD_CE = 1;

  }

  void Lcminit( void )

  {

  LCD_REST = 0;

  _nop_();

  LCD_REST = 1;

  Write_command(Fisrt,0x40);

  Write_command(Second,0x40);

  Write_command(Third,0x40);

  Write_command(Fisrt,0xb8);

  Write_command(Second,0xb8);

  Write_command(Third,0xb8);

  Write_command(Fisrt,0xc0);

  Write_command(Second,0xc0);

  Write_command(Third,0xc0);

  Write_command(Fisrt,0x3f);

  Write_command(Second,0x3f);

  Write_command(Third,0x3f);

  }

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/dianzi/2596820.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-08-09
下一篇 2022-08-09

发表评论

登录后才能评论

评论列表(0条)

保存