資源簡介
用51單片機驅(qū)動160160液晶顯示字符 漢字 圖片 數(shù)字

代碼片段和文件信息
#include“160160.h“
void?delay_us(uint?us)
{
while(us--);
}
void?delay_ms(uint?ms)
{
uchar?i;
while(ms--)
for(i=0;i<120;i++);
}
/*uchar?read(bit?flag)
{
uchar?temp;
dport=0xff;
cs=0;
rs=flag;
rd=0;
wr=1;
temp=P1;
rd=1;
return?temp;
} ???*/
void?write(bit?flaguchar?dat)
{
cs=0;
rs=flag; //flag=1write?command;flag=0write?data
wr=0;
rd=1;
dport=dat;
wr=1;
}
void?init(void)
{
cs=0;
//reset
rst=0;
delay_ms(2); //power?on?reset
rst=1;
delay_ms(200);
write(00xe2); //reset?by?command
delay_ms(2);
//power?control
write(00xe9); //Bias?Ratio:1/10?bias
write(00x2b); //power?control?set?as?internal?power
write(00x24); //set?temperate?compensation?as?0%
write(00x81); //electronic?potentionmeter
write(0198); ???//0xc6不起作用
//display?control
write(00xa4);//關(guān)閉所有像素 //all?pixel?off?
//write(00xa5);//打開所有像素點?即點亮整個屏幕
write(00xa6);//關(guān)閉像素反顯?決定屏幕反顯 //inverse?display?off
// write(00xa7);?//打開像素反顯?決定屏幕反顯
//lcd?control
write(00xc0); //19:partial?display?and?MX?disableMY?enable
// write(00xc7);//不管用??
write(00xa3); //line?rate?15.2klps
write(00xd1); //rgb-rgb
//?write(00xd0);//BGR-BGR
write(00xd5); //4k?color?mode ?12-bit/RGB
???//?write(00xd6); //64K?color?mode?5R-6G-5B?16-bit/RGB
write(00x84); //12:partial?display?control?disable
//n-line?inversion
write(00xc8);
//write(00x10); //enable?NIV
//com?scan?fuction
write(00xda); //enable?FRCPWMLRM?sequence
//window?顯示窗口大小設(shè)置
write(00xf4); //wpc0:column starting?column?address 列起始地址
write(00x25); //start?from?130???37
write(00xf6); //wpc1 ?ending?column?address ?列結(jié)束地址
write(00x5A); //end:272? ???90
//因為列開始到結(jié)尾共90-37=53個數(shù)所以?一個數(shù)代表160/53=3個像素
write(00xf5); //wpp0:row ?starting?row?address ??行起始地址
write(00x00); //start?from?0
write(00xf7); //wpp1 ?ending??row?address ???行結(jié)束地址
write(00x9F); //end?160??0x9F=159
//行開始到結(jié)束共160個數(shù)所以一個數(shù)代表160/160=1個像素
write(00xf8); //inside?mode???set?window?program?mode
write(00x89); //RAM?control???地址自動加一????AC1=0?列先增加 ??AC2=0??控制行增加+1還是-1 ?AC0=1
????//write(00x8b); ???//是0x89的90°翻轉(zhuǎn)顯示 AC1=1?行先增加 ?AC0=1
????//write(00x8d); ???// ????AC1=0?????????????AC2=1??控制行增加+1還是-1 ?AC0=1
//write(00x8a);
write(00xad); //display?onselect?on/off?mode.Green?Enhance?mode?disable ?背景深黑雪花
//write(00xa8);//wrong
???// write(00xa9);//和0xad一個效果??有雪花
???// write(00xac); //wrong
????//write(00xaf); ?//另一種灰度??淺黑雪花
//scroll?line?滾動行
write(00x40); //low?bit?of?scroll?line
write(00x50); //high?bit?of?scroll?line
write(00xc4); //19enable?FLT?and?FLB
write(00x90); //14:FLTFLB?set
write(00x00);
//partial?display?部分顯示
write(00x84); //12set?partial?display?control:off
write(00xf1); //com?end
write(00x9f); //160
write(00xf2); //display?start?
write(00)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????121855??2013-11-01?17:18??80C51單片機驅(qū)動160160液晶顯示的程序\font.h
?????文件??????12852??2013-11-04?09:23??80C51單片機驅(qū)動160160液晶顯示的程序\160160.c
?????文件???????2894??2013-11-01?17:19??80C51單片機驅(qū)動160160液晶顯示的程序\main.c
?????文件???????1138??2013-11-01?17:11??80C51單片機驅(qū)動160160液晶顯示的程序\160160.h
?????目錄??????????0??2013-10-31?10:40??80C51單片機驅(qū)動160160液晶顯示的程序
-----------?---------??----------?-----??----
???????????????138739????????????????????5
評論
共有 條評論