【正文】
簡(jiǎn)單方便,成本低,攜帶方便,擴(kuò)展性強(qiáng)。單片機(jī)是實(shí)現(xiàn)各種控制策略和算法的載體。只要對(duì)電路稍加修改,調(diào)整程序,即可完成功能 的 升級(jí)。 利用單片機(jī)采用程序設(shè)計(jì)方法來(lái)產(chǎn)生信號(hào),其頻率底線很低 , 具有線路相對(duì)簡(jiǎn)單,結(jié)構(gòu)緊湊,價(jià)格低廉,頻率穩(wěn)定度高,抗干擾能力強(qiáng),用途廣泛等優(yōu)點(diǎn),并且能夠?qū)Σㄐ芜M(jìn)行細(xì)微調(diào)整 。 在現(xiàn)代測(cè)試與控制中常常需要頻率可調(diào)的脈沖發(fā)生器,利用單片機(jī)內(nèi)可編程定時(shí) /計(jì)數(shù)器 即可實(shí)現(xiàn) 。而由硬件電路構(gòu)成的低頻信號(hào) 發(fā)生器 性能難以令人滿意,而且由于低頻信號(hào)源所需的 RC要很大 , 體積大,漏電, 大電阻、大電容在制作上亦有很大的難度, 損耗顯著更是其致命的弱點(diǎn)。但 是這種電路存在波形質(zhì)量差,控制難 度大 ,調(diào)整 范圍小,電路 結(jié)構(gòu) 復(fù)雜 以及 體積大等缺點(diǎn)。信號(hào)發(fā)生器 的 種類 比 較多,性能 也千差萬(wàn)別 ,但它們都可以產(chǎn)生不同頻率的調(diào)頻波信號(hào)、調(diào)幅波 、 正弦波,以及各種鋸齒波、三角波、方波和正負(fù)脈沖波等 信號(hào) 。 (3)脈沖信號(hào)占空比任意可調(diào)并在液晶屏顯屏指定位置示出來(lái) 。 本課題 設(shè)計(jì) 所要達(dá)到的指標(biāo)要求: (1)脈沖信號(hào)頻率 到 50KHZ 可調(diào)并在液晶顯示屏指定位置顯示。 本課題設(shè)計(jì)利 用單片機(jī)技術(shù),通過(guò)相應(yīng)的軟件編程和較簡(jiǎn)易的外圍硬件電路來(lái)實(shí)現(xiàn),其產(chǎn)生的脈沖信號(hào)干擾小,輸出穩(wěn)定,可靠性高,人機(jī)界面友好,操作簡(jiǎn)單方便,成本低,攜帶方便,擴(kuò)展性強(qiáng)。利用在工作方式 1 下的定時(shí)器和計(jì)數(shù)輸出低頻脈沖信號(hào),以及在工作方式 2 下能夠自動(dòng)重復(fù)賦初值的定時(shí)器輸出高頻脈沖信號(hào),從而使頻率和占空比滿足指標(biāo)要求。洛陽(yáng)理工學(xué)院畢業(yè)設(shè)計(jì)(論文) I 可編程脈沖信號(hào)發(fā)生器的設(shè)計(jì) 摘 要 基于單片機(jī)的可編程脈沖信號(hào)發(fā)生器,通過(guò) 4x4 的非編碼矩陣鍵盤(pán)鍵入脈沖信號(hào)的指標(biāo)參數(shù)頻率、占空比和脈沖個(gè)數(shù),在單片機(jī)的控制處理下發(fā)出滿足信號(hào)指標(biāo)的脈沖信號(hào),并在液晶顯示屏的制定位置顯示出相關(guān)參數(shù)。復(fù)位電路采用上電復(fù)位和手動(dòng)復(fù)位的復(fù)合復(fù)位方式,保證單片機(jī)在上電和程序運(yùn)行進(jìn)入死循環(huán)時(shí),單片機(jī)均能正常復(fù)位。通過(guò)程序設(shè)計(jì),使單片 機(jī)每次發(fā)出信號(hào)后等到重置信號(hào)進(jìn)行下一次脈沖信號(hào)的輸出,有效的提高了單片機(jī)的使用效率。關(guān)鍵的是,脈沖信號(hào)頻率 、 脈沖個(gè)數(shù)和脈沖占空比 可調(diào)節(jié),可通過(guò)鍵盤(pán)輸入并由顯示器顯示出來(lái)。 (2)脈沖信號(hào)個(gè)數(shù) 0到 9999 可調(diào) 并在液晶顯示屏指定位置顯 示。 關(guān)鍵詞: 單片機(jī),脈沖信號(hào),頻率,脈沖個(gè)數(shù),占空比 洛陽(yáng)理工學(xué)院畢業(yè)設(shè)計(jì)(論文) II Programmable pulse signal generator design ABSTRACT The programmable pulse signal generator based on single chip, through the 4x4 noncoding matrix keyboard inputing pulse signal parameters of frequency, duty cycle and pulse number, pulse signal is sent to meet the targets of signal processing related parameters are displayed on the setting position on the liquid crystal. The reset circuit by poweron reset and manual reset, ensure the SCM in power and run into dead circulation can be reset. Use in work mode 1 timer and counter output low frequency pulse signal, and in work mode 2 to timer output high frequency pulse signal ,automaticly repeat initialization, so as to make the frequency and duty ratio meet the requirements. Through the program design, the microcontroller each signal and then wait for the reset signal, the signal at the output of the pulse next time, effectively improve the efficiency in the use of singlechip microputer. The subject of the use of singlechip technology, which achieved through the corresponding software and the simple peripheral hardware circuit. The advantages of which are the small interference of the pulse signal, output stability, high reliability, friendly manmachine interface, easy operation, low cost, portability, scalability strong. The keys, pulse frequency, pulse number and pulse duty ratio are adjustable, which can be inputed through the keyboard and displayed through LCD. The requirements of this topic design: (1) The pulse signal frequency of to 50KHZ is adjustable and can be displaied on the specify location in the LCD screen. (2) Pulse signal number of 0 to 9999 is adjusted and can be displaied on the specify location in the LCD screen. (3) Pulse duty ratio is adjustable and can be displaied on the specify location in the LCD screen. KEY WORDS: single chip puter, pulse,hardware circuit, pulse number,duty ratio 洛陽(yáng)理工學(xué)院畢業(yè)設(shè)計(jì)(論文) III 目 錄 前 言 ....................................................................................................... 1 第 1 章 可編程脈沖發(fā)生器的相關(guān)模塊 ............................................ 4 AT89C51 單片 機(jī) .......................................................................... 4 AT89C51 單片機(jī)的結(jié)構(gòu) ................................................... 4 AT89C51 單片機(jī)的引腳功能 ........................................... 5 AT89C51 單片機(jī)的中斷系統(tǒng) ......................................... 9 AT89C51 單片機(jī)的 定時(shí) /計(jì)數(shù)器 ..................................11 SMC 1602A LCD 液晶顯示屏 .................................................. 12 第 2 章 可編程脈沖信號(hào)發(fā)生器的硬件設(shè)計(jì) ..................................... 14 硬件系統(tǒng)的總體設(shè)計(jì) ............................................................. 14 系統(tǒng)的總體框圖 ........................................................... 14 原理闡述 ........................................................................ 14 硬件系統(tǒng)各部分構(gòu)成 ............................................................. 14 電源電路 ......................................................................... 14 矩陣鍵盤(pán) ......................................................................... 15 脈沖信號(hào)輸出電路 ........................................................ 16 系統(tǒng)電路原理圖 ....................................................................... 19 第 3 章 可 編程脈沖信號(hào)發(fā)生器的軟件設(shè)計(jì) ..................................... 20 矩陣鍵盤(pán)的程序設(shè)計(jì) .............................................................. 20 液晶屏 顯示的程序設(shè)計(jì) .......................................................... 21 脈沖生成的程序設(shè)計(jì) .............................................................. 23 程序流程圖 ............................................................................... 24 主程序流程圖 ................................................................ 24 鍵盤(pán)分析子程序流程圖 ................................................ 25 顯示子程序流程圖 ........................................................ 26 數(shù)值處理子程序流程圖 ................................................ 27 脈沖信號(hào)生成子程序流程圖 ........................................ 28 ............................................................................ 28 洛陽(yáng)理工學(xué)院畢業(yè)設(shè)計(jì)(論文) IV 第 4 章 可編程脈沖信號(hào)發(fā)生器的程序編譯、調(diào)試及仿真 ............ 29 系統(tǒng) 程序的編譯 ....................................................................... 29 系統(tǒng)調(diào)試 ................................................................................... 30 硬件調(diào)試 .......................................................................... 30 軟件調(diào)試 .......................................................................... 30 系統(tǒng)仿真 ................................................................................... 32 系統(tǒng)仿真圖 ...................................................................... 32 系統(tǒng)的改善 ...................................................................... 35