unsigned long mhz19Read(void)
{
unsigned long count1,count2,value,th,tl;
//float th,tl;
//unsigned int n1=0,n2=0,tl,th,value,v1,v2,flag=0;
while(MHZ19IO)
{
}
while(!MHZ19IO)//以上两步,寻找起始点
{
}
while(MHZ19IO)
{
count1+=1;
}
while(!MHZ19IO)
{
count2+=1;
}
th=count1/32;
tl=count2/32/1000;
value=2000*(th-2)/(th+tl-4);
return th;
}
value=mhz19Read();
sprintf(TxData,"%ld",value);
UartSendString(TxData, sizeof(TxData));
count1相当于一个自加器,计数用的