Altera_Forum
Honored Contributor
13 years agodistance calculating in Ultra-sonic ranger , please help !
datasheet information :
The SRF04 provides an echopulse proportional to distance. If the width of the pulse is measured in uS,then dividing by 58 will give you the distance in cm, or dividing by 148 willgive the distance in inches. uS/58=cm or uS/148=inches. I wrote a VHDL program which i configured a clock counter for counting the clock cycles when echo pin is high. my clock frequency is 50MHz. - it means the period time is : 20nSec or 0.02uSec . in my opinion, for claculating the distance in cm , i have to do this calculation(theoreticly) : distance <= (0.02/58)*echo_counter ; but - i want a synthesisable program
any one have an idea ?
thank you for help...