|
以下代碼是測速的,我不知道里面的含義,誰幫解釋一下
霍爾測速單片機(jī)源碼如下:
void time0() interrupt 1
{
uchar m,n;
TH0=0x3c;
TL0=0xb0; //50ms
m++;
if(LED_SEC==1)
{
n++;
if(n>=10)
{
n=0;
LED_SEC=0;
}
}
if(m>=10)
{
m=0;
Mileage=Mileage+10*(Velocity/3.6)/2; //里程m=里程+速度km/h/3.6/2
Velocity=count *2*3.14*RADIUS /100000*2*3600 /40;//將500ms的距離經(jīng)過運(yùn)算得到km/h,將速度/100,方便顯示
count=0;
}
}
|
|