//超声波模块程序 //超声波模块程序 //Trig = P2^0 //Echo = P3^2 #include #define uchar unsigned char #define uint unsigned int int 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;x>0;x--) for(y=110;y>0;y--); } // void delay_20us() { uchar a ; for(a=0;a