标签:变量 sig sign include div bee alt load ima
【资源下载】下载地址如下:
https://docs.qq.com/doc/DTlRSd01BZXNpRUxl


#include <reg51.h> //预处理命令,定义SFR的头
#include <math.h>
#include <intrins.h> //内部函数库文件
#define uchar unsigned char //定义缩写字符uchar
#define uint unsigned int //定义缩写字符uint
#define lcd_data P0 //定义LCD1602接口 P0
sbit DQ =P1^7; //将18B20DQ位定义为P1.7引脚
sbit lcd_RS=P2^0; //将18B20RS位定义为P2.0引脚
sbit lcd_RW=P2^1; //将18B20RW位定义为P2.1引脚
sbit lcd_EN=P2^2; //将18B20EN位定义为P2.2引脚
sbit BEEP=P3^0; //测量超出指定范围,报警
sbit Trig=P2^5; //HC-SR04触发信号输入
sbit Echo=P2^6; //HC-SR04回响信号输出
uint Distance; //测量的距离值
uint SPEEDSOUND; //声速
uint t[2]; //将距离转换成十进制数时,中间变量
uchar Buffer1[12]={0x20,0x20,0x20,0x20,0x63,0x6d,‘\0‘}; //距离显示cm
uchar tab[16]={0x20,0x20,0x20,0x20,0x44,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,‘\0‘}; //显示"Distance"
/**********lcd显示子程序************/
void delay20us(void) //20us延时
{
unsigned char a;
for(a=100;a>0;a--);
}

标签:变量 sig sign include div bee alt load ima
原文地址:https://www.cnblogs.com/ythero/p/14513689.html