|
單片機源程序如下:
- /*******************************************************************************
- --------------------------------------------------------------------------------
- * 實 驗 名 : LCD1602顯示試驗
- * 實驗說明 : LCD1602第一行Pechin Science,第二行顯示W(wǎng)elcome to the world
- * * of MCU。并一直移動。
- * 連接方式 : 見連接圖
- * 注 意 :
- *******************************************************************************/
- #include<reg51.h>
- #include"lcd.h"
- //--定義全局變量--//
- unsigned char PuZh[16] = " Pechin Science ";
- unsigned char CnCh[27] = "Welcome to the world of MCU";
- //--聲明全局變量--//
- void Delay10ms(unsigned int c); //誤差 0us
- /*******************************************************************************
- * 函 數(shù) 名 : main
- * 函數(shù)功能 : 主函數(shù)
- * 輸 入 : 無
- * 輸 出 : 無
- *******************************************************************************/
- void main(void)
- {
- unsigned char i;
- LcdInit();
-
- //--寫第一行--//
- for(i=0; i<16; i++)
- {
- LcdWriteData(PuZh[i]);
- }
- //--寫第二行
- LcdWriteCom(0xC0); //設(shè)置坐標(biāo)在第二行
- for(i=0; i<27; i++)
- {
- LcdWriteData(CnCh[i]);
- }
- LcdWriteCom(0x07); //設(shè)置每寫一次整屏右移
- while(1)
- {
- LcdWriteCom(0xC0); //設(shè)置坐標(biāo)在第二行
- for(i=0; i<27; i++)
- {
- LcdWriteData(CnCh[i]);
- Delay10ms(50);
- }
-
- }
- }
- /*******************************************************************************
- * 函 數(shù) 名 : Delay10ms
- * 函數(shù)功能 : 延時函數(shù),延時10ms
- * 輸 入 : 無
- * 輸 出 : 無
- *******************************************************************************/
- void Delay10ms(unsigned int c) //誤差 0us
- {
- ……………………
- …………限于本文篇幅 余下代碼請從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
16、液晶屏LCD1602.zip
(1.35 MB, 下載次數(shù): 23)
2018-5-5 17:36 上傳
點擊文件名下載附件
液晶屏
|
評分
-
查看全部評分
|