What exactly does "doesn't work properly" mean?
What DOES it do and what do you expect it to do? Which PIC are you using and what does your hardware look like?

You've been around here long enough to know that a simple "doesn't work" is the wrong type of problem description. At least you did post the code so thumbs up for that ;-)

Give us something to work with. Does the PIC run at all? Does it run at the desired speed? Do you have control over the output pins? Is it a specific routine that doesn't work as expected. Basic stuff like that....

/Henrik.