|
關(guān)鍵用“P”表示
模式鍵用“M”表示
具體看程序
歲東方不敗不蹦不.png (24.24 KB, 下載次數(shù): 23)
下載附件
2018-1-19 21:12 上傳
單片機(jī)源程序如下:
- /*******************************************************************************
- --------------------------------------------------------------------------------
- * 實 驗 名 : 紅外線顯示試驗
- * 實驗說明 : LCD1602顯示接收到的紅外線鍵值。
- * 連接方式 : 見連接圖
- * 注 意 :
- *******************************************************************************/
- #include<reg51.h>
- #include"lcd.h"
- sbit IRIN=P3^2;
- unsigned char code CDIS1[13]={" MCU GROUP "};
- unsigned char code CDIS2[13]={" IR-CODE:- "};
- unsigned char IrValue[6];
- unsigned char Time;
- void IrInit();
- void DelayMs(unsigned int );
- char Code2Char(int High, int Low);
- /*******************************************************************************
- * 函數(shù)名 : main
- * 函數(shù)功能 : 主函數(shù)
- * 輸入 : 無
- * 輸出 : 無
- *******************************************************************************/
- void main()
- {
- unsigned char i;
- //紅外初始化
- IrInit();
- //LCD初始化
- LcdInit();
- //
- LcdWriteCom(0x80);
-
- for(i=0;i<13;i++)
- {
- LcdWriteData(CDIS1[i]);
- }
- LcdWriteCom(0x80+0x40);
- for(i=0;i<13;i++)
- {
- LcdWriteData(CDIS2[i]);
- }
- while(1)
- {
- char Number;
- IrValue[4]=IrValue[2]>>4; //高位
- IrValue[5]=IrValue[2]&0x0f; //低位
- //LcdWriteCom(0xc0+0x00);
- //LcdWriteData(IrValue[4]);
- //LcdWriteCom(0xc0+0x01);
- //LcdWriteData(IrValue[5]);
- // if(IrValue[4]>9)
- // {
- // LcdWriteCom(0x80+0x12); //設(shè)置顯示位置
- // LcdWriteData(0x37+IrValue[4]); //將數(shù)值轉(zhuǎn)換為該顯示的ASCII碼
- // }
- // else
- // {
- // LcdWriteCom(0x80+0x12);
- // LcdWriteData(IrValue[4]+0x30); //將數(shù)值轉(zhuǎn)換為該顯示的ASCII碼
- // }
- // if(IrValue[5]>9)
- // {
- // LcdWriteCom(0x80+0x13);
- // LcdWriteData(IrValue[5]+0x37); //將數(shù)值轉(zhuǎn)換為該顯示的ASCII碼
- // }
- // else
- // {
- // LcdWriteCom(0x80+0x13);
- // LcdWriteData(IrValue[5]+0x30); //將數(shù)值轉(zhuǎn)換為該顯示的ASCII碼
- // }
- ……………………
- …………限于本文篇幅 余下代碼請從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載(單片機(jī)源碼+視頻):
available.rar
(17.07 MB, 下載次數(shù): 76)
2018-1-19 21:03 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
|