HDL Coder Delay (or Pause) in Code

I'm trying to create a VDHL program using HDL Coder which can cycle through the LEDs, so turn on LED(0), delay 1 second, so turn on LED(1), delay 1 second, etc.
I'm having a problem with the delay since I can't use the usual MATLAB pause function. Has anyone managed to successfully write a delay function for HDL coder? I tried having a large for loop, but that's not even getting translated to VHDL.
Many Thanks

답변 (1개)

Tim McBrayer
Tim McBrayer 2015년 3월 16일

0 개 추천

If you need a real-world delay, your best bet is to build a counter that counts N cycles and a comparison to a specific value. Each count will take 1/F sec, where F is your clock rate. For a 1 second delay, you will need to count F cycles.

카테고리

도움말 센터File Exchange에서 Code Generation에 대해 자세히 알아보기

제품

질문:

2015년 3월 16일

답변:

2015년 3월 16일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by