Freemodbus have an example for PIC32. But I don't know if the implementation is for both Master and Slave devices.
If you know, please let me know.
Probably I will have to use it (in Master mode) in the near future, but I will use a PIC18 or PIC24.
There is another implementation called "SimpleModbus" for Arduino. They have code for Slave mode. You may use it to adapt the code for the dsPIC:https://github.com/angeloc/simplemodbusng