液晶顯示器控制設(shè)計(jì)_含源程序代碼
實(shí)驗(yàn)原理圖
本文引用地址:http://cafeforensic.com/article/172877.htm實(shí)驗(yàn)程序
#includereg51.h>
#includestdio.h>
#includestdlib.h>
#includeintrins.h>
#includeabsacc.h>
#define busy 0x80 //用于檢測(cè)LCD 狀態(tài)字中的Busy 標(biāo)識(shí)
#define RSaddr 0x1000
#define RWaddr 0x2000
#define CSaddr 0x0400
#define adtn 0xc8ff
#define wc 0xcfff
#define wd 0xdfff
#define rc 0xefff
unsigned char code homepage[] = {www.ispdown.com};
unsigned char code email[] = {ispdown@21cn.com};
//5ms 延時(shí)
void delay5ms(void)
{
unsigned int TempCyc = 5552;
while(TempCyc--);
}
//----------------------------------
//400ms 延時(shí)
void delay400ms(void)
{
unsigned char TempCycA = 5;
unsigned int TempCycB;
while(TempCycA--)
{
TempCycB=7269;
while(TempCycB--);
};
}
//--------------------------------
void waitLcd()
{
char temp;
bit flag=1;
while(flag==1)
{
//temp=XBYTE[CSaddr+RWaddr+adtn];
temp=XBYTE[rc];
if (temp>>7==0) flag=0;
P1=temp;
}
P1=0xff;
}
//---------------------------------
void WC_Lcd(bit isCheck,char c)
{
if (isCheck==1) waitLcd();
//XBYTE[CSaddr+adtn]=c;
XBYTE[wc]=c;
}
//--------------------------------
void WD_Lcd(char c)
{
waitLcd();
//XBYTE[CSaddr+RSaddr+adtn]=c;
XBYTE[wd]=c;
}
//----------------------------------
void LcdInit()
{
delay5ms();
蜂鳴器相關(guān)文章:蜂鳴器原理
評(píng)論