You can not drive directly the diode of the optocoupler. You will need to add a transistor, BJT or MOS. The current on the led has to be 10mA but with the dsPIC you can drain maximum 4mA.
Try to match the resistance values on the _base_ and the collector (maybe on a bread board). On the BJT transistor do not use less than 1KOhm.
Another important point is the PWM frequency. Depending on the frequency, you have to use fast optocouplers and fast transistors.
Ciao,
Francesco.
