I think the guys here dont like to write in english language. I'm not
familiar with the PIC you are using, but i try to give you some basic
1st: download an read the datasheet 16F452!!!
Do not poll a pin for a transition! It wastes time and blocks the PIC.
Use interrupts because some pins of the PIC 16F452 are able to release
an interrupt by HL or LH transitions.
Possible solution with interrupt released through a transition:
Within ISR (interrupt-service-routine) starts a counter from 0 or with a
preset to count up or start a counter from a preset down to zero.
The preset makes you able to calibrate an exact time, eg from start to
overflow, or down to zero
1s -> count 5.000.000 workcycles
connect TMR1 by Software with workcycles
connect the prescaler 1:8 by Software between workcycles and TMR1
Calculate: 5.000.0000Hz : 8 = 625000Hz
TMR1 counts max. up to 65536
1/10 sec =625000Hz:10 = 62500Hz
Preset TMR1 to 62500 then count down
Checkt TMR1 = 0 thats 1/10sec
Count this event 10 times -> 1sec and that was it!
may be it helps you a little!