/********************************************************** ÇåÆÁ×Óº¯Êý **********************************************************/ void LCD_clear(uchar n) { uint num; LCD_SetRamAddr(0,127, 0,159); for(num=20480;num>0;num--) //160*128=20480 { LCD_Wirte_Data16(colors[n]); } }
void LCD_init(void) { uint num; Reg_Write(0x0001,0x0002); //MODE_SEL1 Reg_Write(0x0002,0x0012); //MODE_SEL2 Reg_Write(0x0003,0x0000); //MODE_SEL3 Reg_Write(0x0004,0x0010); //MODE_SEL3 LCD_SetRamAddr(0,127, 0,159); for(num=20480;num>0;num--) LCD_Wirte_Data16(0xffff); Reg_Write(0x0005,0x0008); //VCO_MODE Reg_Write(0x0007,0x007f); //VCOMHT_CTRL Reg_Write(0x0008,0x0017); //VCOMLT_CTRL Reg_Write(0x0009,0x0000); //write SRAM window start X point Reg_Write(0x0010,0x0000); //write SRAM window start y point Reg_Write(0x0011,0x0083); //write SRAM window end x point Reg_Write(0x0012,0x009f); //write SRAM window end y point Reg_Write(0x0017,0x0000); //SRAM contrl Reg_Write(0x0018,0x0000); //SRAM x position Reg_Write(0x0019,0x0000); //SRAM y position Reg_Write(0x0006,0x00c5); //DAC_OP_CTRL2 delay_ms(10); //ÑÓʱ }
/********************************************************** дºº×Ö×Óº¯Êý **********************************************************/ void ChineseChar(uint x,uint y,int size,uint For_color,uint Bk_color ,char c) { int e=0,i,j; int ed; uint ncols; uint nrows; uint nbytes; uchar *pfont; uchar *pchar; uchar *fonttable[]={(uchar *)hz12,(uchar *)hz16,(uchar *)hz24}; pfont=(uchar *)fonttable[size]; if(size==0) { ncols =12-1; nrows =12-1; nbytes =24; //(12*12)/72 } else if(size==1) { ncols =16-1; nrows =16-1; nbytes =32; //(16*16)/72 } else if(size==2) { ncols =24-1; nrows =24-1; nbytes =72; //(24*24)/72 } pchar=pfont + (nbytes*(c-1)); LCD_SetRamAddr(x, x+nrows, y,y+ncols); for(i=0;i<nbytes;i++) { ed=*pchar++; if(size==0) { if(i%2==0) e=8; else e=4; } else e=8; for(j=0;j<e;j++) if((ed>>j)&0x01) { LCD_Wirte_Data16(For_color); //textcolor } else { LCD_Wirte_Data16(Bk_color); //backcolor } }