Creating A PWM (Pulse Width Modulator) generator using Statemachine?

Discussion in 'General Electronics Chat' started by hwing91, Feb 19, 2011.

  1. hwing91

    Thread Starter New Member

    Feb 19, 2011
    Hey, so I'm attempting to create a PWM generator using a state machine.
    I've only barely started to think about how i should approach this, but here's what i've thought out.

    Based on three inputs, lets define them as S2/S1/S0, it produces duty cycles in increments of 12.5%, from 0% - 87.%, such as 000 = 0%, 001 = 12.5%, 010 = 25%, so on and so forth till 111 = 87.5%.

    I've quickly made a truth table but im not sure if thats the best way to approach it.

    Someone else advised me to use a 3-but up counter, such as in this picture

    Seeing it makes it look do-able, but afterwards, im not quite sure how to actually limit the duty cycles from outputs D7-D0?