I would like to read 12.5 kHz square wave frequency from printer port output. This 12.5 kHz square wave have to be read by PIC16F877A. If 12.5 kHz is read, then PIC's output will be High. If 12.5 kHz isn't read, the output will be Low.
You need a fixed reference to compare it with. Look at using one of the timer registers to create a 'time window' during which you count pulses. 12.5KHz is a bit fast for a software loop to read so look at feeding the signal straight into TMR0 which can count at MHz rates. The idea is you generate a window period of say 10mS using TMR1 or TMR2. At the start of the window you clear TMR0 and at the end of the period you read TMR0, in 10mS the count should have reached 12.5KHz/100 = 125. You can then compare the number to see if it is valid or not.