三種方法讀取鍵值 使用者設(shè)計(jì)行列鍵盤介面,一般常採用三種方法讀取鍵值。 中斷式 在鍵盤按下時(shí)產(chǎn)生一個(gè)外部中斷通知CPU,並由中斷處理程式通過不同位址讀資料線上的狀態(tài)判斷哪個(gè)按鍵被按下。 本實(shí)驗(yàn)採用中斷式實(shí)現(xiàn)使用者鍵盤介面。 掃描法 對鍵盤上的某一行送低電位,其他為高電位,然後讀取列值,若列值中有一位是低,表明該行與低電位對應(yīng)列的鍵被按下。否則掃描下一行。 反轉(zhuǎn)法 先將所有行掃描線輸出低電位,讀列值,若列值有一位是低表明有鍵按下;接著所有列掃描線輸出低電位,再讀行值。 根據(jù)讀到的值組合就可以查表得到鍵碼。4x4鍵盤按4行4列組成如圖電路結(jié)構(gòu)。按鍵按下將會使行列連成通路,這也是見的使用者鍵盤設(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) //按鍵是否放開 { 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; //沒有按鍵按下 }
上傳時(shí)間: 2013-11-12
上傳用戶:a673761058
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
半導(dǎo)體的產(chǎn)品很多,應(yīng)用的場合非常廣泛,圖一是常見的幾種半導(dǎo)體元件外型。半導(dǎo)體元件一般是以接腳形式或外型來劃分類別,圖一中不同類別的英文縮寫名稱原文為 PDID:Plastic Dual Inline Package SOP:Small Outline Package SOJ:Small Outline J-Lead Package PLCC:Plastic Leaded Chip Carrier QFP:Quad Flat Package PGA:Pin Grid Array BGA:Ball Grid Array 雖然半導(dǎo)體元件的外型種類很多,在電路板上常用的組裝方式有二種,一種是插入電路板的銲孔或腳座,如PDIP、PGA,另一種是貼附在電路板表面的銲墊上,如SOP、SOJ、PLCC、QFP、BGA。 從半導(dǎo)體元件的外觀,只看到從包覆的膠體或陶瓷中伸出的接腳,而半導(dǎo)體元件真正的的核心,是包覆在膠體或陶瓷內(nèi)一片非常小的晶片,透過伸出的接腳與外部做資訊傳輸。圖二是一片EPROM元件,從上方的玻璃窗可看到內(nèi)部的晶片,圖三是以顯微鏡將內(nèi)部的晶片放大,可以看到晶片以多條銲線連接四周的接腳,這些接腳向外延伸並穿出膠體,成為晶片與外界通訊的道路。請注意圖三中有一條銲線從中斷裂,那是使用不當(dāng)引發(fā)過電流而燒毀,致使晶片失去功能,這也是一般晶片遭到損毀而失效的原因之一。 圖四是常見的LED,也就是發(fā)光二極體,其內(nèi)部也是一顆晶片,圖五是以顯微鏡正視LED的頂端,可從透明的膠體中隱約的看到一片方型的晶片及一條金色的銲線,若以LED二支接腳的極性來做分別,晶片是貼附在負(fù)極的腳上,經(jīng)由銲線連接正極的腳。當(dāng)LED通過正向電流時(shí),晶片會發(fā)光而使LED發(fā)亮,如圖六所示。 半導(dǎo)體元件的製作分成兩段的製造程序,前一段是先製造元件的核心─晶片,稱為晶圓製造;後一段是將晶中片加以封裝成最後產(chǎn)品,稱為IC封裝製程,又可細(xì)分成晶圓切割、黏晶、銲線、封膠、印字、剪切成型等加工步驟,在本章節(jié)中將簡介這兩段的製造程序。
上傳時(shí)間: 2013-11-04
上傳用戶:372825274
題目:利用條件運(yùn)算符的嵌套來完成此題:學(xué)習(xí)成績>=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)相除法就可以得到了..... 再來, 計(jì)算 n = pq....... m, n 這兩個(gè)數(shù)便是 public_key ,編碼過程是, 若資料為 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燈的小程序。不是我寫的。我只負(fù)責(zé)了調(diào)試。適用在ACEXEP1K30QC208-3上。我跑了SIMULATOR,管腳連接標(biāo)示了。我也下在電路板上試過了,沒有問題。要用到實(shí)驗(yàn)板上的兄弟們把CLK1改到TESTOUT3或者0就好了。綫幫助新手,人人有責(zé)。
標(biāo)簽: SIMULATOR ACEXEP LCD 208
上傳時(shí)間: 2015-04-10
上傳用戶:330402686
Manufacturers of electronic systems that require power conversion are faced with the need for higher-density dc-to-dc converters that perform more efficiently,
標(biāo)簽: Manufacturers electronic conversion systems
上傳時(shí)間: 2015-04-17
上傳用戶:diets
數(shù)字運(yùn)算,判斷一個(gè)數(shù)是否接近素?cái)?shù) A Niven number is a number such that the sum of its digits divides itself. For example, 111 is a Niven number because the sum of its digits is 3, which divides 111. We can also specify a number in another base b, and a number in base b is a Niven number if the sum of its digits divides its value. Given b (2 <= b <= 10) and a number in base b, determine whether it is a Niven number or not. Input Each line of input contains the base b, followed by a string of digits representing a positive integer in that base. There are no leading zeroes. The input is terminated by a line consisting of 0 alone. Output For each case, print "yes" on a line if the given number is a Niven number, and "no" otherwise. Sample Input 10 111 2 110 10 123 6 1000 8 2314 0 Sample Output yes yes no yes no
上傳時(shí)間: 2015-05-21
上傳用戶:daguda
源代碼\用動(dòng)態(tài)規(guī)劃算法計(jì)算序列關(guān)系個(gè)數(shù) 用關(guān)系"<"和"="將3個(gè)數(shù)a,b,c依次序排列時(shí),有13種不同的序列關(guān)系: a=b=c,a=b<c,a<b=v,a<b<c,a<c<b a=c<b,b<a=c,b<a<c,b<c<a,b=c<a c<a=b,c<a<b,c<b<a 若要將n個(gè)數(shù)依序列,設(shè)計(jì)一個(gè)動(dòng)態(tài)規(guī)劃算法,計(jì)算出有多少種不同的序列關(guān)系, 要求算法只占用O(n),只耗時(shí)O(n*n).
標(biāo)簽: lt 源代碼 動(dòng)態(tài)規(guī)劃 序列
上傳時(shí)間: 2013-12-26
上傳用戶:siguazgb
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
蟲蟲下載站版權(quán)所有 京ICP備2021023401號-1