I configure all the 16F877A pins for digital I/O. adcon1, cmcon and lvp_off.
But I still cannot use RA4 as digital. Why? I think T0CKI affect is on this pin. How to turn off T0CKI?
T0CKI pin is OPEN DRAIN type pin. you can use this pin as input without any modification, however if you want to use this pin as an output you need to connect a pull up resistor externally.
RA4 cannot pull up on the 16F877A (ie open collector like an NPN transistor) details in the datasheet.
This "feature" is disappearing in modern PICs such as the modern 16F887 or all 18F series PICs.