国产精品成熟女人嫖,2020资源在线播放,在线观看一区无码专区,国产精品爱草草视频,色欲天香天天影院综合无码,福利视频一区二区苏其

新聞詳情

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

日期:2025-04-21 09:22
瀏覽次數(shù):1138
摘要:

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

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

五、HG128641與8051單片機(jī)示例程序(寫指令寫數(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_();
}
/*********************
 寫入左半屏指令 子程序
**********************/
void Writecom1(uchar wcom)
{
CS1=1;CS2=0;
 Busy();
 buslcd=wcom;
 A0=0;
 RW=0;
 E=1;
_nop_();
  E=0;
_nop_();}
/*********************
 寫入左半屏數(shù)據(jù) 子程序
**********************/
void Writedata1(uchar wdata)
{
CS1=1;CS2=0;
 Busy();
 buslcd=wdata;
 A0=1;
 RW=0;
 E=1;
_nop_();
 E=0;
_nop_();}
/*********************
 寫入右半屏指令 子程序
***********************/
void Writecom2(uchar wcom)
{
CS1=0;CS2=1;
 Busy();
 buslcd=wcom;
 A0=0;
 RW=0;
 E=1;
_nop_();
  E=0;
_nop_();}
/************************
 寫入右半屏數(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();
}

昌吉市| 安宁市| 衢州市| 当雄县| 盐津县| 庄浪县| 安吉县| 新闻| 广水市| 青田县| 湄潭县| 建瓯市| 科技| 安阳县| 洱源县| 定州市| 右玉县| 汨罗市| 雷山县|