Application note
(Only for reference)
Prepared by:
温永良(william)
一、External circuit
Note 2 :
Test pad is designed for MTP function using. System side
The external circuit of UC1698u for COG application (Reference design)
-- : Please keep the place in FPC for image fine tune.
二、Initial code
Following code is basic code:
{
RESET=1;
Delay(5ms);
RESET=0;
Delay(5ms);
RESET=1;
Delay(150ms);
LCMCOMM=0x00e2; // system reset
Delay(5ms);
LCMCOMM=0x002b; //set internal power control
LCMCOMM=0x0025; //set
TC=-0.01%
LCMCOMM=0x00a1; //set
line
rate
LCMCOMM=0x00ea; //set bias
LCMCOMM=0x00f1;
//set
com
end
LCMCOMM=0x009f;
//duty=1/160
LCMCOMM=0x0081; //set VLCD value
LCMCOMM=0x0045; //VLCD=(CV0+Cpm*pm)*(1+(T-25)*CT%)
LCMCOMM=0x00c4; //set LCD mapping control
LCMCOMM=0x00; //set ram address control
LCMCOMM=0x00d1; //set color pattern=RGB
LCMCOMM=0x00d5; //set color mode=4k-color
LCMCOMM=0x00ad; //set ON/OFF display enable
}
三、Picture display code
UC1698u can support 384*160 dots max in mono mode.
For example: 320*160 resolution and 8bit parallel mode.
Code as follow:
void display_picture(void)
{
int k=0;
int i,j,n;
unsigned char temp,temp1,temp2,temp3,temp4,temp5,temp6,temp7,temp8;
unsigned char h11,h12,h13,h14,h15,h16,h17,h18,d1,d2,d3,d4;
for(i=0;i<160;i++) // 320*160 B/W picture for example
{
for(j=0;j<40;j++) // 320 dot/ 8 bite=40 byte
{
temp=picture1[k++]; //turns 1byte B/W data to 4k-color data(RRRR-GGGG-BBBB) temp1=temp&0x80;
temp2=(temp&0x40)>>3;
temp3=(temp&0x20)<<2;
temp4=(temp&0x10)>>1;
temp5=(temp&0x08)<<4;
temp6=(temp&0x04)<<1;
temp7=(temp&0x02)<<6;
temp8=(temp&0x01)<<3;
h11=temp1|temp1>>1|temp1>>2|temp1>>3;
h12=temp2|temp2>>1|temp2>>2|temp2>>3;
h13=temp3|temp3>>1|temp3>>2|temp3>>3;
h14=temp4|temp4>>1|temp4>>2|temp4>>3;
h15=temp5|temp5>>1|temp5>>2|temp5>>3;
h16=temp6|temp6>>1|temp6>>2|temp6>>3;
h17=temp7|temp7>>1|temp7>>2|temp7>>3;
h18=temp8|temp8>>1|temp8>>2|temp8>>3;
d1=h11|h12;
d2=h13|h14;
d3=h15|h16;
d4=h17|h18;
LCMDATA=d1;
LCMDATA=d2;
LCMDATA=d3;
LCMDATA=d4;
}
for(n=0;n<32;n++) LCMDATA=0x00;//There are 384-320= segment need to write data }
}
四、Window program
4.2): When column address(WPC) increase by one,three pixel will be displayed .
So,segment must be 3 integral multiples in window program.
For example: 33*32 B/W picture and 8bit parallel mode.
Code as follow:
void window_display(void)
{int k=0;
int i,j;
int m=0;
unsigned char temp,temp1,temp2,temp3,temp4,temp5,temp6,temp7,temp8;
unsigned char h11,h12,h13,h14,h15,h16,h17,h18,d1,d2,d3,d4;
LCMCOMM=0x0070; //set row msb address
LCMCOMM=0x0060; //set row lsb address
LCMCOMM=0x0010; //set column msb address
LCMCOMM=0x0000; //set column lsb address
LCMCOMM=0x00f4; //set column start address
LCMCOMM=0x0000; //column start address=00
LCMCOMM=0x00f6; //set column end address
LCMCOMM=0x000a; //column end address=11*3RGB=33 segment
LCMCOMM=0x00f5; //set row start address
LCMCOMM=0x0000; // row start address=00
LCMCOMM=0x00f7; //set row end address
LCMCOMM=0x001f; // row end address=32
LCMCOMM=0x00f8; // inside mode
for(i=0;i<32;i++) // 33*32 B/W picture for example
{
for(j=0;j<4;j++)
{
temp=map2[k++]; // turns 1byte B/W data to 4k-color data(RRRR-GGGG-BBBB) temp1=temp&0x80;
temp2=(temp&0x40)>>3;
temp3=(temp&0x20)<<2;
temp4=(temp&0x10)>>1;
temp5=(temp&0x08)<<4;
temp6=(temp&0x04)<<1;
temp7=(temp&0x02)<<6;
temp8=(temp&0x01)<<3;
h11=temp1|temp1>>1|temp1>>2|temp1>>3;
h12=temp2|temp2>>1|temp2>>2|temp2>>3;
h13=temp3|temp3>>1|temp3>>2|temp3>>3;
h14=temp4|temp4>>1|temp4>>2|temp4>>3;
h15=temp5|temp5>>1|temp5>>2|temp5>>3;
h16=temp6|temp6>>1|temp6>>2|temp6>>3;
h17=temp7|temp7>>1|temp7>>2|temp7>>3;
h18=temp8|temp8>>1|temp8>>2|temp8>>3;
d1=h11|h12;
d2=h13|h14;
d3=h15|h16;
d4=h17|h18;
LCMDATA=d1;
LCMDATA=d2;
LCMDATA=d3;
LCMDATA=d4;
}
LCMDATA=picture2[k++];
m=m+1; //must be set row address increase LCMCOMM=0x0070|((m&0xf0)>>4); //set row msb address
LCMCOMM=0x0060|(m&0x0f); //set row lsb address
}
}
unsigned char picture2[]= {
/*-- 调入了一幅图像:C:\\Documents and Settings\\willis.wen\\桌面\\33.bmp --*/
/*-- 宽度x高度=33x32 --*/
/*-- 宽度不是8的倍数,现调整为:宽度x高度=40x32 --*/
0xFF,0xFF,0xFF,0xFF,0x80,0x80,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x9F, 0xFF,0xFF,0xF8,0x00,0x90,0x00,0x00,0x08,0x00,0x90,0x00,0x00,0x08,0x00,0x90,0x00, 0x00,0x08,0x00,0x90,0x00,0x00,0x08,0x00,0x90,0x20,0x20,0x08,0x00,0x90,0x60,0xE0, 0x08,0x00,0x90,0xA0,0x20,0x08,0x00,0x91,0x20,0x20,0x08,0x00,0x91,0x20,0x20,0x08, 0x00,0x92,0x20,0x20,0x08,0x00,0x92,0x20,0x20,0x08,0x00,0x94,0x20,0x20,0x08,0x00, 0x97,0xF8,0x20,0x08,0x00,0x90,0x20,0x20,0x08,0x00,0x90,0x20,0x20,0x08,0x00,0x90, 0x20,0x20,0x08,0x00,0x90,0xF8,0xF8,0x08,0x00,0x90,0x00,0x00,0x08,0x00,0x90,0x00, 0x00,0x08,0x00,0x90,0x00,0x00,0x08,0x00,0x90,0x00,0x00,0x08,0x00,0x90,0x00,0x00,
0x08,0x00,0x90,0x00,0x00,0x08,0x00,0x9F,0xFF,0xFF,0xF8,0x00,0x80,0x00,0x00,0x00, 0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x80 };
//-----------------------------------------end-----------------------------------------------------------------下载本文