很全的资料,程序都测试了,超声波测距离的
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 228932 2010-03-26 17:35 超声波测距资料HC-SR04超声波测距模块.pdf
文件 4702 2010-06-20 22:33 超声波测距资料超声波PIC单片机C程序HC-SR04PIC.txt
文件 1672 2010-06-20 22:41 超声波测距资料超声波PIC单片机C程序.rar
文件 1067134 2009-11-29 19:09 超声波测距资料超声波模块参考.pdf
文件 5287 2009-12-22 22:40 超声波测距资料超声波测距51C程序51.C
文件 2229 2010-06-20 22:41 超声波测距资料超声波测距51C程序.rar
文件 15396 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量
文件 6885 2010-06-20 22:31 超声波测距资料超声波测距LC1602显示脉宽测量.c
文件 5450 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量.hex
文件 33 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量.lnp
文件 13847 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量.LST
文件 17585 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量.M51
文件 16477 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量.OBJ
文件 1165 2010-05-01 20:57 超声波测距资料超声波测距LC1602显示脉宽测量.Opt
文件 227 2011-08-25 20:48 超声波测距资料超声波测距LC1602显示脉宽测量.plg
文件 2148 2010-04-15 12:33 超声波测距资料超声波测距LC1602显示脉宽测量.Uv2
文件 1160 2010-05-01 20:46 超声波测距资料超声波测距LC1602显示脉宽测量_Opt.Bak
文件 2114 2009-08-06 15:12 超声波测距资料超声波测距LC1602显示脉宽测量_Uv2.Bak
文件 26951 2010-06-20 22:41 超声波测距资料超声波测距LC1602显示.rar
文件 17573 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序
文件 13263 2010-06-20 22:33 超声波测距资料超声波测距LCD12864显示测距程序.C
文件 8940 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.hex
文件 48 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.lnp
文件 21840 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.LST
文件 19085 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.M51
文件 19088 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.OBJ
文件 987 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.Opt
文件 646 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.plg
文件 2151 2010-04-21 23:37 超声波测距资料超声波测距LCD12864显示测距程序.Uv2
文件 986 2010-04-21 23:37 超声波测距资料超声波测距LCD12864显示测距程序_Opt.Bak
............此处省略42个文件信息
/*============================================================
//HC-SRO4 超声波测距模块 DEMO 程序
// QQ: 517535000
//淘宝店铺:http://shop58246706.taobao.com
==============================================================
SMC1602A(16*2)模拟口线接线方式
连接线图:
---------------------------------------------------
|LCM-----51 | LCM-----51 | LCM------51 |
--------------------------------------------------|
|DB0-----P1.0 | DB4-----P1.4 | RW-------P3.4 |
|DB1-----P1.1 | DB5-----P1.5 | RS-------P3.3 |
|DB2-----P1.2 | DB6-----P1.6 | E--------P3.5 |
|DB3-----P1.3 | DB7-----P1.7 | VLCD接1K电阻到GND|
---------------------------------------------------
接线:模块TRIG接 P2.6 ECH0 接P2.7
本程序源码只供学习参考,不得应用于商业用途,如有需要请联系作者。
[注:AT89x51使用12M或11.0592M晶振实测使用11.0592M]
=============================================================*/
#include //器件配置文件
#include
#define RX P2_7
#define TX P2_6
#define LCM_RW P3_4 //定义LCD引脚
#define LCM_RS P3_3
#define LCM_E P3_5
#define LCM_Data P1
#define Key_Data P2_0 //定义Keyboard引脚
#define Key_CLK P3_2
#define Busy 0x80 //用于检测LCM状态字中的Busy标识
void LCMInit(void);
void DisplayOneChar(unsigned char X unsigned char Y unsigned char DData);
void DisplayListChar(unsigned char X unsigned char Y unsigned char code *DData);
void Delay5Ms(void);
void Delay400Ms(void);
void Decode(unsigned char ScanCode);
void WriteDataLCM(unsigned char WDLCM);
void WriteCommandLCM(unsigned char WCLCMBuysC);
unsigned char ReadDataLCM(void);
unsigned char ReadStatusLCM(void);
unsigned char code mcustudio[] ={“mcustudio.com.cn“};
unsigned char code email[] = {“fhwxaoo@163.com “};
unsigned char code Cls[] = {“ “};
unsigned char code ASCII[15] = {‘0‘‘1‘‘2‘‘3‘‘4‘‘5‘‘6‘‘7‘‘8‘‘9‘‘.‘‘-‘‘M‘};
static unsigned char DisNum = 0; //显示用指针
unsigned int time=0;
unsigned long S=0;
bit flag =0;
unsigned char disbuff[4] ={ 0000};
//写数据
void WriteDataLCM(unsigned char WDLCM)
{
ReadStatusLCM(); //检测忙
LCM_Data = WDLCM;
LCM_RS = 1;
LCM_RW = 0;
LCM_E = 0; //若晶振速度太高可以在这后加小的延时
LCM_E = 0; //延时
LCM_E = 1;
}
//写指令
void WriteCommandLCM(unsigned char WCLCMBuysC) //BuysC为0时忽略忙检测
{
if (BuysC) ReadStatusLCM(); //根据需要检测忙
LCM_Data = WCLCM;
LCM_RS = 0;
LCM_RW = 0;
LCM_E = 0;
LCM_E = 0;
LCM_E = 1;
}
//读数据
unsigned char ReadDataLCM(void)
{
LCM_RS = 1;
LCM_RW = 1;
LCM_E = 0;
LCM_E = 0;
LCM_E = 1;
return(LCM_Data);
}
//读状态
unsigned char ReadStatusLCM(void)
{
LCM_Data = 0xFF;
LCM_RS = 0;
LCM_RW = 1;
LCM_E = 0;
LCM_E = 0;
LCM_E = 1;
while (LCM_Data & Busy); //检测忙信号
return(LCM_Data);
}
void LCMInit(void) //LCM初始化
{
LCM_Data = 0;
WriteCommandLCM(0x380); //三次显示模式设置,不检测忙信号
Delay5Ms();
WriteCommandLCM(0x380);
Delay5Ms();
WriteCommandLCM(0x380);
Delay5Ms();
WriteCommandLCM(0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 228932 2010-03-26 17:35 超声波测距资料HC-SR04超声波测距模块.pdf
文件 4702 2010-06-20 22:33 超声波测距资料超声波PIC单片机C程序HC-SR04PIC.txt
文件 1672 2010-06-20 22:41 超声波测距资料超声波PIC单片机C程序.rar
文件 1067134 2009-11-29 19:09 超声波测距资料超声波模块参考.pdf
文件 5287 2009-12-22 22:40 超声波测距资料超声波测距51C程序51.C
文件 2229 2010-06-20 22:41 超声波测距资料超声波测距51C程序.rar
文件 15396 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量
文件 6885 2010-06-20 22:31 超声波测距资料超声波测距LC1602显示脉宽测量.c
文件 5450 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量.hex
文件 33 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量.lnp
文件 13847 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量.LST
文件 17585 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量.M51
文件 16477 2010-05-01 20:52 超声波测距资料超声波测距LC1602显示脉宽测量.OBJ
文件 1165 2010-05-01 20:57 超声波测距资料超声波测距LC1602显示脉宽测量.Opt
文件 227 2011-08-25 20:48 超声波测距资料超声波测距LC1602显示脉宽测量.plg
文件 2148 2010-04-15 12:33 超声波测距资料超声波测距LC1602显示脉宽测量.Uv2
文件 1160 2010-05-01 20:46 超声波测距资料超声波测距LC1602显示脉宽测量_Opt.Bak
文件 2114 2009-08-06 15:12 超声波测距资料超声波测距LC1602显示脉宽测量_Uv2.Bak
文件 26951 2010-06-20 22:41 超声波测距资料超声波测距LC1602显示.rar
文件 17573 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序
文件 13263 2010-06-20 22:33 超声波测距资料超声波测距LCD12864显示测距程序.C
文件 8940 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.hex
文件 48 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.lnp
文件 21840 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.LST
文件 19085 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.M51
文件 19088 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.OBJ
文件 987 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.Opt
文件 646 2010-05-01 20:54 超声波测距资料超声波测距LCD12864显示测距程序.plg
文件 2151 2010-04-21 23:37 超声波测距资料超声波测距LCD12864显示测距程序.Uv2
文件 986 2010-04-21 23:37 超声波测距资料超声波测距LCD12864显示测距程序_Opt.Bak
............此处省略42个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)