51单片机超声波模块的C语言程序.docxVIP

  • 21
  • 0
  • 约3.89千字
  • 约 13页
  • 2017-09-06 发布于重庆
  • 举报
51单片机超声波模块的C语言程序

//超声波模块程序//超声波模块程序//Trig = P2^0//Echo = P3^2#include reg52.h #define uchar unsigned char#define uint unsigned intint time;int succeed_flag;uchar timeL;uchar timeH;sbit Trig=P1^0;sbit Echo=P3^2;uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f, 0x6f};uchar code table1[]={0,1,2,3,4,5,6,7};//void delay(uint z){ uint x,y; for(x=z;x0;x--) for(y=110;y0;y--);}//void delay_20us() { uchar a ; for(a=0;a100;a++); }//***************************************************************//显示数据转换程序void display(uint temp) { uchar ge,shi,bai; bai=temp/100; shi=(temp%100)/10;

文档评论(0)

1亿VIP精品文档

相关文档