HPWM will handle it for you. if 8 bit resolution is enough, it's the easiest way.