新闻中心

EEPW首页>嵌入式系统>设计应用> 51单片机超声波测距C程序

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

作者: 时间:2016-11-27 来源:网络 收藏

本文引用地址://m.amcfsurvey.com/article/201611/322451.htm

超声波检测原理

超声波测距的程序流程图



程序如下:

//超声波模块程序
//超声波模块程序
//Trig= P2^0
//Echo= P3^2
#include
#define uchar unsigned char
#define uint unsigned 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 下一页

评论


技术专区

关闭