Welcome to the forum.

Not all examples work with all chips due to different ports and registers.
Which example and PIC are you using?