A side note, a statement like

IF PORTC.4=1 THEN

actually sets PORTC.4 high.

Is this bug or feature?

I've added 1 transistor signal inverter, but no help. Also, your code does not work.

OK, I will give up with this idea.