51单片机超声波测距C程序

嵌入式系统 时间:2016-11-27来源:网络

超声波检测原理

超声波测距的程序流程图



程序如下:

//超声波模块程序
//超声波模块程序
//Trig= P2^0
//Echo= P3^2
#include
#define uchar unsigned char
#define uintunsigned int
//
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
//
void delay_20us()
{
uchar a ;
for(a=0;a<100;a++);
}

1 2

关键词: 51单片机超声波测距C程

加入微信
获取电子行业最新资讯
搜索微信公众号:EEPW

或用微信扫描左侧二维码

相关文章

查看电脑版