【正文】
f ultrasonic distance measurementUltrasonic transmitter in a direction to launch ultrasonic, 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, this is: s=340t/2B. Ultrasonic Ranging System for the Second Circuit DesignSystem is characterized by singlechip microputer to control the use of ultrasonic transmitter and ultrasonic receiver since the launch from time to time, singlechip selection of 8751,economictouse,and the chip has 4K of ROM, to facilitate programming. Circuit schematic diagram shown in only the front range of the circuit wiring diagram, left and right in front of Ranging circuits and the same circuit, it is omitted.1,40kHZ ultrasonic pulse generated with the launchRanging system using the ultrasonic sensor of piezoelectric ceramic sensors UCM40,its operating voltage of the pulse signal is 40kHz,which by the singlechip implementation of the following procedures to generate.Puzel: mov 14h,12h。ultrasonic firing continued 200mshere: cpl 。output 40kHz square wavenop。nop。nop。djna 14h,here。retRanging in front of singlechip termination circuit input port, single chip implementation of the above procedure, the port in a 40kHz pulse output signal, after implementation transistor T, the drive to launch the first ultrasonic UCM40T,isued 40kHz ultrasonic pulse, and the continued launch of the right and the left side of the circuit, respectively, then input ,the working principle and circuit in front of the same location.2,recepyiong and processing of ultrasonicUsed to receive the first launch of the first pair UCM40R,the ultrasonic pulse modulation signal into an alternating voltage, the opamp amplification ICIA and after polarization ICIB to IC2 is locked loop with audio decoder chip LM567,internal voltagecontrolled oscillator centre frequency of f0=1/,capacitor C4determine their target 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 lowlevel, as interrupt request signals to the singlechip processing.Ranging in front of singlechip termination circuit output port INT0 interrupt the highest priority, right or left location of the output circuit with output gate IC3A access INT1 port singlechip, while singlechip and received input IC3A,interrupted by the process to identity 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 pswPush accClr ex1。related external interrupt 1jnb ,right。 pin to 0,ranging from right to interrupt service routine circuit,left。 pin to 0,to the left ranging circuit interrupt service routinereturn: SETB EX1。open external interrupt 1pop accpop pswretiright:…。right location entrance circuit interrupt service routineAjmp Returnleft:…。left Ranging entrance circuit interrupt service routineAjmp Return3,the calculate of ultrasonic propagation timeWhen you start firing at the same time start the singlechip 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, singlechip microputer 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。strorage results MOV A,R7 SUBB A,3CH MOV 30H,A SETB EX0。open external interrupt 0 POP ACC POP PSW RETIFor a flat target, a distance measurement consists of two phases: a coarse measurement and. A fine measurement:Step1:Transmission of one pulse train to produce a simple ultrasonic wave.Step2:Changing the gains of both echo amplifiers according to equation, until the echo is detected.Step3:Detection of the amplitudes and zerocrossing times of both echoes.Step4:Setting the gains of both echo amplifiers to normalize the output at, say 3 volts.Setting the period of the next pulses according to the: period of echoes. Setting the time window according to the data of step 2.Step 5:Sending two pulse trains to produce an interfered wave. Testing the zerocrossing times and amplitudes of the echoes. IF phase inversion occurs in the echo, determine to otherwise calculate to by interpolation using the amplitudes near the trough. Derive t sub m1 and sub m2.Step 6:Calculation of the distance y using equation.C. Fourth, the ultrasonic ranging system software designSoftware 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 plete three of the rotation direction of ultrasonic launch, the main external interrupt service subroutine to read the value of pletion time, distance calculation, the results of output and so on…System initialization after the start timer T1 starts counting