超声波测距仪英文翻译
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
英文文献翻译
Ultrasonic distance meter
超声波测距仪
文献来源:United States Patent 5442592
作者:Lobo,Ian J. (罗保.伊恩j. )
译者:刘芳
指导教师:**
Ultrasonic distance meter
Abstract:An ultrasonic distance meter cancels out the effects of temperature and humidity variations by including a measuring unit and a reference unit. In each of the units, a repetitive series of pulses is generated, each having a repetition rate directly related to the respective distance between an electroacoustic transmitter and an electroacoustic receiver. The pulse trains are provided to respective counters, and the ratio of the counter outputs is utilized to determine the distance being measured.
一、BACKGROUND OF THE INVENTION
This invention relates to apparatus for the measurement of distance and, more particularly, to such apparatus which transmits ultrasonic waves between two points.
Precision machine tools must be calibrated. In the past, this has been accomplished utilizing mechanical devices such as calipers, micrometers, and the like. However, the use of such devices does not readily lend itself to automation techniques. It is known that the distance between two points can be determined by measuring the propagation time of a wave travelling between those two points. One such type of wave is an ultrasonic, or acoustic, wave. When an ultrasonic wave travels between two points, the distance between the two points can be measured by multiplying the transit time of the wave by the wave velocity in the medium separating the two points. It is therefore an object of the present invention to provide apparatus utilizing ultrasonic waves to accurately measure the distance between two points.
When the medium between the two points whose spacing is being measured is air, the sound velocity is dependent upon the temperature and humidity of the air. It is therefore a further object of the,present invention to provide apparatus of the type described which is independent of temperature and humidity variations.
二、SUMMARY OF THE INVENTION
The foregoing and additional objects are attained in accordance with the principles of this invention by providing distance measuring apparatus which includes
a reference unit and a measuring unit. The reference and measuring units are the same and each includes an electroacoustic transmitter and an electroacoustic receiver. The spacing between the transmitter and the receiver of the reference unit is a fixed reference distance, whereas the spacing between the transmitter and receiver of the measuring unit is the distance to be measured. In each of the units, the transmitter and receiver are coupled by a feedback loop which causes the transmitter to generate an acoustic pulse which is received by the receiver and converted into an electrical pulse which is then fed back to the transmitter, so that a repetitive series of pulses results. The repetition rate of the pulses is inversely related to the distance between the transmitter and the receiver. In each of the units, the pulses are provided to a counter. Since the reference distance is known, the ratio of the counter outputs is utilized to determine the desired distance to be measured. Since both counts are identically influenced by temperature and humidity variations, by taking the ratio of the counts, the resultant measurement becomes insensitive to such variations.
三、DETAILED DESCRIPTION
Referring now to the drawing, there is shown a measuring unit 10 and a reference unit 12, both coupled to a utilization means 14. The measuring unit 10 includes an electroacoustic transmitter 16 and an electroacoustic receiver 18. The transmitter 16 includes piezoelectric material 20 sandwiched between a pair of electrodes 22 and 24. Likewise, the receiver 18 includes piezoelectric material 26 sandwiched between a pair of electrodes 28 and 30. As is known, by applying an electric field across the electrodes 22 and 24, stress is induced in the piezoelectric material 20. If the field varies, such as by the application of an electrical pulse, an acoustic wave 32 is generated. As is further known, when an acoustic wave impinges upon the receiver 18, this induces stress in the piezoelectric material 26 which causes an electrical signal to be generated across the electrodes 28 and 30. Although piezoelectric transducers have been illustrated, other electroacoustic devices may be utilized, such as, for example, electrostatic, electret or electromagnetic types.
As shown, the electrodes 28 and 30 of the receiver 18 are coupled to the input of
an amplifier 34, whose output is coupled to the input of a detector 36. The detector 36 is arranged to provide a signal to the pulse former 38 when the output from the amplifier 34 exceeds a predetermined level. The pulse former 38 then generates a trigger pulse which is provided to the pulse generator 40. In order to enhance the sensitivity of the system, the transducers 16 and 18 are resonantly excited. There is accordingly provided a continuous wave oscillator 42 which provides a continuous oscillating signal at a fixed frequency, preferably the resonant frequency of the transducers 16 and 18. This oscillating signal is provided to the modulator 44. To effectively excite the transmitter 16, it is preferable to provide several cycles of the resonant frequency signal, rather than a single pulse or single cycle. Accordingly, the pulse generator 40 is arranged, in response to the application thereto of a trigger pulse, to provide a control pulse to the modulator 44 having a time duration equal the time duration of a predetermined number of cycles of the oscillating signal from the oscillator 42. This control pulse causes the modulator 44 to pass a "burst" of cycles to excite the transmitter 16.
When electric power is applied to the described circuitry, there is sufficient noise at the input to the amplifier 34 that its output triggers the pulse generator 40 to cause a burst of oscillating cycles to be provided across the electrodes 22 and 24 of the transmitter 16. The transmitter 16 accordingly generates an acoustic wave 32 which impinges upon the receiver 18. The receiver 18 then generates an electrical pulse which is applied to the input of the amplifier 34, which again causes triggering of the pulse generator 40. This cycle repeats itself so that a repetitive series of trigger pulses results at the output of the pulse former 38. This pulse train is applied to the counter 46, as well as to the pulse generator 40.
The transmitter 16 and the receiver 18 are spaced apart by the distance "D" which it is desired to measure. The propagation time "t" for an acoustic wave 32 travelling between the transmitter 16 and the receiver 18 is given by: t=D/V s
where V s is the velocity of sound in the air between the transmitter 16 and the receiver 18. The counter 46 measures the repetition rate of the trigger pulses, which is equal to 1/t. Therefore, the repetition rate is equal to V s /D. The velocity of sound in
air is a function of the temperature and humidity of the air, as follows: ##EQU1## where T is the temperature, p is the partial pressure of the water vapor, H is the barometric pressure, Γ w and Γ a are the ratio of constant pressure specific heat to constant volume specific heat for water vapor and dry air, respectively. Thus, although the repetition rate of the trigger pulses is measured very accurately by the counter 46, the sound velocity is influenced by temperature and humidity so that the measured distance D cannot be determined accurately.
In accordance with the principles of this invention, a reference unit 12 is provided. The reference unit 12 is of the same construction as the measuring unit 10 and therefore includes an electroacoustic transmitter 50 which includes piezoelectric material 52 sandwiched between a pair of electrodes 54 and 56, and an electroacoustic receiver 58 which includes piezoelectric material 60 sandwiched between a pair of electrodes 62 and 64. Again, transducers other than the piezoelectric type can be utilized. The transmitter 50 and the receiver 58 are spaced apart a known and fixed reference distance "D R ". The electrodes 62 and 64 are coupled to the input of the amplifier 66, whose output is coupled to the input of the detector 68. The output of the detector 68 is coupled to the pulse former 70 which generates trigger pulses. The trigger pulses are applied to the pulse generator 72 which controls the modulator 74 to pass bursts from the continuous wave oscillator 76 to the transmitter 50. The trigger pulses from the pulse former 70 are also applied to the counter 78.
Preferably, all of the transducers 16, 18, 50 and 58 have the same resonant frequency. Therefore, the oscillators 42 and 76 both operate at that frequency and the pulse generators 40 and 72 provide equal width output pulses.
In usage, the measuring unit 10 and the reference unit 12 are in close proximity so that the sound velocity in both of the units is the same. Although the repetition rates of the pulses in the measuring unit 10 and the reference unit 12 are each temperature and humidity dependent, it can be shown that the distance D to be measured is related to the reference distance D R as follows: i D=D R (1/t R )/(1/t) where t R is the propagation time over the distance D R in the reference unit 12. This relationship is independent of both temperature and humidity.
Thus, the outputs of the counters 46 and 78 are provided as inputs to the microprocessor 90 in the utilization means 14. The microprocessor 90 is appropriately programmed to provide an output which is proportional to the ratio of the outputs of the counters 46 and 78, which in turn are proportional to the repetition rates of the respective trigger pulse trains of the measuring unit 10 and the reference unit 12. As described, this ratio is independent of temperature and humidity and, since the reference distance D R is known, provides an accurate representation of the distance D. The utilization means 14 further includes a display 92 which is coupled to and controlled by the microprocessor 90 so that an operator can readily determine the distance D.
Experiments have shown that when the distance between the transmitting and receiving transducers is too small, reflections of the acoustic wave at the transducer surfaces has a not insignificant effect which degrades the measurement accuracy. Accordingly, it is preferred that each transducer pair be separated by at least a certain minimum distance, preferably about four inches.
Accordingly, there has been disclosed improved apparatus for the measurement of distance utilizing ultrasonic waves. While an illustrative embodiment of the present invention has been disclosed herein, it is understood that various modifications and adaptations to the disclosed embodiment will be apparent to those of ordinary skill in the art and it is intended that this invention be limited only by the scope of the appended claims.
四、 A PRINCIPLE OF ULTRASONIC DISTANCE MEASUREMENT
1, The principle of piezoelectric ultrasonic generator
Piezoelectric ultrasonic generator is the use of piezoelectric crystal resonators to work. Ultrasonic generator, the internal structure as shown in Figure 1, it has two piezoelectric chip and a resonance plate. When it's two plus pulse signal, the frequency equal to the intrinsic piezoelectric oscillation frequency chip, the chip will happen piezoelectric resonance, and promote the development of plate vibration
resonance, ultrasound is generated. Conversely, if the two are not inter-electrode voltage, when the board received ultrasonic resonance, it will be for vibration suppression of piezoelectric chip, the mechanical energy is converted to electrical signals, then it becomes the ultrasonic receiver.
2, The principle of ultrasonic distance measurement
Ultrasonic transmitter in a direction to launch ultrasound, in the moment to launch the beginning of time at the same time, the spread of ultrasound in the air, obstacles on his way to return immediately, the ultrasonic reflected wave received by the receiver immediately stop the clock. Ultrasound in the air as the propagation velocity of 340m / s, according to the timer records the time t, we can calculate the distance between the launch distance barrier (s), that is: s = 340t / 2
五、ULTRASONIC RANGING SYSTEM FOR THE SECOND CIRCUIT DESIGN
System is characterized by single-chip microcomputer to control the use of ultrasonic transmitter and ultrasonic receiver since the launch from time to time, single-chip selection of 8751, economic-to-use, and the chip has 4K of ROM, to facilitate programming. Circuit schematic diagram shown in Figure 2. Draw only the front range of the circuit wiring diagram, left and right in front of Ranging Ranging circuits and the same circuit, it is omitted.
1,40 kHz ultrasonic pulse generated with the launch
Ranging system using the ultrasonic sensor of piezoelectric ceramic sensors UCM40, its operating voltage of the pulse signal is 40kHz, which by the single-chip implementation of the following procedures to generate.
puzel: mov 14h, # 12h; ultrasonic firing continued 200ms
here: cpl p1.0; output 40kHz square wave
nop;
nop;
nop;
djnz 14h, here;
ret
Ranging in front of single-chip termination circuit P1.0 input port, single chip implementation of the above procedure, the P1.0 port in a 40kHz pulse output signal, after amplification transistor T, the drive to launch the first ultrasonic UCM40T, issued 40kHz ultrasonic pulse, and the continued launch of 200ms. Ranging the right and the left side of the circuit, respectively, then input port P1.1 and P1.2, the working principle and circuit in front of the same location.
2, Reception and processing of ultrasonic
Used to receive the first launch of the first pair UCM40R, the ultrasonic pulse modulation signal into an alternating voltage, the op-amp amplification IC1A and after polarization IC1B to IC2. IC2 is locked loop with audio decoder chip LM567, internal voltage-controlled oscillator center frequency of f0 = 1/1.1R8C3, capacitor C4 determine their target bandwidth. R8-conditioning in the launch of the carrier frequency on the LM567 input signal is greater than 25mV, the output from the high jump 8 feet into a low-level, as interrupt request signals to the single-chip processing.
Ranging in front of single-chip termination circuit output port INT0 interrupt the highest priority, right or left location of the output circuit with output gate IC3A access INT1 port single-chip, while single-chip P1.3 and P1. 4 received input IC3A, interrupted by the process to identify the source of inquiry to deal with, interrupt priority level for the first left right after. Part of the source code is as follows: receive1: push psw
push acc
clr ex1; related external interrupt 1
jnb p1.1, right; P1.1 pin to 0, ranging from right to interrupt service routine circuit
jnb p1.2, left; P1.2 pin to 0, to the left ranging circuit interrupt service routine
return: SETB EX1; open external interrupt 1
pop? acc
pop? psw
reti
right: ...?; right location entrance circuit interrupt service routine
Ajmp Return
left: ...; left Ranging entrance circuit interrupt service routine
Ajmp Return
3, The calculation of ultrasonic propagation time
When you start firing at the same time start the single-chip circuitry within the timer T0, the use of timer counting function records the time and the launch of ultrasonic reflected wave received time. When you receive the ultrasonic reflected wave, the receiver circuit outputs a negative jump in the end of INT0 or INT1 interrupt request generates a signal, single-chip microcomputer in response to external interrupt request, the implementation of the external interrupt service subroutine, read the time difference, calculating the distance . Some of its source code is as follows: RECEIVE0: PUSH PSW
PUSH ACC
CLR EX0; related external interrupt 0
MOV R7, TH0; read the time value
MOV R6, TL0?
CLR C
MOV A, R6
SUBB A, # 0BBH; calculate the time difference
MOV 31H, A; storage results
MOV A, R7
SUBB A, # 3CH
MOV 30H, A?
SETB EX0; open external interrupt 0
POP ACC?
POP PSW
RETI
六、THE ULTRASONIC RANGING SYSTEM SOFTWARE
DESIGN
Software is divided into two parts, the main program and interrupt service routine, shown in Figure 3 (a) (b) (c) below. Completion of the work of the main program is initialized, each sequence of ultrasonic transmitting and receiving control.
Interrupt service routines from time to time to complete three of the rotation direction of ultrasonic launch, the main external interrupt service subroutine to read the value of completion time, distance calculation, the results of the output and so on.
七、CONCLUSIONS
Required measuring range of 30cm ~ 200cm objects inside the plane to do a number of measurements found that the maximum error is 0.5cm, and good reproducibility. Single-chip design can be seen on the ultrasonic ranging system has a hardware structure is simple, reliable, small features such as measurement error. Therefore, it can be used not only for mobile robot can be used in other detection systems.
Thoughts: As for why the receiver do not have the transistor amplifier circuit, because the magnification well, CX20106 integrated amplifier, but also with automatic gain control level, magnification to 76dB, the center frequency is 38k to 40k, is exactly resonant ultrasonic sensors frequency.
超声波测距仪
摘要:提出了一种超声波测距仪来抵消的影响温度和湿度的变化,包括测量单元和参考资料。
在每一个单位,重复的一系列脉冲的产生,每有一个重复率,直接关系到各自之间的距离,发射机和接收机。
脉冲提供给各自的主机,和比例的反产出是利用确定的距离被衡量的。
一、背景发明
本发明涉及到仪器的测量距离,更特别是,这种仪器传送超声波两点之间。
精密机床必须校准。
在过去,这已经完成利用机械设备,如卡钳,微米等。
不过,使用这种装置并不容易本身自动化技术。
据了解,该两点之间距离才能确定通过
测量传播时间的浪潮往返那些两点。
这样一个类型的波是一种超声波,或声,海浪。
当超声波旅行两点之间,距离两个点之间可以衡量乘以过境的时间波由波速,在中期分开两点。
因此,这是一个对象本发明提供仪器利用超声波准确测量两点之间距离。
当中等两个点之间的间距是被衡量的是空气,声速是取决于温度和空气相对湿度。
因此,它是进一步对象的,现在的发明,提供仪器的类型所描述的是独立于温度和湿度的变化。
二、综述发明
前述的和额外的对象是达到了根据这些原则的这项发明提供距离测量仪器,其中包括一个参考的单位和测量单位。
参考和测量单位是相同的,每个包括一电发射机和接收机一电。
间隔发射器和接收器的参考股是一个固定的参考距离,而间距之间的发射机和接收机的测量单位是距离来衡量。
在每一个单位,发射机和接收机是再加上由一个反馈环路导致发射机产生的声脉冲是由接收机和转换成一个电脉冲这是然后反馈到发射机,使重复一系列脉冲的结果。
重复率脉冲是成反比关系之间的距离发射器和接收器。
在每一个单位,脉冲提供一个反。
由于参考的距离是众所周知,比例反产出是利用,以确定所期望的距离来衡量。
由于这两方面都是相同的影响,温度和湿度的变化,采取的比例罪状,由此产生的测量变得麻木等变化。
三、详细说明
谈到现在的绘图,有结果表明,测量单位和10个参考单位12个,均加上一个利用的手段14 。
测量单位包括1 10电发射机16日和1电接收机18 。
变送器16包括压电材料20夹心阶层之间的对电极的22日和24日。
同样,接收机18个,包括压电材料26夹心阶层之间的对电极的28日和30日。
作为众所周知,采用电场整个电极22日和24日,强调的是,诱导,在压电材料20 。
如果该字段各有不同,如所申请的一个电脉冲,声波是32所产生的。
为进一步众所周知,当声波影响到接收器18 ,这诱导应力,在压电材料26 ,导致一种电信号,以产生全国电极28日和30日。
虽然压电传感器已说明,其他电声装置,可利用,例如,静电,驻极体或电磁类型。
电极28日和30日的接收18岁以下的耦合的投入一34放大器,其输出耦合
输入一个探测器36 。
探测器36是安排提供一个信号,脉冲前38时,输出放大器34已经超过预定的水平。
脉冲前38 ,然后产生一个触发脉冲,这是提供给脉冲发生器40 。
在为了提高灵敏度,该系统,传感器16和18岁以下的共振兴奋。
有相应的提供了一个连续波振荡器42提供了一个连续振荡信号在一个固定的频率,最好是共振频率的传感器16和18 。
这个振荡信号是提供给调制器44 。
要有效地激发发射机16 ,可取的做法是提供几个周期的共振频率信号,而不是一个单脉冲或单周期。
因此,脉冲发生器40是安排,在回应的应用存在的一个触发脉冲,提供一个控制脉冲调制器44有一个时间的平等的时间,时间预定人数的周期振荡信号从振荡器42 。
这个控制脉冲调制器的原因,44个通过了“水管爆裂”的周期,以激发发射机16 。
当电力是适用于所描述的电路,有足够的噪音在输入到放大器34 ,其输出触发脉冲发生器40至造成了一片叫好声,振荡周期,以提供整个电极22日和24日的发射器16 。
变送器16因此产生声波32条,其中影响到接收器18 。
接收器18 ,然后产生一个电脉冲,这是适用于输入放大器的34 ,这再次触发原因的脉冲发生器40 。
这个周期重演,使重复一系列的触发脉冲结果的输出脉冲前38 。
这脉冲列车是应用到46个柜位,以及向脉冲发生器40 。
变送器16日和接收18岁以下的间隔,除了由距离的“ D ”,它是理想的衡量。
传播时间的“T ”为一声波32往来变送器16日和接收18所给予的D 的吨/视频s
凡v s是声速在空气中之间的发射机16日和接收18 。
柜台46措施重复率触发脉冲,这是平等的1 /汤匙因此,重复率是平等的一至中五的S /四该声速空气中是一个功能的温度和湿度的空气,内容如下:其中T是温度,P是局部的压力,水汽,H是该气压,γ瓦特和γ一顷的比例不断的压力,具体的热不断货量具体的热水汽和干燥的空气,分别。
因此,虽然重复率触发脉冲测量非常准确地反46 ,声速的影响,温度和湿度,使测量的距离d无法确定准确。
根据这些原则的这项发明,参考单位提供的是12 。
参考单位12是相同的建设为测量单位的10个,因此,包括一电发射机50个,其中包括压电材料52夹心之间的一对电极的54和56 ,和一电接收机58 ,其中包括压电材料60夹心阶层之间的一对电极60,61,62和64 。
再次,传感器以外的其他类型压电可以
利用。
变送器50和接收五十八顷间隔,除了已知的和固定的参考距离“博士”。
电极60,61,62和64耦合到输入的放大器66 ,其输出是耦合的投入探测器68 。
输出探测器68是耦合的脉搏,前70产生触发脉冲。
触发脉冲应用到脉冲发生器的72个控制调制器74通过扫射从连续波振荡器76至变送器50 。
触发脉冲从脉冲前70也适用于反78 。
最好是,所有的传感器16 ,18 ,50和58具有相同的共振频率。
因此,振荡器42和76都在运作,频率和脉冲发电机40和第72条提供平等的输出脉冲宽度。
在用法上,测量装置10和参考资料股一十二顷在接近,使该声速在这两个单位是相同的。
虽然留级率的脉冲在测量单位,10和参考资料股十二顷每个温度和湿度的依赖性,能证明的距离D来衡量。
其中T R是传播时间超过距离博士在参考股12 。
这种关系是独立于双方的温度和湿度。
因此,产出的柜台46和78所提供的投入微处理器的90个利用的手段14 。
微处理器90是适当的程序提供了一个输出是成正比的比例,产出的柜台46和78 ,这反过来又是成正比的重复率分别触发脉冲列车的测量单位,10和参考资料股12 。
作为描述,这个比例是独立的温度和湿度,由于参考的距离,博士,是众所周知的,提供了一个准确的代表性距离四,利用手段,14日还包括一个显示92这是耦合和控制的微处理器,使90一个经营者可以随时确定的距离四实验表明,当之间的距离发射和接收传感器是太小了,思考的声波在传感器的表面有一个不小的作用,降低了测量精度。
因此,最好是每换一双分开,至少由某一个最小距离,最好是约四英寸。
因此,已披露的改善仪器的测量距离,利用超声波。
而一个说明性的体现,本发明已披露者外,据了解,各种修改和适应所披露的体现,将是显而易见的那些普通的技巧与艺术,这是打算把这个发明只限于由范围所附的索赔。
四、超声波测距原理
1、压电式超声波发生器原理
压电式超声波发生器实际上是利用压电晶体的谐振来工作的。
它有两个压电晶片和一个共振板。
当它的两极外加脉冲信号,其频率等于压电晶片的固有振荡
频率时,压电晶片将会发生共振,并带动共振板振动,便产生超声波。
反之,如果两电极间未外加电压,当共振板接收到超声波时,将压迫压电晶片作振动,将机械能转换为电信号,这时它就成为超声波接收器了。
2、超声波测距原理
超声波发射器向某一方向发射超声波,在发射时刻的同时开始计时,超声波在空气中传播,途中碰到障碍物就立即返回来,超声波接收器收到反射波就立即停止计时。
超声波在空气中的传播速度为340m/s,根据计时器记录的时间t,就可以计算出发射点距障碍物的距离(s),即:s=340t/2
五、超声波测距系统的电路设计
系统的特点是利用单片机控制超声波的发射和对超声波自发射至接收往返时间的计时,单片机选用8751,经济易用,且片内有4K的ROM,便于编程。
1、40kHz 脉冲的产生与超声波发射
测距系统中的超声波传感器采用UCM40的压电陶瓷传感器,它的工作电压是40kHz的脉冲信号,这由单片机执行下面程序来产生。
puzel:mov 14h, #12h;超声波发射持续200ms
here:cpl p1.0 ;输出40kHz方波
nop ;
nop ;
nop ;
djnz 14h,here;
ret
前方测距电路的输入端接单片机P1.0端口,单片机执行上面的程序后,在P1.0 端口输出一个40kHz的脉冲信号,经过三极管T放大,驱动超声波发射头UCM40T,发出40kHz的脉冲超声波,且持续发射200ms。
右侧和左侧测距电路的输入端分别接P1.1和P1.2端口,工作原理与前方测距电路相同。
2、超声波的接收与处理
接收头采用与发射头配对的UCM40R,将超声波调制脉冲变为交变电压信号,经运算放大器IC1A和IC1B两极放大后加至IC2。
IC2是带有锁定环的音频译码集成块LM567,内部的压控振荡器的中心频率f0=1/1.1R8C3,电容C4决
定其锁定带宽。
调节R8在发射的载频上,则LM567 输入信号大于25mV,输出端8脚由高电平跃变为低电平,作为中断请求信号,送至单片机处理.
前方测距电路的输出端接单片机INT0端口,中断优先级最高,左、右测距电路的输出通过与门IC3A的输出接单片机INT1端口,同时单片机P1.3和P1.4接到IC3A的输入端,中断源的识别由程序查询来处理,中断优先级为先右后左。
部分源程序如下:
receive1:push psw
push acc
clr ex1 ;关外部中断1
jnb p1.1, right ;P1.1引脚为0,转至右测距电路中断服务程序
jnb p1.2, left ;P1.2引脚为0,转至左测距电路中断服务程序
return:SETB EX1;开外部中断1
pop? acc
pop? psw
reti
right:...? ;右测距电路中断服务程序入口
ajmp return
left:... ;左测距电路中断服务程序入口 ajmp return
3、计算超声波传播时间
在启动发射电路的同时启动单片机内部的定时器T0,利用定时器的计数功能记录超声波发射的时间和收到反射波的时间。
当收到超声波反射波时,接收电路输出端产生一个负跳变,在INT0或INT1端产生一个中断请求信号,单片机响应外部中断请求,执行外部中断服务子程序,读取时间差,计算距离。
其部分源程序如下:
RECEIVE0:PUSH PSW
PUSH ACC
CLR EX0 ;关外部中断0
MOV R7, TH0 ;读取时间值
MOV R6, TL0?
CLR C
MOV A, R6
SUBB A, #0BBH;计算时间差
MOV 31H, A ;存储结果
MOV A, R7
SUBB A, #3CH
MOV 30H, A?
SETB EX0 ;开外部中断0
POP ACC?
POP PSW
RETI
六、超声波测距系统的软件设计
软件分为两部分,主程序和中断服务程序。
主程序完成初始化工作、各路超声波发射和接收顺序的控制。
定时中断服务子程序完成三方向超声波的轮流发射,外部中断服务子程序主要完成时间值的读取、距离计算、结果的输出等工作。
七、结论
对所要求测量范围30cm~200cm内的平面物体做了多次测量发现,其最大误差为0.5cm,且重复性好。
可见基于单片机设计的超声波测距系统具有硬件结构简单、工作可靠、测量误差小等特点。
因此,它不仅可用于移动机器人,还可用在其它检测系统中。
思考:至于为什么接收不用晶体管做放大电路呢,因为放大倍数搞不好,CX20106集成放大电路,还带自动电平增益控制,放大倍数为76dB,中心频率是38k到40k,刚好是超声波传感器的谐振频率。