为什么用超声波测距离的时候,测得很不准?尤其在近距离时#include#include#define uint unsigned int#define uchar unsigned charuchar code table[]="0123456789.m";uchar code table1[]="too far";uchar code table2[]="the distance is:";uc
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/25 16:26:08
![为什么用超声波测距离的时候,测得很不准?尤其在近距离时#include#include#define uint unsigned int#define uchar unsigned charuchar code table[]=](/uploads/image/z/6122962-10-2.jpg?t=%E4%B8%BA%E4%BB%80%E4%B9%88%E7%94%A8%E8%B6%85%E5%A3%B0%E6%B3%A2%E6%B5%8B%E8%B7%9D%E7%A6%BB%E7%9A%84%E6%97%B6%E5%80%99%2C%E6%B5%8B%E5%BE%97%E5%BE%88%E4%B8%8D%E5%87%86%3F%E5%B0%A4%E5%85%B6%E5%9C%A8%E8%BF%91%E8%B7%9D%E7%A6%BB%E6%97%B6%23include%23include%23define+uint+unsigned+int%23define+uchar+unsigned+charuchar+code+table%5B%5D%3D%220123456789.m%22%3Buchar+code+table1%5B%5D%3D%22too+far%22%3Buchar+code+table2%5B%5D%3D%22the+distance+is%3A%22%3Buc)
为什么用超声波测距离的时候,测得很不准?尤其在近距离时#include#include#define uint unsigned int#define uchar unsigned charuchar code table[]="0123456789.m";uchar code table1[]="too far";uchar code table2[]="the distance is:";uc
为什么用超声波测距离的时候,测得很不准?尤其在近距离时
#include
#include
#define uint unsigned int
#define uchar unsigned char
uchar code table[]="0123456789.m";
uchar code table1[]="too far";
uchar code table2[]="the distance is:";
uchar code table3[]="please wait";
sbit lcden=P2^0;
sbit lcdrs=P2^1;
sbit trig=P2^2;
sbit echo=P3^2;
uint succeed;
float t,d,timeh,timel;
uint distance;
void delay(uint z)
{
uint x,y;
\x05for(x=z;x>0;x--)
\x05 for(y=110;y>0;y--);
}
void delay20us()
{
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
\x05_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
}
\x05\x05\x05\x05
\x05\x05\x05\x05 void display( )
\x05\x05\x05\x05 {
\x05\x05\x05\x05 uchar i;
\x05\x05\x05\x05 init();\x05 //1602初始化
\x05\x05\x05\x05 \x05 write_com(0x80);
\x05\x05\x05\x05\x05\x05\x05\x05 for(i=0;i
为什么用超声波测距离的时候,测得很不准?尤其在近距离时#include#include#define uint unsigned int#define uchar unsigned charuchar code table[]="0123456789.m";uchar code table1[]="too far";uchar code table2[]="the distance is:";uc
误差源于声速的不准确和声波传播时间的记录误差,声速跟空气的温度有关,传播时间记录跟仪器的精度有关.声波接受设备的水平线性也对结果有一定影响.