矩陣鍵盤及其數(shù)碼管顯示_第1頁
矩陣鍵盤及其數(shù)碼管顯示_第2頁
矩陣鍵盤及其數(shù)碼管顯示_第3頁
矩陣鍵盤及其數(shù)碼管顯示_第4頁
矩陣鍵盤及其數(shù)碼管顯示_第5頁
已閱讀5頁,還剩2頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、矩陣鍵盤及其數(shù)碼管顯示電路圖如上圖所示。程序是用C語言編寫的。程序如下:#include<reg52.h>#define uint unsigned int#define uchar unsigned charuchar code table=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c, 0x39,0x5e,0x79,0x71,0x00;sbit wela=P27;sbit dula=P26;uchar num=17,temp;void delay(uint z);void main()wela=1;P1=

2、0xc0;wela=0;dula=1;P1=0x00;dula=0;while(1)P3=0xfe;temp=P3;temp=temp&0xfe;while(temp!=0xfe)delay(5);temp=P3;switch(temp)case 0xee: num=1; break;case 0xde: num=2; break;case 0xbe: num=3; break;case 0x7e: num=4; break;while(temp!=0xfe)temp=P3;temp=temp&0xfe; dula=1;P1=tablenum-1;dula=0;P3=0xfd;

3、temp=P3;temp=temp&0xfd;while(temp!=0xfd)delay(5);temp=P3;switch(temp)case 0xed: num=5; break;case 0xdd: num=6; break;case 0xbd: num=7; break;case 0x7d: num=8; break;while(temp!=0xfd)temp=P3;temp=temp&0xfd;dula=1;P1=tablenum-1;dula=0;P3=0xfb;temp=P3;temp=temp&0xfb;while(temp!=0xfb)delay(5

4、);temp=P3;switch(temp)case 0xeb: num=9; break;case 0xdb: num=10; break;case 0xbb: num=11; break;case 0x7b: num=12; break;while(temp!=0xfb)temp=P3;temp=temp&0xfb;dula=1;P1=tablenum-1;dula=0;P3=0xf7;temp=P3;temp=temp&0xf7;while(temp!=0xf7)delay(5);temp=P3;switch(temp)case 0xe7: num=13; break;case 0xd7: num=14; break;case 0xb7: num=15; break;case 0x77: num=16; break;while(temp!=0xf7)temp=P3;temp=temp&0xf7;dula=1;P1=tablenum-1;dula

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論