Richard, I can't help but notice your table only goes to 511. That's half of the available pwm pulse width.