Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

HC-SR04 (ultrasonic sensor) verilog code help

Hi, for my project i have to interface the HC-SR04 (ultrasonic sensor) to my DE2-115 board. I have been struggling with the verilog code for a while. Can anyone please help me out with the code?

The sensor basically needs to tell me how far an object is and report back stating the distance measured also.

I understand that the distance can be found by distance= speed of sound X time duration and i've looked at the HC-SR04 manual for timing of the pulses.

Please help :(

12 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    As far as I know both multiply and devide are, but devision in one clock cycle needs a big area. It is possible that your FPGA has not enoug space left for that.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yea division doesn't work on Xilinx or Altera, from my experience. But multiplication works. Just wanted to confirm it. I think i have an idea of what to do now. Thanks so much :D