#include#include#define??uchar?????u">
hd44780源程序

hd44780源程序

ID:44753222

大?。?1.00 KB

頁數(shù):7頁

時間:2019-10-28

hd44780源程序_第1頁
hd44780源程序_第2頁
hd44780源程序_第3頁
hd44780源程序_第4頁
hd44780源程序_第5頁
資源描述:

《hd44780源程序》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。

1、/*LCD型號:HD44780???????*//*打印機型號:EPSONM311???*/#include#include#include#define??uchar?????unsignedchar#define??uint??????unsignedint???????????????????????????????????//定義8255I/O端口地址#define??PCC8255???XBYTE[0x007f]???//8255命令口地址#define??PC8255????XBY

2、TE[0x007e]???//8255的PC口地址#define??PB8255????XBYTE[0x007d]???//8255的PC口地址#define??PA8255????XBYTE[0x007c]???//8255的PC口地址sfr??????RPCTL??????=0xD8;sbit?????RPCTL_5????=RPCTL^5;sbit?????LS164A?????=P2^5;sbit?????LS164cp????=P2^6;sbit?????Print_busy=P3^3;sbit?????IC_RST?????=P1^1;sb

3、it?????IC_CLK?????=P1^0;sbit?????IC_IO??????=P1^2;sbit?????IC_PGM?????=P3^2;ucharcodetable1[16]="FEDCBA9870123456";ucharcodetable2[16]="0000123456789ABC";void??INIT_8255(void);????????????/*初始化8255*/void??LcdInit(void);??????????????/*LCD初始化函數(shù)*/void??LcdCmd(uchar);??????????????

4、/*LCD控制命令函數(shù)*/void??LcdData(uchar);?????????????/*LCD數(shù)據(jù)輸入函數(shù)*/void??LcdClr(void);???????????????/*LCD清屏函數(shù)*/void??LcdStr(uchar*);????????????/*顯示字符串函數(shù)*/void??LcdDisp(ucharx,uchard);void??Delay_msec(uintx);?????????/*延時函數(shù)*/ucharGetkey(void);???????????????/*鍵盤函數(shù)*/void??PrintInit(voi

5、d);????????????/*打印初始化函數(shù)*/void??PrintData(uchar??d);???????/*打印函數(shù)*/void??PrintString(uchar*p);??????//打印字符串voidLcdDisp(ucharx,uchard)????//指定位置顯示字符x:LCD位置d:字符{??if(x<9)??{?????LcdCmd(0x80+x);?????LcdData(d);??}??else??{?????LcdCmd(0xc0+x);?????LcdData(d);??}}voidLcdStr(uchar*p)?

6、???????/*顯示字符串函數(shù)*/{???datauchari;???LcdCmd(0x80);?????????????//設(shè)置顯示數(shù)據(jù)RAM???for(i=0;i<=7;i++)???{????????LcdData(*p);?????????/*charofLCM*/????????p++;???}??????LcdCmd(0xc0);?????????????//設(shè)置顯示數(shù)據(jù)RAM???for(i=0;i<=7;i++)???{????????LcdData(*p);????????/*charofLCM*/????????p++;???}

7、}void??LcdClr()???????????????/*LCD清屏函數(shù)-----通過送0x20清屏*/{???datauchari;???LcdCmd(0x80);?????????????//設(shè)置顯示數(shù)據(jù)RAM???for(i=0;i<=7;i++)????????LcdData(0x20);????????/*charofLCM*/???LcdCmd(0xc0);?????????????//設(shè)置顯示數(shù)據(jù)RAM???for(i=0;i<=7;i++)????????LcdData(0x20);?????????/*charofLCM*/}

8、voidLcdClr1(void)???????????/*LCD清屏函數(shù)-----通過控制

當(dāng)前文檔最多預(yù)覽五頁,下載文檔查看全文

此文檔下載收益歸作者所有

當(dāng)前文檔最多預(yù)覽五頁,下載文檔查看全文
溫馨提示:
1. 部分包含數(shù)學(xué)公式或PPT動畫的文件,查看預(yù)覽時可能會顯示錯亂或異常,文件下載后無此問題,請放心下載。
2. 本文檔由用戶上傳,版權(quán)歸屬用戶,天天文庫負責(zé)整理代發(fā)布。如果您對本文檔版權(quán)有爭議請及時聯(lián)系客服。
3. 下載前請仔細閱讀文檔內(nèi)容,確認(rèn)文檔內(nèi)容符合您的需求后進行下載,若出現(xiàn)內(nèi)容與標(biāo)題不符可向本站投訴處理。
4. 下載文檔時可能由于網(wǎng)絡(luò)波動等原因無法下載或下載錯誤,付費完成后未能成功下載的用戶請聯(lián)系客服處理。