我有一个液晶是HS192*64-6的,哪位有这个的详细资料,我想用一下,最好有c语言的资料。
LCD的资料是国际标准的,参考本人的推荐网址。有一家LCD厂商有汇编C完整的demo代码。
你需要知道他的驱动芯片是那个!有好多相同分辨率的屏驱动是不一样的。我给你一个是ST7565P的!19264
//Send 8-Bit Data To ST7565P
void SendBit(uchar dat,uchar bitcnt)
{
uchar i;
CLI(); //disable all interrupts
PORTA|=0B00000010;////SCLK_PORT = 1;
// wait_a();
for(i=0;i
{
if(( dat & 0X80 ) == 0)
PORTA&=0B11111011;////SDA_PORT = 0;
else
PORTA|=0B00000100;////SDA_PORT = 1; /*发送数据由高位到低位传送*/
// wait_a();
PORTA&=0B11111101;////SCLK_PORT = 0; /*置时钟线为高通知被控器开始接收数位*/
// wait_a();
PORTA|=0B00000010;////SCLK_PORT = 1; /*钳住总线准备下一个数据位*/
// wait_a();
dat=dat<<1; /*发送数据左移一位*/
}
SEI();
}
//Write Diaply data
void wr_dat(uchar uc_dat)
{
PORTA|=0B00001000;////RS_PORT = 1;
// wait_a();
SendBit(uc_dat,8);
// wait_a();
}
//Write Instruction Data
void wr_cmd(uchar uc_cmd)
{
PORTA&=0B11110111;////RS_PORT = 0;
// wait_a();
SendBit(uc_cmd,8);
// wait_a();
}
//ST7565P Initialization
void Initial()
{
PORTA&=0B11001111;
////CSA_PORT = 0;
////CSB_PORT = 0;
// wait_a();
/*Internal Reset*/
wr_cmd(0xE2);
/*Display OFF*/
wr_cmd(0xAE);
/*Set The DDRAM Address SEG output Correspondence (ADC=0)*/
wr_cmd(0xA0);
/*Set COM Output scan direction (SHL=1)*/
wr_cmd(0xC8);
/*Set The LCD Display(Normal)*/
wr_cmd(0xA6);
/*Set The LCD Display Driver Voltage Bias Ratio (1/9)*/
wr_cmd(0xA2);
// wr_cmd(0xA3);//(1/7)
/*Set Booster Ratio (4X)*/
wr_cmd(0xF8);
wr_cmd(0x00);
/*Select internal resistor ratio(Rb/Ra) mode*/
wr_cmd(0x24);
/*Set Electronic volume Register (32)*/
wr_cmd(0x81);
wr_cmd(0x24);
/*Set Static Indicator Mode = ON*/
wr_cmd(0xAC);
wr_cmd(0x00);
/*Booster Circuit ON,Voltage Regulator Circuit ON,Voltage Follower Circuit ON*/
wr_cmd(0x2F);
/*Display ON*/
wr_cmd(0xAF);
/*The DDRAM Display Start Line Address (0)*/
wr_cmd(0x40);
}
void show_data_l(uchar x,uchar y,uchar dat)
{
uchar pg_address,hi,low;
hi=x/16;
low=x-hi*16;
PORTA&=0B11011111;////CSA_PORT = 0;
PORTA|=0B00010000;////CSB_PORT = 1;
pg_address = 0xB0+y;
wr_cmd(pg_address); //The DDRAM Display Page Address
wr_cmd(0x10+hi);//Set Upper Bit Column Address
wr_cmd(low);//Set Low Bit Column Address
wr_dat(dat);
// PORTA&=0B11001111;////CSA_PORT = 0;CSB_PORT = 0;
PORTA|=~0B11001111;////CSA_PORT = 0;CSB_PORT = 0;
}
void show_data_r(uchar x,uchar y,uchar dat)
{
uchar pg_address,hi,low;
hi=x/16;
low=x-hi*16;
PORTA&=0B11101111;////CSB_PORT = 0;
PORTA|=0B00100000;////CSA_PORT = 1;
pg_address = 0xB0+y;
wr_cmd(pg_address); //The DDRAM Display Page Address
// wr_cmd(pg_address); //The DDRAM Display Page Address
wr_cmd(0x10+hi);//Set Upper Bit Column Address
wr_cmd(low);//Set Low Bit Column Address
wr_dat(dat);
// PORTA&=0B11001111;////CSA_PORT = 0;CSB_PORT = 0;
PORTA|=~0B11001111;////CSA_PORT = 0;CSB_PORT = 0;
}
void lcd_wrch(unsigned char x,unsigned char y,unsigned char dd)
{
// PORTD&=0b11100111;//---> cs1=cs2=0;
if (x<96)
{//左半屏
show_data_l(x,y,dd);
}
else
{ //右半屏
x=x-96;
show_data_r(x,y,dd);
}
}
对于你这类LCD,关键是看它的控制芯片是哪个?
再百度下,找到这个控制IC的技术手册,参照写下。
每个人的硬件控制方式可能都不一样,所以C函数不一定能用在你的硬件上,还是要掌握它的原理,自己设计出驱动硬件电路,这样更随心所欲的控制
用厂家给的程序,电路也和厂家给的一样,还是驱动不起来,真服了
关键我这还有好几块液晶,不可能都一起坏啊,以前都是正常的