Have started looking at the example code provided by electrosome,
and it look like a reasonable starting point, although some mistakes stand out immediately.
It have been pointed out many times in this forum,
that there shall be No #include files Before #pargma config ... statements.
Then different PIC microcontrollers have different specifications for configuration settings,
so corrections will be needed for PIC18F25K50.
Also, that both #include <xc.h>
and the device specific hardware support header file are not needed.
//#include <xc.h> /* This shall be After #pragma config ... // configuration settings, Mysil. */
//#include <pic16f877a.h> /* Remove this, Mysil. */