三種方法讀取鍵值 使用者設(shè)計(jì)行列鍵盤介面,一般常採(cǎi)用三種方法讀取鍵值。 中斷式 在鍵盤按下時(shí)產(chǎn)生一個(gè)外部中斷通知CPU,並由中斷處理程式通過(guò)不同位址讀資料線上的狀態(tài)判斷哪個(gè)按鍵被按下。 本實(shí)驗(yàn)採(cǎi)用中斷式實(shí)現(xiàn)使用者鍵盤介面。 掃描法 對(duì)鍵盤上的某一行送低電位,其他為高電位,然後讀取列值,若列值中有一位是低,表明該行與低電位對(duì)應(yīng)列的鍵被按下。否則掃描下一行。 反轉(zhuǎn)法 先將所有行掃描線輸出低電位,讀列值,若列值有一位是低表明有鍵按下;接著所有列掃描線輸出低電位,再讀行值。 根據(jù)讀到的值組合就可以查表得到鍵碼。4x4鍵盤按4行4列組成如圖電路結(jié)構(gòu)。按鍵按下將會(huì)使行列連成通路,這也是見(jiàn)的使用者鍵盤設(shè)計(jì)電路。 //-----------4X4鍵盤程序--------------// uchar keboard(void) { uchar xxa,yyb,i,key; if((PINC&0x0f)!=0x0f) //是否有按鍵按下 {delayms(1); //延時(shí)去抖動(dòng) if((PINC&0x0f)!=0x0f) //有按下則判斷 { xxa=~(PINC|0xf0); //0000xxxx DDRC=0x0f; PORTC=0xf0; delay_1ms(); yyb=~(PINC|0x0f); //xxxx0000 DDRC=0xf0; //復(fù)位 PORTC=0x0f; while((PINC&0x0f)!=0x0f) //按鍵是否放開(kāi) { display(data); } i=4; //計(jì)算返回碼 while(xxa!=0) { xxa=xxa>>1; i--; } if(yyb==0x80) key=i; else if(yyb==0x40) key=4+i; else if(yyb==0x20) key=8+i; else if(yyb==0x10) key=12+i; return key; //返回按下的鍵盤碼 } } else return 17; //沒(méi)有按鍵按下 }
上傳時(shí)間: 2013-11-12
上傳用戶:a673761058
The LPC2292/2294 microcontrollers are based on a 16/32-bit ARM7TDMI-S CPU with real-time emulation and embedded trace support, together with 256 kB of embedded high-speed flash memory. A 128-bit wide memory interface and a unique accelerator architecture enable 32-bit code execution at the maximum clock rate. For critical code size applications, the alternative 16-bit Thumb mode reduces code by more than 30 pct with minimal performance penalty. With their 144-pin package, low power consumption, various 32-bit timers, 8-channel 10-bit ADC, 2/4 (LPC2294) advanced CAN channels, PWM channels and up to nine external interrupt pins these microcontrollers are particularly suitable for automotive and industrial control applications as well as medical systems and fault-tolerant maintenance buses. The number of available fast GPIOs ranges from 76 (with external memory) through 112 (single-chip). With a wide range of additional serial communications interfaces, they are also suited for communication gateways and protocol converters as well as many other general-purpose applications. Remark: Throughout the data sheet, the term LPC2292/2294 will apply to devices with and without the /00 or /01 suffix. The suffixes /00 and /01 will be used to differentiate from other devices only when necessary.
標(biāo)簽: lpc datasheet 2292 2294
上傳時(shí)間: 2014-12-30
上傳用戶:aysyzxzm
Keil C51 V8 專業(yè)開(kāi)發(fā)工具(PK51) PK51是為8051系列單片機(jī)所設(shè)計(jì)的開(kāi)發(fā)工具,支持所有8051系列衍生產(chǎn)品,,支持帶擴(kuò)展存儲(chǔ)器和擴(kuò)展指令集(例如Dallas390/5240/400,Philips 51MX,Analog Devices MicroConverters)的新設(shè)備,以及支持很多公司的一流的設(shè)備和IP內(nèi)核,比如Analog Devices, Atmel, Cypress Semiconductor, Dallas Semiconductor, Goal, Hynix, Infineon, Intel, NXP(founded by Philips), OKI, Silicon Labs,SMSC, STMicroeleectronics,Synopsis, TDK, Temic, Texas Instruments,Winbond等。 通過(guò)PK51專業(yè)級(jí)開(kāi)發(fā)工具,可以輕松地了解8051的On-chip peripherals與及其它關(guān)鍵特性。 The PK51專業(yè)級(jí)開(kāi)發(fā)工具包括… l μVision Ø 集成開(kāi)發(fā)環(huán)境 Ø 調(diào)試器 Ø 軟件模擬器 l Keil 8051擴(kuò)展編譯工具 Ø AX51宏匯編程序 Ø ANSI C編譯工具 Ø LX51 連接器 Ø OHX51 Object-HEX 轉(zhuǎn)換器 l Keil 8051編譯工具 Ø A51宏匯編程序 Ø C51 ANSI C編譯工具 Ø BL51 代碼庫(kù)連接器 Ø OHX51 Object-HEX 轉(zhuǎn)換器 Ø OC51 集合目標(biāo)轉(zhuǎn)換器 l 目標(biāo)調(diào)試器 Ø FlashMON51 目標(biāo)監(jiān)控器 Ø MON51目標(biāo)監(jiān)控器 Ø MON390 (Dallas 390)目標(biāo)監(jiān)控器 Ø MONADI (Analog Devices 812)目標(biāo)監(jiān)控器 Ø ISD51 在系統(tǒng)調(diào)試 l RTX51微實(shí)時(shí)內(nèi)核 你應(yīng)該考慮PK51開(kāi)發(fā)工具包,如果你… l 需要用8051系列單片機(jī)來(lái)開(kāi)發(fā) l 需要開(kāi)發(fā) Dallas 390 或者 Philips 51MX代碼 l 需要用C編寫(xiě)代碼 l 需要一個(gè)軟件模擬器或是沒(méi)有硬件仿真器 l 需要在單芯片上基于小實(shí)時(shí)內(nèi)核創(chuàng)建復(fù)雜的應(yīng)用
標(biāo)簽: C51 V8 開(kāi)發(fā)工具
上傳時(shí)間: 2013-10-30
上傳用戶:yy_cn
Single-Ended and Differential S-Parameters Differential circuits have been important incommunication systems for many years. In the past,differential communication circuits operated at lowfrequencies, where they could be designed andanalyzed using lumped-element models andtechniques. With the frequency of operationincreasing beyond 1GHz, and above 1Gbps fordigital communications, this lumped-elementapproach is no longer valid, because the physicalsize of the circuit approaches the size of awavelength.Distributed models and analysis techniques are nowused instead of lumped-element techniques.Scattering parameters, or S-parameters, have beendeveloped for this purpose [1]. These S-parametersare defined for single-ended networks. S-parameterscan be used to describe differential networks, but astrict definition was not developed until Bockelmanand others addressed this issue [2]. Bockelman’swork also included a study on how to adapt single-ended S-parameters for use with differential circuits[2]. This adaptation, called “mixed-mode S-parameters,” addresses differential and common-mode operation, as well as the conversion betweenthe two modes of operation.This application note will explain the use of single-ended and mixed-mode S-parameters, and the basicconcepts of microwave measurement calibration.
上傳時(shí)間: 2014-03-25
上傳用戶:yyyyyyyyyy
多維多選擇背包問(wèn)題(MMKP)是0-1背包問(wèn)題的延伸,背包核已經(jīng)被用來(lái)設(shè)計(jì)解決背包問(wèn)題的高效算法。目的是研究如何獲得一種背包核,并以此高效處理多維多選擇背包問(wèn)題。首先給出了一種方法確定MMKP的核,然后闡述了利用核精確解決MMKP問(wèn)題的B&B算法,列出了具體的算法步驟。在分析了算法的存儲(chǔ)復(fù)雜度后,將算法在各種實(shí)例上的運(yùn)行效果與目前解決MMKP問(wèn)題的常用算法的運(yùn)行效果進(jìn)行了比較,發(fā)現(xiàn)本文的算法性能優(yōu)于以往任何算法。
上傳時(shí)間: 2013-11-20
上傳用戶:wangw7689
目錄 第一章 傳輸線理論 一 傳輸線原理 二 微帶傳輸線 三 微帶傳輸線之不連續(xù)分析 第二章 被動(dòng)組件之電感設(shè)計(jì)與分析 一 電感原理 二 電感結(jié)構(gòu)與分析 三 電感設(shè)計(jì)與模擬 電感分析與量測(cè)
標(biāo)簽: 傳輸線
上傳時(shí)間: 2013-11-21
上傳用戶:qb1993225
題目:利用條件運(yùn)算符的嵌套來(lái)完成此題:學(xué)習(xí)成績(jī)>=90分的同學(xué)用A表示,60-89分之間的用B表示,60分以下的用C表示。 1.程序分析:(a>b)?a:b這是條件運(yùn)算符的基本例子。
上傳時(shí)間: 2015-01-08
上傳用戶:lifangyuan12
RSA算法 :首先, 找出三個(gè)數(shù), p, q, r, 其中 p, q 是兩個(gè)相異的質(zhì)數(shù), r 是與 (p-1)(q-1) 互質(zhì)的數(shù)...... p, q, r 這三個(gè)數(shù)便是 person_key,接著, 找出 m, 使得 r^m == 1 mod (p-1)(q-1)..... 這個(gè) m 一定存在, 因?yàn)?r 與 (p-1)(q-1) 互質(zhì), 用輾轉(zhuǎn)相除法就可以得到了..... 再來(lái), 計(jì)算 n = pq....... m, n 這兩個(gè)數(shù)便是 public_key ,編碼過(guò)程是, 若資料為 a, 將其看成是一個(gè)大整數(shù), 假設(shè) a < n.... 如果 a >= n 的話, 就將 a 表成 s 進(jìn)位 (s
標(biāo)簽: person_key RSA 算法
上傳時(shí)間: 2013-12-14
上傳用戶:zhuyibin
一個(gè)LCD燈的小程序。不是我寫(xiě)的。我只負(fù)責(zé)了調(diào)試。適用在ACEXEP1K30QC208-3上。我跑了SIMULATOR,管腳連接標(biāo)示了。我也下在電路板上試過(guò)了,沒(méi)有問(wèn)題。要用到實(shí)驗(yàn)板上的兄弟們把CLK1改到TESTOUT3或者0就好了。綫幫助新手,人人有責(zé)。
標(biāo)簽: SIMULATOR ACEXEP LCD 208
上傳時(shí)間: 2015-04-10
上傳用戶:330402686
The government of a small but important country has decided that the alphabet needs to be streamlined and reordered. Uppercase letters will be eliminated. They will issue a royal decree in the form of a String of B and A characters. The first character in the decree specifies whether a must come ( B )Before b in the new alphabet or ( A )After b . The second character determines the relative placement of b and c , etc. So, for example, "BAA" means that a must come Before b , b must come After c , and c must come After d . Any letters beyond these requirements are to be excluded, so if the decree specifies k comparisons then the new alphabet will contain the first k+1 lowercase letters of the current alphabet. Create a class Alphabet that contains the method choices that takes the decree as input and returns the number of possible new alphabets that conform to the decree. If more than 1,000,000,000 are possible, return -1. Definition
標(biāo)簽: government streamline important alphabet
上傳時(shí)間: 2015-06-09
上傳用戶:weixiao99
蟲(chóng)蟲(chóng)下載站版權(quán)所有 京ICP備2021023401號(hào)-1