利用MAXQ7667确定超声传感器的谐振频率和阻尼特性

时间:2012-09-14来源:网络
; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BACKGROUND-COLOR: rgb(255,255,255); orphans: 2; widows: 2; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">  {

  // Use the "damping_half_time" routine to measure the time in µs that it takes for the

  // ringing to drop to half of the peak value. Do this at more than one frequency so that

  // one of the frequencies will be within range of the transducer.

  wait2measure = damping_half_time(128, 88); //Measure damping time at 35kHz.

  halfpeak = damping_half_time(256, 101); //Measure damping time at 40kHz.

  if (wait2measure halfpeak) {wait2measure = halfpeak;} // Save the longest time.

  halfpeak = damping_half_time(384, 113); //Measure damping time at 45kHz.

  if (wait2measure halfpeak) {wait2measure = halfpeak;} // Save the longest time.

  // Repeatedly pulse the transducer with a constant width pulse while sweeping the receiver

  // frequency. Use the half-time value from the damping test (wait2measure) for the interval

  // between pulse transmission and reading LPFD (lowpass filter data).

  PLLF_bit.PLLF = 0; // Start the sweep at 30kHz.

  BPH = 77; // Pulse ~6.3µs. This value is easy to maintain over frequency.

  peak = 0;

  number_of_steps = 0;

  do // Sweep from 30kHz to 50kHz with step_size * 39.062500kHz.

  {

  usWaitTimer2(5000); // Wait 5ms for the frequency to settle.

  STIM = 0; // Reset the system timer. It controls the Pulse to LPF read time.

  BPH_bit .BSTT = 1; // Send burst.

  while(STIM wait2measure) {} // Wait the specified amount of time for the ringing to dampen.

  lpfdata[number_of_steps]= LPFD; // Store the LPF reading.

  if(lpfdata[number_of_steps]> peak) {peak = lpfdata[number_of_steps];} //Save the peak value.

  number_of_steps++;

  PLLF_bit.PLLF = number_of_steps * step_size; // Increase the frequency.

  BPH = 77 + number_of_steps; // Increase the duty cycle to maintain pulse width.

  } while (PLLF 512-step_size);

1 2 3 4 5 6

关键词: MAXQ7667 超声传感器 谐振频率 阻尼特性

加入微信
获取电子行业最新资讯
搜索微信公众号:EEPW

或用微信扫描左侧二维码

相关文章

查看电脑版