Forum Discussion
PWM control problem
- 7 years ago
Where is your test code? That is where control of 'value' comes from. Or did Quartus create that for you? Is that why you can't find where to change it?
I recommend that you use ModelSim - a much more widely use simulation tool. Look at this guide:
https://www.youtube.com/watch?v=qZNL1C0TwY8
The example is similar to the code you're using. Get the test bench right and I think your code will do what you want.
Cheers,
Alex
It looks approximately right to me. Try changing your 'value' less frequently - every 6 clock cycles (or so) is far too quick. You'd usually expect to set a desired PWM value for multiple PWM cycles (16 clocks per cycle in your case) before changing it.
There are certainly some more elegant ways to code this. However, as I've said your code should do something approximately right. So, modify as above and confirm whether it behaves as you'd expect.
Cheers,
Alex
- JYang1017 years ago
New Contributor
First,thank you for reply.
Where I stuck is exactly don't know how to make `value` to slower,I can't figure out how to make a `input` to change slower to 16 clocks...
Can you give me some ideas?any hint?I've already tried lots ways,but it all end up the same,the PWM has its output but due to `value` changing too fast...it just don't make it right.
What I'm trying to achieve...