It was just question of PIC16F being more sensitive (I mean needing more voltage on RA4) to work properly as my initial 5 V were a bit off at this point, but PIC18F didn't notice the difference.
Anyway, I'm into a new problem right now about adapting the code as on PIC16F as now it resets every few seconds with no apparent reason, which didn't happen on PIC18F.
It's not problem of MCLR as 4,87 V are sent there all the time, can't be that for 0,13 V is not working...
I guess it maybe has to do something with the oscillator used in PIC16F as in PIC18F I was using the INTIO67 mode which PIC16F doesn't seem to have as an internal oscillator mode, I used XT mode but the PIC didn't work at all on this mode, so tested it on RC mode where it "works" but continuoslly resets when I think it should work.
I'm uploading my schematic to check possible mistakes.
Oh well... I uploaded the one with XT instead of RC oscillator, but whatever, the only change is the one shown in extra.jpg
PD: I managed to do it also on XT according to the schematic, but still the same problem, so I guess it's not a fault from the oscillator.
PD2: There's a mistake on the schematic I'm using PIC18F877 not 887, although I don't think this would make a difference.