- 1、本文档共8页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
--超声波测距模块--测距--最简单的c代码(- Ultrasonic Ranging Module - ranging - the simplest c code)
--超声波测距模块--测距--最简单的c代码(- Ultrasonic Ranging Module - ranging - the simplest c code)
I am * freshman electronic professional, because the school this semester is not the creation of relevant professional courses, all is now self SCM Technology Co.,, without temperature compensation, digital tube display with no latch chip, with a C language master write the most easy to read and can run effectively the microcontroller program is written to their most simple code, please dont laugh at me. O (a _ U) O*/
* because always want to try a few days ago to buy ultrasonic ranging, so the ultrasonic module HC-R4, the Internet to find a principle (the principle is very simple), then try to write their own code, the following code basically is to come out of their own, have no reference to others, not to say that I dont want to refer to someone else, but because a lot of online master but they write the code I basically have a lot cannot read ah, so the following program should have a lot of room for improvement. * /
The basic working principle of ultrasonic module / * (data from online to share):
(1) IO TRIG is used to trigger ranging, and at least 10us high level signal is given;
(2) the module automatically sends 8 40KHz Fang Bo, automatically detects whether there is a signal to return;
(3) there is a signal to return, through the IO port ECHO output a high level, the duration of the ultrasonic wave from the launch to the return time. Test distance = (high level time * speed of sound (340M/S)) /2;
It is very simple to use, a control port with a 10us above high level, you can wait for the high level output on the receiving port. An output can open the timer, when this port is low we can read the timer value, then the ranging time, can calculate the distance this constant cycle. That is, can achieve the measurement of the value of mobile. * /
/****************************************************************************************************************************************
文档评论(0)