Hello I have a question regarding using the CCP1 module in Pic16f887.

I use a proximity switch for reading pulses from a rotating wheel. (four pulses pr rotation)

i am interested in detecting frequency in the range of 20-70Hz.


the processor using internal clock

the prescale=1

capturing on falling edge



the program seems to give a ok readings when simulating the proximity sensor with a signal generator. (50%duty).

when i connect the proximity sensor to the circuit the reading get unstable an it seems like pulses are missed.

the frequency from the sensor do not have a duty of 50%, but more like 10%high and 90%low.

is the duty cycle a problem?


Best regards
Dag