|
51鍵盤及數(shù)字輸入顯示
主程序
LCD.C文件
LCD.H文件- #ifndef __LCD_H_
- #define __LCD_H_
- /**********************************
- 當(dāng)使用的是4位數(shù)據(jù)傳輸?shù)臅r候定義,
- 使用8位取消這個定義
- **********************************/
- //#define LCD1602_4PINS
- /**********************************
- 包含頭文件
- **********************************/
- #include<reg51.h>
- //---重定義關(guān)鍵詞---//
- #ifndef uchar
- #define uchar unsigned char
- #endif
- #ifndef uint
- #define uint unsigned int
- #endif
- /**********************************
- PIN口定義
- **********************************/
- #define LCD1602_DATAPINS P0
- sbit LCD1602_E=P2^7;
- sbit LCD1602_RW=P2^5;
- sbit LCD1602_RS=P2^6;
- /**********************************
- 函數(shù)聲明
- **********************************/
- /*在51單片機(jī)12MHZ時鐘下的延時函數(shù)*/
- void Lcd1602_Delay1ms(uint c); //誤差 0us
- /*LCD1602寫入8位命令子函數(shù)*/
- void LcdWriteCom(uchar com);
- /*LCD1602寫入8位數(shù)據(jù)子函數(shù)*/
- void LcdWriteData(uchar dat) ;
- /*LCD1602初始化子程序*/
- void LcdInit();
- #endif
復(fù)制代碼
|
-
評分
-
查看全部評分
|