【正文】
der:when STC89C51 controlled the timer that generates an ultrasonic pulse and timing ,calculated the roundtrip time from the ultrasonic transmitter to the receiver , resulting in the measured distance. In the data processing and set high and low limit of distance, with four LED digital display distance, but when the limit is exceeded an alarm buzzer. This ultrasonic ranging system is based on 51 single, the HCSR04 ultrasonic ranging module, LED, resistive and capacitive ponents, buzzer, etc., with distance alarm system, alarm buzzer and respond by LED, and the system can be changed at any time from the alarm by pressing a button. Ultrasonic Ranging Module provides 2cm400cm noncontact sensing capabilities, ranging accuracy can reach 3mm, module prises an ultrasonic transmitter, a receiver and a control circuit. The work of low cost, relatively high resistance, the measured distance can be displayed on a clear and stable four digital tube, and the pact and light weight, the application more convenient. Keywords: AT89C51。 ranging 山西大學(xué)工程學(xué)院 III 目錄 第一章 引言 ...................................................................................................... 1 課題研究的背景 ................................................................................... 1 課題的提出及研究意義 ....................................................................... 1 課題的提出 .................................................................................. 1 課題的研究意義 .......................................................................... 2 第二章 超聲波的介紹及超聲波測(cè)距的原理 ................................................... 3 超聲波的簡(jiǎn)介 ....................................................................................... 3 什么是超聲波 .............................................................................. 3 超聲波的特性及特點(diǎn) ................................................................... 3 超聲波的應(yīng)用 .............................................................................. 4 超聲波測(cè)距的原理 ............................................................................... 4 超聲波發(fā)生器 .............................................................................. 4 壓電式超聲波發(fā)生器的原理 ....................................................... 5 超聲波測(cè)距的原理 ...................................................................... 5 第三章 方案設(shè)計(jì)及元件 選型 .......................................................................... 6 設(shè)計(jì)方案 ................................................................................................ 6 設(shè)計(jì)思路 ...................................................................................... 6 系統(tǒng)最終方案 .............................................................................. 6 STC89C51 單片機(jī)的介紹 ..................................................................... 6 STC89C51單片機(jī)的功能 ............................................................. 7 STC89C51單片機(jī)的主要特性 ..................................................... 7 山西大學(xué)工程學(xué)院 IV STC89C51的管 腳說明 ................................................................. 8 HCSR04 超聲波發(fā)射接收模塊 ............................................................ 9 ....................................................................... 9 ........................................................................... 9 ..................................................................................... 10 氣 參數(shù) ..................................................................................... 10 第四章 硬件設(shè)計(jì) ............................................................................................ 11 系統(tǒng)結(jié)構(gòu)設(shè)計(jì) ..................................................................................... 11 接收顯示終端電路 ............................................................................. 11 超聲波發(fā)射電路 ................................................................................. 12 超聲波接收電路 ................................................................................. 13 報(bào)警電路 ............................................................................................. 14 電源電路 ............................................................................................. 15 第五章 軟件設(shè)計(jì) ............................................................................................ 16 軟件總體設(shè)計(jì) ..................................................................................... 16 主程序設(shè)計(jì) ......................................................................................... 16 主程序設(shè)計(jì)思路 ........................................................................ 16 主程序流程圖 ............................................................................ 17 主程序及程序說明 .................................................................... 17 顯示模塊程序設(shè)計(jì) .............................................................................. 18 程序設(shè)計(jì)思路 ............................................................................ 18 顯示子程序及程序說明 ............................................................. 18 山西大學(xué)工程學(xué)院 V 中斷模塊程序設(shè)計(jì) ............................................................................. 19 設(shè)計(jì)思路 .................................................................................... 19 中斷程序及程序說明 ................................................................. 19 計(jì)算子程序 ......................................................................................... 20 程序設(shè)計(jì)思路 ............................................................................ 20 計(jì)算子程序及程序說明 ............................................................. 20 上下限調(diào)整子程序 ............................................................................. 21