【正文】
這是非常有用的設(shè)備,如恒溫系統(tǒng),需要定期測試他們周圍的溫度,看看他們是否需要打開空調(diào)或者加熱器等等。此外,許多嵌入式微處理器包括各種兼職的轉(zhuǎn)換器。在工廠,可以生產(chǎn)可擦除式只讀存儲(chǔ)器。凡是許多重要的中斷源發(fā)出中斷申請(qǐng),都必須中斷,如電池供電的設(shè)備停止運(yùn)行后,微控制器在低功耗睡眠狀態(tài)下的處理器必須停止,直到做一些外圍的活動(dòng)才重新開始返回當(dāng)前指令序列。某些強(qiáng)制性的微控制器能夠提供實(shí)時(shí)應(yīng)對(duì)突發(fā)事件的嵌入式系統(tǒng)并控制它們。這些嵌入其他設(shè)備的計(jì)算機(jī)系統(tǒng)被稱為嵌入式系統(tǒng)。在睡眠狀態(tài)時(shí), CPU時(shí)鐘和外設(shè)禁用,從而使它們適合用于低功耗和長期持久的電池應(yīng)用。 它強(qiáng)調(diào)高度集成,而相比之下,一個(gè)微處理器只包含一個(gè)CPU (比如一臺(tái)PC ) 。通常,這些繼承在內(nèi)部的設(shè)備可以通過特殊的指令來操作。它要完成單片機(jī)的工作,就必須連接一些其他芯片。說單片機(jī)與通用型中央處理單元芯片不同是因?yàn)榍罢咭话愫苋菀着浜献钚⌒偷耐獠恐С中酒瞥晒ぷ饔?jì)算機(jī)。它的最大優(yōu)點(diǎn)是體積小,可放在儀表內(nèi)部,但存儲(chǔ)量小,輸入輸出接口簡單,功能較低。C) is a functional puter systemonachip. It contains a processor core, memory, and programmable input/output peripherals.Microcontrollers include an integrated CPU, memory (a small amount of RAM, program memory, or both) and peripherals capable of input and output. It emphasizes high integration, in contrast to a microprocessor which only contains a CPU (the kind used in a PC). In addition to the usual arithmetic and logic elements of a general purpose microprocessor, the microcontroller integrates additional elements such as readwrite memory for data storage, readonly memory for program storage, Flash memory for permanent data storage, peripherals, and input/output interfaces. At clock speeds of as little as 32KHz, microcontrollers often operate at very low speed pared to microprocessors, but this is adequate for typical applications. They consume relatively little power (milliwatts or even microwatts), and will generally have the ability to retain functionality while waiting for an event such as a button press or interrupt. Power consumption while sleeping (CPU clock and peripherals disabled) may be just nanowatts, making them ideal for low power and long lasting battery applications.Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, remote controls, office machines, appliances, power tools, and toys. By reducing the size, cost, and power consumption pared to a design using a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to electronically control many more processes.The majority of puter systems in use today are embedded in other machinery, such as automobiles, telephones, appliances, and peripherals for puter systems. These are called embedded systems. While some embedded systems are very sophisticated, many have minimal requirements for memory and program length, with no operating system, and low software plexity. Typical input and output devices include switches, relays, solenoids, LEDs, small or custom LCD displays, radio frequency devices, and sensors for data such as temperature, humidity, light level etc. Embedded systems usually have no keyboard, screen, disks, printers, or other recognizable I/O devices of a personal puter, and may lack human interaction devices of any kind.It is mandatory that microcontrollers provide real time response to events in the embedded system they are controlling. When certain events occur, an interrupt system can signal the processor to suspend processing the current instruction sequence and to begin an interrupt service routine (ISR). The ISR will perform any processing required based on the source of the interrupt before returning to the original instruction sequence. Possible interrupt sources are device dependent, and often include events such as an internal timer overflow, pleting an analog to digital conversion, a logic level change on an input such as from a button being pressed, and data received on a munication link. Where power consumption is important as in battery operated devices, interrupts may also wake a microcontroller from a low power sleep state where the processor is halted until required to do something by a peripheral event.Microcontroller programs must fit in the available onchip program memory, since it would be costly to provide a system with external, expandable, memory. Compilers and assembly language are used to turn highlevel language programs into a pact machine code for storage in the microcontroller39。 // TL1=0。}void timer1() interrupt 3 //顯示0000說明出錯(cuò){ TR1=0。 TH1=0。 mm=0。 //數(shù)碼管刷新時(shí)間單位毫秒 } }void timer0() interrupt 1{ TR0=0。 }main(){ timer_init()。 TH1=0。 ET1=1。 delay(1)。 delay(1)。 delay(1)。 delay(1)。 shi=jj%100/10。 jj*=20。j)。 for(i=m。 d Based on MicroControllers, Chemical Engineering amp。參考文獻(xiàn) ,2003 馬全權(quán),李慶輝, 孫桂榮,班 瑩,劉 . 實(shí)驗(yàn)室科學(xué),2005 王秀杰,2003 :北京航空航天大學(xué)出版社,1990 蔣智勇. :遼寧科學(xué)技術(shù)出版設(shè),1992:北京航空航天大學(xué)出版社,1990:機(jī)械工業(yè)出版社,1995:哈爾濱工業(yè)大學(xué)出版社,19901蔣智勇. :遼寧科學(xué)技術(shù)出版設(shè),19921Tierney, J., Rader, ., and Gold, B. A Digital Frequency Synthesizer, IEEE Transactions on Audio and Electroacoustics AU19:1, March 1971 1Goldberg, BarGiora, Digital Techniques in Frequency Synthesis, New York: McGrawHill, 19961 QU Jinyu. Measure of Engine Speed Based on C8051F Chip, Tractor amp。再次,我要感謝的是我的同學(xué)趙星輝和舍友們在我畢業(yè)設(shè)計(jì)期間,他們給了我不少的關(guān)心和幫助。首先,我要感謝的是我的導(dǎo)師楊帆老師。在設(shè)計(jì)的信號(hào)處理電路中經(jīng)過濾波,能夠進(jìn)一步減少誤差,是測速精度得到提高。 ◆EX0:外部中斷 INT0的中斷允許位。 ◆ET2:定時(shí)器/計(jì)數(shù)器T2的溢出中斷允許位 ◆ES:串行口中斷允許位。MM0為工作方式選擇位 ,用于對(duì)T0的四種工作方式,T1的三種工作方式進(jìn)行選擇,選擇情況如下表51:M1M0=00為方式0。當(dāng)定時(shí)器采用不同的工作方式和設(shè)置不同的初值時(shí),產(chǎn)生溢出中斷的定時(shí)值和計(jì)數(shù)值將不同,從而可以適應(yīng)不同的定時(shí)或計(jì)數(shù)控制。 主程序初始化(1).定時(shí)器的初始化 AT89C51有兩個(gè)定時(shí)器/計(jì)數(shù)器T0和T1,每個(gè)定時(shí)器/計(jì)數(shù)器均可設(shè)置成為16位,也可以設(shè)置成為13位進(jìn)行定時(shí)或計(jì)數(shù)。 根據(jù)設(shè)計(jì)的要求,單片機(jī)的任務(wù)是:內(nèi)部進(jìn)行計(jì)數(shù),在計(jì)算出速度后顯示。 P2=0。 P2=0。 P2=0。 P2=0。 ge=mm%10。}xian_shi() { uchar qian,bei,shi,ge。i0。 //顯示1234//uchar jj。動(dòng)態(tài)顯示驅(qū)動(dòng):數(shù)碼管動(dòng)態(tài)顯示接口是單片機(jī)中應(yīng)用最為廣泛的一種顯示方式之一,動(dòng)態(tài)驅(qū)動(dòng)是將所有數(shù)碼管的8個(gè)顯示筆劃a,b,c,d,e,f,g,dp的同名端連在一起,另外為每個(gè)數(shù)碼管的公共極COM增加位選通控制電路,位選通由各自獨(dú)立的I/O線控制,當(dāng)單片機(jī)輸出字形碼時(shí),所有數(shù)碼管都接收到相同的字形碼,但究竟是那個(gè)數(shù)碼管會(huì)顯示出字形,取決于單片機(jī)對(duì)位選通COM端電路的控制,所以我們只要將需要顯示的數(shù)碼管的選通控制打開,該位就顯示出字形,沒有選通的數(shù)碼管就不會(huì)亮。 數(shù)碼管要正常顯示,就要用驅(qū)動(dòng)電路來驅(qū)動(dòng)數(shù)碼管的各個(gè)段碼,從而顯示出我們要的數(shù)字,因此根據(jù)數(shù)碼管的驅(qū)動(dòng)方式的不同,可以分為靜態(tài)式和動(dòng)態(tài)式兩類。再把多個(gè)這樣的8字裝在一起就成了多位的數(shù)碼管了。