Francesc,

You might try this include file I was working on and haven't gotten a chance to post. It should be self explianatory (assuming you are carefully reading your PICs datasheet and the PBP manual.

CodeTimer

HTH,
Steve B