Bruce thanks for your prompt reply and advice.
However, that didn't seem to fix the issue. I think I should mention this is a small part of a bigger program but this is the code am using to test this part. Am actually going to be using a PIC16F627A but am using the 16F877A to test the logic of the code. (Am using a LabX1 programmer and its the only 40pin I have). Haven't successfully been able to jumper the board to program an 18pin.
Bookmarks