Forum Discussion
5 Replies
- Altera_Forum
Honored Contributor
Perhaps there isn't much call for PWM in the FPGA world? People that need pwm typically use micro-controllers. Even so, I'd be there are PWM impleemntations on opencores.org Try http://opencores.org/project,pwm it is marked done.
- Altera_Forum
Honored Contributor
An IP core for a PWM? What is this world coming to? Some functions are so simple that an IP core makes no sense. PWM definitely falls into that category IMO.
- Altera_Forum
Honored Contributor
That took all of 5 minutes to write... - it would have been faster for you to have just written some HDL to do the job than the time you spent searching Quartus for such a simply design and then write this question and wait for answer.module pwmGenerator# ( parameter CTR_WIDTH = 10 //Width of PWM counter )( input clock, input reset, input tick, //Clock enable - to divide clock frequency as needed input duty, output reg pwmOut ); localparam ZERO = 0; localparam ONE = 1; reg pwmCntr; always @ (posedge clock or posedge reset) begin if (reset) begin pwmCntr <= ZERO; end else if (tick) begin pwmCntr <= pwmCntr + ONE; end end always @ (posedge clock) begin pwmOut <= (pwmCntr < duty); end - Altera_Forum
Honored Contributor
A Verilog implementation of the PWM was already provided on this forum, with the advantage to have the interface that allow you can build your own customized SOPC module to add it on Qsys such as you would do with a standard module, see that:
re: sopc pwm module (http://www.alteraforum.com/forum/showthread.php?t=6492&p=26669#post26669)- ASidd16
New Contributor
Hello
I have a Question about PWM Core.
I understand i can make the PWM working with the above code but how can i control it with the NIOS software and how can i merge it with other interfaces like i want to use all I2C, SPI and interrupts.
Please reply thank you..