一级国产片网站_手机视频 在线精品_久久精品国产亚洲7777_色777狠狠狠综合伊人_永久免费精品黄页入口_天天综合网日韩_17C丨国产丨精品入口永久地址_97天天日夜夜操_91在线无码精品秘 国产_嫩草研究院在线_10000部精品mv免费_亚洲国产精品无码久久_亚洲中文久久久久久精品国产_午夜福利理论片在线观看_91福利在线观看_手机在线一区二区久久_日木特级黄色a大片

新聞詳情

液晶模塊HG128641與8051單片機(jī)應(yīng)用示例-2

日期:2025-07-25 01:19
瀏覽次數(shù):1244
摘要:

液晶模塊HG128641與8051單片機(jī)應(yīng)用示例-2  接上一篇

四‘、液晶模塊HG128641與8051單片機(jī)連接電路圖:
   

五、HG128641與8051單片機(jī)示例程序(寫(xiě)指令寫(xiě)數(shù)據(jù)等主要子程序)

/************
  延時(shí)子程序
*****************/
void Delay(uint t)
{uint i,j;
for(i=0;i<t;i++)
for(j=0;j<305;j++)
_nop_();_nop_();_nop_();_nop_();
}
/***********
 忙判斷子程序
************/
void Busy()
{
 A0=0;
 RW=1;
buslcd=0xff;
 E=1;
_nop_();
while(buslcd&0x80);
E=0;
_nop_();
}
/*********************
 寫(xiě)入左半屏指令 子程序
**********************/
void Writecom1(uchar wcom)
{
CS1=1;CS2=0;
 Busy();
 buslcd=wcom;
 A0=0;
 RW=0;
 E=1;
_nop_();
  E=0;
_nop_();}
/*********************
 寫(xiě)入左半屏數(shù)據(jù) 子程序
**********************/
void Writedata1(uchar wdata)
{
CS1=1;CS2=0;
 Busy();
 buslcd=wdata;
 A0=1;
 RW=0;
 E=1;
_nop_();
 E=0;
_nop_();}
/*********************
 寫(xiě)入右半屏指令 子程序
***********************/
void Writecom2(uchar wcom)
{
CS1=0;CS2=1;
 Busy();
 buslcd=wcom;
 A0=0;
 RW=0;
 E=1;
_nop_();
  E=0;
_nop_();}
/************************
 寫(xiě)入右半屏數(shù)據(jù) 子程序
*************************/
void Writedata2(uchar wdata)
{
CS1=0;CS2=1;
 Busy();
 buslcd=wdata;
 A0=1;
 RW=0;
 E=1;
_nop_();
 E=0;
_nop_();}

/*********************
讀出左半屏數(shù)據(jù) 子程序
**********************/
uchar Readdata1()
{
uchar rdata;
CS1=1;CS2=0;
 Busy();
 A0=1;
 RW=1;
 E=1;
 rdata=buslcd;
_nop_();_nop_();_nop_();
 E=0;
_nop_();
return rdata;
}
/**********************
讀出右半屏數(shù)據(jù) 子程序
****************************/
uchar Readdata2()
{
uchar rdata;
CS1=0;CS2=1;
 Busy();
 A0=1;
 RW=1;
 E=1;
 rdata=buslcd;
_nop_();_nop_();_nop_();
 E=0;
_nop_();
return rdata;
}
/*********************
    清屏子程序
****************************/
void Clear(void)
{uchar i,j;
for(i=0;i<8;i++)
{Writecom1(0xb8+i);Writecom1(0x40);
Writecom2(0xb8+i);;Writecom2(0x40);
for(j=0;j<64;j++)
{Writedata1(0);Writedata2(0);}}
}
/**********************
    液晶初始化子程序
***********************/
void INT()
{
Delay(3);
Writecom1(0x3f);
Writecom2(0x3f);
Writecom1(0xc0);
Writecom2(0xc0);
Writecom1(0xb8);
Writecom2(0xb8);
Writecom1(0x40);
Writecom2(0x40);
Clear();
}