基于AVR单片机实现超声波测距的程序编写-#include
#defineucharunsignedchar
#defineuintunsignedint
ucharint_flag;
uintqian,bai,shi,ge;
uinti;
floatdistance;
//AlphanumericLCDModulefunctions
#asm
程序如下:#includereg51.h>#defineuintunsignedint#defineucharunsignedcharsbitkey3=P2^0;//按键的行检测信号sbit..
#includereg51.h>#defineuintunsignedint#defineucharunsignedcharsbitDAT=P1^1;//模拟串口数据发送端sbitCLK=P1^
#includereg52.h>#defineuintunsignedint#defineucharunsignedcharuchartemp,key=16;sbitduan=P2^6;sbit
代码:#includereg52.h>#defineuintunsignedint#defineucharunsignedchar//sbitA=P2^0;//sbitB=P2^1;//sbit
keilc编译51#defineucharunsignedchar#defineuintunsignedint#includereg51.h#includeintrins.hsbitScl=P3^3;
#includemsp430x14x.h#defineuintunsignedint#defineucharunsignedchar#defineNum_of_Results8unsignedintr