I have done that same thing. Language = MPASM, which might not help much. No time to find and post the entire code. Will be back about 1300 EDT (USA). But, please show your code regardless of how basic you think it is.
Are you trying to simulate it? Some chips do not simulate (MPLAB 8.92) that function with all programmers/debuggers. Be sure to check whatever device you are using.