找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2468|回復(fù): 0
收起左側(cè)

4*6行列鍵盤的單片機(jī)驅(qū)動源程序

[復(fù)制鏈接]
ID:410814 發(fā)表于 2018-10-24 16:29 | 顯示全部樓層 |閱讀模式
引腳參照圖片 QQ圖片20181024162606.png

單片機(jī)源程序如下:

#include <STC89.H>
#include "Keypad.h"

//                                                鍵值   鍵釋放時間 鍵按下時間
char KeyNum;
unsigned int  KeyUpCnt,KeyDownCnt;


char KeyScan()
{
        P1 |= 0xFC;
        P2 = (P2&0xF0) | (0x0E);
          if(!P17)return 0x11;//ON/C
          if(!P16)return '7'; //7
          if(!P15)return '8'; //8
          if(!P14)return '9'; //9
          if(!P13)return '*'; //x
          if(!P12)return '/'; //÷
        
        P1 |= 0xFC;
        P2 = (P2&0xF0) | (0x0D);
          if(!P17)return 0x12;//+/-
          if(!P16)return '4';   //4
          if(!P15)return '5';   //5
          if(!P14)return '6';   //6
          if(!P13)return '-'; //-
          if(!P12)return 0x13;//MRC
        
        P1 |= 0xFC;
        P2 = (P2&0xF0) | (0x0B);
          if(!P17)return '%'; //%
          if(!P16)return '1';   //1
          if(!P15)return '2';   //2
          if(!P14)return '3';   //3
          if(!P13)return '+'; //+
          if(!P12)return 0x14;//M-
               
        P1 |= 0xFC;
        P2 = (P2&0xF0) | (0x07);
          if(!P17)return '?'; //?
          if(!P16)return '0';   //0
          if(!P15)return '.'; //.
          if(!P14)return '='; //=
          if(!P13)return '+'; //+
          if(!P12)return 0x15;//M+
               
        P2 = (P2&0xF0) | (0x0F);
        return -1;
}

0.png

全部資料51hei下載地址:
4x6行列鍵盤驅(qū)動.rar (3.43 KB, 下載次數(shù): 13)



評分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表