文件名称:chashengboceju
- 所属分类:
- 单片机(51,AVR,MSP430等)
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 170kb
- 下载次数:
- 0次
- 提 供 者:
- 刘*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
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)
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
....\......\cheshi.SRC
....\......\cheshi._ia
....\......\cheshi.__i
....\......\STARTUP.obj
....\......\tiaoshi
....\......\tiaoshi.hex
....\......\tiaoshi.lnp
....\......\tiaoshi.plg
....\cheshi.c
....\cheshi.ls1
....\cheshi.LST
....\cheshi.OBJ
....\fdf.hex
....\fdf.lnp
....\fdf.M51
....\fdf.Opt
....\fdf.plg
....\fdf.Uv2
....\huibian\CFUNC.A51
....\.......\CFUNC.c
....\.......\CFUNC.ls1
....\.......\CFUNC.LST
....\.......\CFUNC.OBJ
....\.......\CFUNC.__i
....\.......\cs_t.a51
....\.......\cs_t.LST
....\.......\cs_t.OBJ
....\.......\delay.a51
....\.......\delay.LST
....\.......\delay.OBJ
....\.......\DISPLAY.a51
....\.......\DISPLAY.LST
....\.......\DISPLAY.OBJ
....\.......\huibian
....\.......\huibian.lnp
....\.......\huibian.M51
....\.......\huibian.Opt
....\.......\huibian.plg
....\.......\huibian.Uv2
....\.......\laoshigeide
....\.......\laoshigeide.c
....\.......\laoshigeide.hex
....\.......\laoshigeide.lnp
....\.......\laoshigeide.LST
....\.......\laoshigeide.M51
....\.......\laoshigeide.OBJ
....\.......\laoshigeide.Opt
....\.......\laoshigeide.plg
....\.......\laoshigeide.Uv2
....\.......\lizhong.hex
....\.......\lizhong.lnp
....\.......\lizhong.M51
....\.......\lizhong.Opt
....\.......\lizhong.plg
....\.......\lizhong.Uv2
....\.......\lizhong1.plg
....\.......\lizhong1122.plg
....\.......\main.c
....\.......\main.ls1
....\.......\main.LST
....\.......\main.OBJ
....\.......\main.SRC
....\.......\STARTUP.A51
....\.......\STARTUP.LST
....\.......\STARTUP.OBJ
....\.......\ttpp
....\.......\ttpp.hex
....\.......\ttpp.lnp
....\.......\ttpp.M51
....\.......\ttpp.Opt
....\.......\ttpp.plg
....\.......\ttpp.Uv2
....\.......\新建 文本文档.LST
....\.......\李忠.c
....\.......\李忠.LST
....\.......\李忠.OBJ
....\shiyan.lst
....\shiyan.obj
....\shiyan.__i
....\STARTUP.A51
....\STARTUP.LST
....\STARTUP.OBJ
....\sy.bin
....\tiaoshi
....\tiaoshi.lnp
....\tiaoshi.M51
....\tiaoshi.Opt
....\tiaoshi.plg
....\tiaoshi.Uv2
....\yin
....\yin.c
....\yin.hex
....\yin.lnp
....\yin.LST
....\yin.M51
....\yin.OBJ
....\yin.Opt
....\yin.plg
....\yin.Uv2
....\......\cheshi.SRC
....\......\cheshi._ia
....\......\cheshi.__i
....\......\STARTUP.obj
....\......\tiaoshi
....\......\tiaoshi.hex
....\......\tiaoshi.lnp
....\......\tiaoshi.plg
....\cheshi.c
....\cheshi.ls1
....\cheshi.LST
....\cheshi.OBJ
....\fdf.hex
....\fdf.lnp
....\fdf.M51
....\fdf.Opt
....\fdf.plg
....\fdf.Uv2
....\huibian\CFUNC.A51
....\.......\CFUNC.c
....\.......\CFUNC.ls1
....\.......\CFUNC.LST
....\.......\CFUNC.OBJ
....\.......\CFUNC.__i
....\.......\cs_t.a51
....\.......\cs_t.LST
....\.......\cs_t.OBJ
....\.......\delay.a51
....\.......\delay.LST
....\.......\delay.OBJ
....\.......\DISPLAY.a51
....\.......\DISPLAY.LST
....\.......\DISPLAY.OBJ
....\.......\huibian
....\.......\huibian.lnp
....\.......\huibian.M51
....\.......\huibian.Opt
....\.......\huibian.plg
....\.......\huibian.Uv2
....\.......\laoshigeide
....\.......\laoshigeide.c
....\.......\laoshigeide.hex
....\.......\laoshigeide.lnp
....\.......\laoshigeide.LST
....\.......\laoshigeide.M51
....\.......\laoshigeide.OBJ
....\.......\laoshigeide.Opt
....\.......\laoshigeide.plg
....\.......\laoshigeide.Uv2
....\.......\lizhong.hex
....\.......\lizhong.lnp
....\.......\lizhong.M51
....\.......\lizhong.Opt
....\.......\lizhong.plg
....\.......\lizhong.Uv2
....\.......\lizhong1.plg
....\.......\lizhong1122.plg
....\.......\main.c
....\.......\main.ls1
....\.......\main.LST
....\.......\main.OBJ
....\.......\main.SRC
....\.......\STARTUP.A51
....\.......\STARTUP.LST
....\.......\STARTUP.OBJ
....\.......\ttpp
....\.......\ttpp.hex
....\.......\ttpp.lnp
....\.......\ttpp.M51
....\.......\ttpp.Opt
....\.......\ttpp.plg
....\.......\ttpp.Uv2
....\.......\新建 文本文档.LST
....\.......\李忠.c
....\.......\李忠.LST
....\.......\李忠.OBJ
....\shiyan.lst
....\shiyan.obj
....\shiyan.__i
....\STARTUP.A51
....\STARTUP.LST
....\STARTUP.OBJ
....\sy.bin
....\tiaoshi
....\tiaoshi.lnp
....\tiaoshi.M51
....\tiaoshi.Opt
....\tiaoshi.plg
....\tiaoshi.Uv2
....\yin
....\yin.c
....\yin.hex
....\yin.lnp
....\yin.LST
....\yin.M51
....\yin.OBJ
....\yin.Opt
....\yin.plg
....\yin.Uv2