Well, first of all I am talking about AC inverter (a.k.a. VFD), configured for speed reference by analog voltage signal, not "direct PWM control of a drive power section, performing electronic commutation".
The typical conection to PLC is shown on the attached drawing.
The resistor should be equal or just above the drive input resistance (see the drive specs) and the rectifying capacitor converts PWM to voltage.
Starting guideline is 10kOhm/1mcF.
With PWM instruction at 100Hz typically it is possible to control the inverter speed from 3Hz at 1%PWM to 120Hz at 100%PWM. The step value is different, from ~2Hz/% at the lower speeds to ~0.5Hz/% at top speed.
Anyways, control resolution over 100 steps or higher linearity is out of the budget control method scope.
Concerning emulated PWM, its count is to be done not in every PLC scan, but in high speed routine with the output immediate refresh. This may be a timer interrupt or even a regular subroutine being called many times per scan.
With 1ms period and 50 steps it results in 20Hz PWM pulsetrain (may require larger rectifying capacitor).
50 steps resolution is sufficient for many applications, such as HVAC, non-intelligent conveyor, etc.