freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

單片機(jī)課程設(shè)計(jì)--計(jì)算器-資料下載頁(yè)

2025-01-18 14:29本頁(yè)面
  

【正文】 ifndef __KEY_H__define __KEY_H__define KeyPort P3/*將跳線帽套在 J5 的 BIN 針上獨(dú)立按鍵掃描函數(shù),返回掃描鍵值左邊一列從上向下對(duì)應(yīng) P30,P31,P32,P33分別是 0,1,2,3 號(hào)鍵*/void delay50us(unsigned int t) //50us 延時(shí){unsigned char j。 22for(。t0。t) for(j=19。j0。j) 。}unsigned char KeyScan(void) //鍵盤(pán)掃描函數(shù),使用行列逐級(jí)掃描法{unsigned char Val。KeyPort=0xf0。//高四位置高,低四位拉低if(KeyPort!=0xf0)//表示有按鍵按下{ delay50us(200)。 //去抖if(KeyPort!=0xf0){ //表示有按鍵按下 KeyPort=0xfe。 //檢測(cè)第一行if(KeyPort!=0xfe) { Val=KeyPortamp。0xf0。 Val+=0x0e。 while(KeyPort!=0xfe)。 delay50us(200)。 //去抖 while(KeyPort!=0xfe)。 return Val。 } KeyPort=0xfd。 //檢測(cè)第二行if(KeyPort!=0xfd) { Val=KeyPortamp。0xf0。 Val+=0x0d。23 while(KeyPort!=0xfd)。 delay50us(200)。 //去抖 while(KeyPort!=0xfd)。 return Val。 } KeyPort=0xfb。 //檢測(cè)第三行if(KeyPort!=0xfb) { Val=KeyPortamp。0xf0。 Val+=0x0b。 while(KeyPort!=0xfb)。 delay50us(200)。 //去抖 while(KeyPort!=0xfb)。 return Val。 } KeyPort=0xf7。 //檢測(cè)第四行if(KeyPort!=0xf7) { Val=KeyPortamp。0xf0。 Val+=0x07。 while(KeyPort!=0xf7)。 delay50us(200)。 //去抖 while(KeyPort!=0xf7)。 return Val。 }}} return 0xff。}24unsigned char KeyPro(void){ switch(KeyScan()) { case 0xbe:return 39。939。break。//4 9 case 0xbd:return 39。639。break。//5 6 case 0xbb:return 39。339。break。//6 3 case 0xde:return 39。839。break。//8 8 case 0xdd:return 39。539。break。//9 5 case 0xdb:return 39。239。break。//a 2 case 0xd7:return 39。039。break。//b 0 case 0xee:return 39。739。break。//c 7 case 0xed:return 39。439。break。//d 4 case 0xeb:return 39。139。break。//e 1 case 0xe7:return 39。c39。break。//f ccase 0x7e:return 39。/39。break。//0 按下相應(yīng)的鍵顯示相對(duì)應(yīng)的碼值 / case 0x7d:return 39。*39。break。//1 x case 0x7b:return 39。39。break。//2 case 0x77:return 39。+39。break。//3 + case 0xb7:return 39。=39。break。//7 = default:return 0xff。break。 }}endif數(shù)碼管輸出函數(shù):ifndef __DISPLAY_H__define __DISPLAY_H__define uchar unsigned char25define uint unsigned int//0 1 2 3 4 5 6 7 8 9 滅 _unsigned char code DuanMa[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xbf,0xff,0xf7,0xab,0x8e}。 //共陽(yáng) unsigned char code WeiMa[]={0x01,0x02,0x04,0x08,0x10,0x20}。//分別對(duì)應(yīng)相應(yīng)的數(shù)碼管點(diǎn)亮,即位碼 define DataPort P0 //定義數(shù)據(jù)端口 程序中遇到 DataPort 則用 P0 替換void delay_50us(uint t) //50us 延時(shí) {uchar j。 for(。t0。t) for(j=19。j0。j) 。}void SEG_Latch(void) //段碼鎖存子程序 {P2|=0x01。_nop_()。P2amp。= 0xfe。}void BIT_Latch(void) //位碼鎖存子程序 {P2|= 0x02。 //~=110,Y6=0,Y6C=1,即 U8 的 LE=1,位碼數(shù)據(jù)選通 26_nop_()。P2amp。= 0xfd。 //~=000,Y6=1,Y6C=0,即 U8 的 LE=0,位碼數(shù)據(jù)被鎖存 } void display(uchar *point){unsigned char i=0。for(i=0。i6。i++){ DataPort=WeiMa[i]。BIT_Latch()。DataPort=DuanMa[*(point+i)]。 //取顯示數(shù)據(jù),段碼 SEG_Latch()。 delay_50us(20)。 // 掃描間隙延時(shí),時(shí)間太長(zhǎng)會(huì)閃爍,太短不亮 DataPort=0xff。 //關(guān)顯示,消除重影 SEG_Latch()。 }}endif附錄二 Protel 仿真電路27附錄三 Proteus 仿真電路28
點(diǎn)擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1