lcd驱动芯片1335控制器(LCDdrivechip1335controller)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

lcd驱动芯片1335控制器(LCD drive chip 1335 controller)
This is my 1335 screen program, do not know what causes the screen, without reflection, there is no reason to see anyone where ah?
#include
#include "C8051f.h""
#definedatabusP2// data port
#definelcd_a0P35
#definelcd_wrP34
#definelcd_rdP33
#definelcd_csP32
/ / instruction definition
#definesystem_set0x40// display window settings
#definesleep_in0x53// idle operation
The #definedisp_on0x59// settings display mode is displayed The #definedisp_of0x58// settings display mode is shown off #definescroll0x44// sets the display area, scrolls
#definecsrform0x5d// sets the cursor shape
#definecgram_adr0x5c// sets the CGRAM start address
#definecsrrgt0x4c// sets cursor movement direction right
#definecsrlft0x4d// sets the cursor move direction left Cursor movement direction is set on #definecsrup0x4e//
#definecsrdown0x4f// sets cursor movement direction
#definehdot_scr0x5a// sets the point cell scroll position
#defineovlay0x5b// sets the composite display mode
#definecsrw0x46// sets the cursor address
#definecsrr0x47// read cursor address
The #definemwrite0x42// data is written to the display buffer #definemread0x43// reads data from the display buffer
Unsignedcharsystab[8]={0x30,0x87,0x07,0x27,0x42,0xf0,0x28,0 x00};
#defineBasePart10x00
#defineBasePart20x40
#defineBasePart30x80
//#defineBasePart40xf0
#defineBasePart40x00
Unsignedcharscrtab[10]={
0x00, BasePart1,0xF0,0x00, BasePart2,0xF0,0x00, BasePart3,0x00, BasePart4};
Unsignedintnumber;
VoidSYSCLK_Init (void)
{
Inti; //delaycounter
OSCXCN=0x67; //startexternaloscillatorwith
//18.432MHzcrystal
For (i=0; i<256; i++); //Waitforosc.tostartup
//while ((OSCXCN&0x80)); //Waitforcrystalosc.tosettle
OSCICN=0x88; //selectexternaloscillatorasSYSCLK
//sourceandenablemissingclock
//detector
//OSCICN=0x07; //interal16MHZ
}
VoidPORT_Init (void)
{
XBR0=0x07, //EnableSMBus, SPI0, andUART0 XBR1=0x00;
XBR2=0x44; //Enablecrossbarandweakpull-ups EMI0TC=0x21;
P74OUT=0xFF;
P0MDOUT=0x15;
P1MDIN|=0X80;
//remend
P3=0x80; //p3.7 digital input
P03=0x01; //p0.3 is numeric input
//remend
}
Voidwrite_command (unsignedcharcomm) {
Lcd_a0=1; //writecommand
Lcd_cs=0;
Lcd_wr=0;
Databus=comm;
_nop_ (); //90ns
Lcd_wr=0x01; //270ns
_nop_ (); //90ns
Lcd_cs=0x01;
}
Voidwrite_data (unsignedcharrefer) {
Lcd_a0=0; //writereference
lcd_cs = 0;
lcd_wr = 0;
数据总线为参考;
_nop_();
lcd_wr = 0x01;
_nop_();/ / 90ns
lcd_cs = 0x01;
}
voidlcd_init(void)
{
unsignedchari;
write_command(system_set);/ /系统参数设置对于(i = 0;i < 8;i +)
{
write_data(systab [我]);
}
write_command(滚动);/ /设定显示区域起始地址
对于(i = 0;i < 10;i +)
{
write_data(scrtab [我]);
}
write_command(hdot_scr);
/ / write_data(0x07);/ /显示右移
write_data(0);//显示右移
write_command(ovlay);
/ / write_data(0x08);/ /一区文本,二区图形,三区图形,二重重合,或逻辑
write_data(4);/ / 00000 100显示一区图形,三区文本属性,二重”或”合成蚵呒?
write_command(disp_on);
write_data(0x54);/ / 1 ~ 4区开显示,光标关显示
voidlcd_clear(void)
{
unsignedintnum2 = 32768;
write_command(csrrgt);/ /光标移动方向定义:自动右移_nop_();/ / 90ns
write_command(csrw);
_nop_();/ / 90ns
write_data(0x0);/ /光标的起始地址为0000h
_nop_();/ / 90ns
write_data(0);
write_command(mwrite);/ /数据写入指令,代码0x42
而(num2 --)
{
write_data(0x0);/ /写入数据0
}
}
voidtimer3_init(void)
{
tmr3cn = 0x00;/ /使用系统时钟的12分频tmr3h = 0xfc;/ /置初值
tmr3l = 0x18;
tmr3rlh = 0xfc;/ /置重装入寄存器
tmr3rll = 0x18;
}
voidtimer3(void)interrupt14using1 {
tmr3cn = 0;//清溢出标志位
eie2 = 0;//关T3中断允许
如果(数字)
号—;
voiddelayms(unsignedinttt)
{
tmr3cn = 0x04;/ /定时器3开始工作数字= TT;
虽然(数字);
tmr3cn = 0;//定时器3停止工作
}
main()
{
unsignedintnum1 = 1000;
sysclk_init();
port_init();
timer3_init();
EA = 1;//开总中断允许
eie2 = 0x01;/ /开T3中断允许
lcd_init();
lcd_clear();
write_command(csrw);
write_data(0x0);/ /光标的起始地址为0000h
write_data(0);
write_command(mwrite);/ /数据写入指令,代码0x42
而(num1 --)
{
write_data(0x0f);/ /写入数据
}
(1);
}
没看,不过:[ cnpollux ] 2005-6-616:31:26
一般都是要对对时序(尤其是间接控制的),查查设置,多半是理解错误或笔误
我现在在使用。

[ lmingyi ] 2005-6-617:41:17
voidwrite_command(unsignedcharcomm){
lcd_a0 = 1;// writecommand
数据总线为通信;
lcd_cs = 0;
lcd_wr = 0;
lcd_wr = 0x01;/ / 270ns
lcd_cs = 0x01;
}
voidwrite_data(unsignedcharrefer){
lcd_a0 = 0;// writereference
数据总线为参考;
lcd_cs = 0;
/ / / / 90ns _nop_();
lcd_wr = 0;
/ / / / 90ns _nop_();/ / _nop_();
lcd_wr = 0x01;
/ / / / 90ns _nop_();lcd_cs = 0x01;
}。

相关文档
最新文档