Forum Discussion

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

16bit pwm register in fpga

Hi,

I got a task to generate 16 bit pwm register on fpga. register which should be able to generate pwm with different frequency and duty cycles.

ANYBODY help me by providing some links and datas which could give me a good start.

Thank You

1 Reply

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

    --- Quote Start ---

    Hi,

    I got a task to generate 16 bit pwm register on fpga. register which should be able to generate pwm with different frequency and duty cycles.

    ANYBODY help me by providing some links and datas which could give me a good start.

    Thank You

    --- Quote End ---

    just thought of this:

    if you use 16bit register to accumulate inc1, inc2 and flip logic of an output at overflow then assuming your ratio is a/b:

    inc1 = a/(a+b) *2^16*2*2*f/clk

    inc2 = b/(a+b)*2^16*2*2*f/clk

    you add inc1 till overflow then add inc2 till overflow and flip at each overflow.

    but check my equations are right.