资源简介
PT6523和PT6524 LCD驱动芯片驱动程序,很难得的程序,绝对原创,完整,已成功用于批量生产. 希望对大家有用,想当初我为了写PT6524的驱动程序时,上网搜了半天,都没搜到有用,只能细心看规格书,自力更生,最终调试成功.....
代码片段和文件信息
/****************************************************************
File Name : LCD_Drv.c
Description : PT6523 && PT6524
Author : lxg
Modify History :
1.)First version : PT6523 Driver2009-12-2 9:50:53
2.)Add PT6524 Driver primarily 2010-3-15 22:30:20
3.)PT6524 Driver debug OK 2010-3-19 19:33:54
********************************************************************/
#include “key.h“
#include “System.h“
//#include “Global.h“
#include “LCD_API.h“
#include “Delay.h“
#include
sbit LCD_CE = P2^0; //pin18 P2.0
sbit LCD_CLK = P2^1; //pin19 P2.1
sbit LCD_DO = P2^2; //pin20 P2.2
#define Bit_Delay() { _nop_();_nop_(); _nop_(); _nop_();}
//----------------------------------------------------------------//
#ifdef PT6523_LCD_DRIVER
//-------------------------------------//
unsigned char control_data;
//bit=0 DR: 0时亮一点,1/2 bias drive ; 1时暗一点,1/3 bias drive
//bit=1 SC: 0->on 1->off display state
//bit=2 BU: 0:Normal 1:power saving mode
void LCD_State_Set(unsigned char mode)
{
//control_data = 0x01; //normal
//control_data = 0x03; //power save mode 0000
control_data = mode; //0000 0011
LCD_CE = 0;
Bit_Delay()
LCD_CLK = 1;
Bit_Delay()
LCD_DO = 1;
Bit_Delay()
}
void Process_Send_Addr(unsigned char B1) //8bit
{
unsigned char i;
LCD_CE = 0;
Bit_Delay()
LCD_CLK = 1;
Bit_Delay()
for(i=0;i<8;++i)
{
LCD_CLK = 0;
if(B1 & 0x01)
LCD_DO = 1;
else
LCD_DO = 0;
Bit_Delay()
LCD_CLK = 1;
B1 >>=1;
Bit_Delay()
}
LCD_CE = 1;
}
void Process_Control_Data(unsigned char B1) //4bit
{
unsigned char i;
for(i=0; i<4;++i)
{
LCD_CLK = 0;
if(B1 & 0x01) //bit0 bit1 bit2 bit3
LCD_DO = 1;
else
LCD_DO = 0;
Bit_Delay()
LCD_CLK = 1;
B1 >>=1;
Bit_Delay()
}
}
void Process_Ram_Data(void)
{
unsigned char B1 = 0;
unsigned char i;
unsigned char j;
for(j=0;j<19;++j) //前19byte 0~18
{
B1 =lcd_disp_ram[j];
for(i=0; i<8;++i)
{
LCD_CLK = 0;
if(B1 & 0x01)
LCD_DO = 1;
else
LCD_DO = 0;
Bit_Delay()
LCD_CLK = 1;
B1 >>=1;
Bit_Delay()
}
}
B1 = lcd_disp_ram[19]; //第byte的低4位
for(i=0;i<4;++i) //4bit
{
LCD_CLK = 0;
if(B1 & 0x01)
LCD_DO = 1;
else
LCD_DO = 0;
Bit_Delay()
LCD_CLK = 1;
B1 >>=1;
Bit_Delay()
}
}
//---------------------------------------------------------------//
void LCD_Disp_Update(void)
{
if((board_dect_released)||(board_close_count return;
//if( (ACC_Pin_Check()==OFF)||(power_on_flag==IR_POWER_OFF) ||
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10406 2010-08-23 20:40 LCD_Drv.c
----------- --------- ---------- ----- ----
10406 1
评论
共有 条评论