Forum Discussion
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- You will end up with distance <= (echo_counter/29); --- Quote End --- Scaling the output to a fixed point number with higher resolution than whole mm seems reasonable. If you want to use decimal (0.1, 0.01) or binary scaling (2^-N) factors depends on the application. Dividing by an integer constant is the exact solution, but usually not the preferred method. You can save a lot of FPGA resources by replacing the division with a multiply and binary shift. 1/29 is e.g. very near to 565/2^14.