chashengboceju

所属分类:单片机开发
开发工具:C/C++
文件大小:170KB
下载次数:27
上传日期:2010-03-08 22:56:58
上 传 者liuxiang1987
说明:  AT89S52单片机控制的超声波测距,主程序首先对系统环境初始化,设置定时器T0工作模式为16位的定时计数器模式,置位总中断允许位EA并给显示端口P0和P2清0。然后调用超声波发生子程序送出一个超声波脉冲,为避免超声波从发射器直接传送到接收器引起的直接波触发,需延迟0.1ms(这也就是测距器会有一个最小可测距离的原因)后,才打开外中断0接收返回的超声波信号。由于采用12MHz的晶振,机器周期为1us,当主程序检测到接收成功的标志位后,将计数器T0中的数(即超声波来回所用的时间)按下式计算即可测得被测物体与测距仪之间的距离,设计时取20℃时的声速为344 m/s则有: d=(C*T0)/2 =172T0/10000cm(其中T0为计数器T0的计数值) 测出距离后结果将以十进制BCD码方式LED,然后再发超声波脉冲重复测量过程
(AT89S52 MCU-controlled ultrasonic ranging, the main program first initializes the system environment, set the timer T0 mode for 16-bit timer counter mode, the set EA and the total Interrupt Enable bit ports P0 and P2 to show clear 0. Then send a subroutine call occurs ultrasonic ultrasonic pulses, in order to avoid direct transmission of ultrasound from the transmitter to the receiver caused by the direct-wave trigger, must delay 0.1ms (This is the range-finder will have a minimum measurable distance reasons) after the Only open the external interrupt 0 to receive the returned ultrasonic signals. As a result of 12MHz crystal, the machine cycle 1us, when the main program detects that received flag of success, will be the counter of the number of T0 (ie, used ultrasound back and forth time) determined by the formula and the measured object can be measured measured from the distance between the instrument, designed to take 20 ℃ when the speed of sound is 344 m/s there are: d = (C* T0))

文件列表:
test\cheshi\cheshi.OBJ (6656, 2008-05-05)
test\cheshi\cheshi.SRC (15481, 2008-05-05)
test\cheshi\cheshi._ia (47, 2008-05-05)
test\cheshi\cheshi.__i (62, 2008-05-05)
test\cheshi\STARTUP.obj (787, 2008-05-03)
test\cheshi\tiaoshi (5338, 2008-05-05)
test\cheshi\tiaoshi.hex (2058, 2008-05-05)
test\cheshi\tiaoshi.lnp (111, 2008-05-05)
test\cheshi\tiaoshi.plg (6739, 2008-05-05)
test\cheshi.c (3577, 2008-05-03)
test\cheshi.ls1 (57595, 2008-05-05)
test\cheshi.LST (7005, 2008-05-05)
test\cheshi.OBJ (8520, 2008-05-03)
test\fdf.hex (5610, 2008-05-03)
test\fdf.lnp (48, 2008-05-03)
test\fdf.M51 (9801, 2008-05-03)
test\fdf.Opt (1035, 2008-05-05)
test\fdf.plg (173, 2008-05-05)
test\fdf.Uv2 (2435, 2008-05-05)
test\huibian\CFUNC.A51 (1181, 2008-05-03)
test\huibian\CFUNC.c (230, 2008-05-03)
test\huibian\CFUNC.ls1 (4185, 2008-05-03)
test\huibian\CFUNC.LST (4180, 2008-05-03)
test\huibian\CFUNC.OBJ (488, 2008-05-03)
test\huibian\CFUNC.__i (53, 2008-05-03)
test\huibian\cs_t.a51 (760, 2008-05-04)
test\huibian\cs_t.LST (2598, 2008-05-04)
test\huibian\cs_t.OBJ (430, 2008-05-04)
test\huibian\delay.a51 (672, 2008-05-03)
test\huibian\delay.LST (2096, 2008-05-04)
test\huibian\delay.OBJ (361, 2008-05-04)
test\huibian\DISPLAY.a51 (3292, 2008-05-03)
test\huibian\DISPLAY.LST (7729, 2008-05-04)
test\huibian\DISPLAY.OBJ (913, 2008-05-04)
test\huibian\huibian (1899, 2008-05-03)
test\huibian\huibian.lnp (73, 2008-05-03)
test\huibian\huibian.M51 (7539, 2008-05-03)
test\huibian\huibian.Opt (1206, 2008-05-03)
test\huibian\huibian.plg (178, 2008-05-03)
test\huibian\huibian.Uv2 (2564, 2008-05-03)
... ...

近期下载者

相关文件


收藏者