东北大学秦皇岛分校毕业设计(论文) 第 32 页 ORG 44H JMP FS ORG 55H JMP DISPLAY
CHX:MOV 14H,#12H :超声波发射持续200ms FS:MOV 45H,#12H ;P1.0发出40kHz方波 HERE:CPL p1.0 NOP NOP NOP
DJNZ 45H,HERE RET
SEGDISC:PUSH ACC ;显示 MOV A,R1
MOV DPTR,#SEGTAB MOVC A,@A+DPTR MOV R2,A POP ACC RET ORG 8000H
SEGTAB:DB 3FH,06H,5BH,4FH,66H DB 6DH,7DH,07H,7FH,6FH RET
DISPLAY:PUSH ACC MOV A,R4 MOV R1,A LCALL SEGDISC MOV P0,R2 CLR P2.0
东北大学秦皇岛分校毕业设计(论文) 第 33 页 MOV A,R5 MOV R1,A LCALL SEGDISC MOV P0,R2 CLR P2.1 POP ACC RET
BJ:MOV A,R4 ;报警 ADD A,R5 CJNE A,#64H,NEQ EQ:CLR P1.1 NEQ:JC SMALL SETB P1.1 SMALL:JMP EQ RET
extrn code(_COUNT) ;***主程序*** START:
SETB EA ;开总中断 CLR EX0 SETB EX1
SETB PT1 ;T1、INT0拥有高优先级 SETB PX0 LCALL FS MOV TH0,#81 MOV TL0,#38 LCALL _COUNT MOV R5,30H MOV R4,31H
东北大学秦皇岛分校毕业设计(论文) 第 34 页 LCALL DISPLAY END
#include
#define shw DBYTE[0x30] #define gw DBYTE[0x31] #define uchar unsigned char uchar time; void count() {
time=TH0;
time=time*256+TL0 ;//取出定时器0值 time=time*17/10000; shw=time/10; }
附录C 外文资料及翻译 Ultrasonic distance meter
Document Type and Number:United States Patent 5442592 ??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.
Publication Date:08/15/1995
gw=time;
东北大学秦皇岛分校毕业设计(论文) 第 35 页 Primary Examiner:Lobo, Ian J. DETAILED DESCRIPTION
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 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.
B.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.
C.Fourth, the ultrasonic ranging system software design
Software is divided into two parts, the main program and interrupt service routine. 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
东北大学秦皇岛分校毕业设计(论文) 第 36 页 completion time, distance calculation, the results of the output and so on.
D. 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.
中文译文C 超声波测距仪
文件类型和数目:美国专利5442592
摘要:提出了一种可以抵消温度的影响和湿度的变化的新型超声波测距仪,包括测量单元和参考资料。在每一个单位,重复的一系列脉冲的产生,每有一个重复率,直接关系到各自之间的距离,发射机和接收机。该脉冲序列提供给各自的计数器,计数器的产出的比率,是用来确定被测量的距离。
出版日期: 1995年8月15日 主审查员:罗保.伊恩j. 详细说明
一 超声波测距原理
1、压电式超声波发生器原理
压电式超声波发生器实际上是利用压电晶体的谐振来工作的。超声波发生器内部有两个压电晶片和一个共振板。当它的两极外加脉冲信号,其频率等于压电晶片的固有振荡频率时,压电晶片将会发生共振,并带动共振板振动,便产生超声波。反之,如果两电极间未外加电压,当共振板接收到超声波时,将压迫压电晶片作振动,将机械能转换
东北大学秦皇岛分校毕业设计(论文) 第 37 页 为电信号,这时它就成为超声波接收器了。
2、超声波测距原理
超声波发射器向某一方向发射超声波,在发射时刻的同时开始计时,超声波在空气中传播,途中碰到障碍物就立即返回来,超声波接收器收到反射波就立即停止计时。超声波在空气中的传播速度为340m/s,根据计时器记录的时间t,就可以计算出发射点距障碍物的距离(s),即:s=340t/2。
二 超声波测距系统的电路设计
系统的特点是利用单片机控制超声波的发射和对超声波自发射至接收往返时间的计时,单片机选用8751,经济易用,且片内有4K的ROM,便于编程。
三、超声波测距系统的软件设计
软件分为两部分,主程序和中断服务程序。主程序完成初始化工作、各路超声波发射和接收顺序的控制。
定时中断服务子程序完成三方向超声波的轮流发射,外部中断服务子程序主要完成时间值的读取、距离计算、结果的输出等工作。
四、结论
对所要求测量范围30cm~200cm内的平面物体做了多次测量发现,其最大误差为0.5cm,且重复性好。可见基于单片机设计的超声波测距系统具有硬件结构简单、工作可靠、测量误差小等特点。因此,它不仅可用于移动机器人,还可用在其它检测系统中。
思考:至于为什么接收不用晶体管做放大电路呢,因为放大倍数搞不好,CX20106集成放大电路,还带自动电平增益控制,放大倍数为76dB,中心频率是38k到40k,刚好是超声波传感器的谐振频率。