国精品无码一区二区三区,国产精品久久久久五码午夜,99视频精品全部国产盗摄,在线观看免费h视频网站,亚洲国产成人超a在线播放,成年无码按摩av片在线

新聞詳情

液晶模塊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();
}

临泉县| 天峻县| 新泰市| 安新县| 南投县| 疏勒县| 栾川县| 双桥区| 滦平县| 犍为县| 阜南县| 壤塘县| 赞皇县| 仪陇县| 吴旗县| 台中市| 隆昌县| 威宁| 澄城县|