利用MAXQ7667確定超聲傳感器的諧振頻率和阻尼特性
// LPFD reading that is 70% of the peak reading.
for (i = 0; i number_of_steps; i++)
{
if (lpfdata[i] > peak*0.7)
{
first70 = i;
i = number_of_steps;
}
}
for (i = number_of_steps; i >0; i--)
{
if (lpfdata[i] > peak*0.7)
{
second70 = i;
i= 1;
}
}
i = (first70 + second70)/2; // i = the loop value at the center frequency.
center_pllf = i*step_size; // Set PLLF_bit.PLLF to this value for the resonant frequency.
//Remeasure damping using the center frequency.
damp_time = damping_half_time(center_pllf, 75);
// At this point there are three valuable pieces of information about the transducer.
// Peak = the peak value from the frequency sweep.
// center_pllf = the PLLF setting at the resonant frequency.
// damp_time = time for the resonance to decay to 1/2 the peak value.
center_burst_frequency = 16000000/Burst_Clock_Divider*(center_pllf+768)/1024;
SendData();
} // While(1)
} // End Main
評(píng)論