pulseIn() function problem for measure frequency

The best way to measure a pulse width is using the 16 bit timer "input capture" feature.

Maybe you'll find the code in my FreqMeasure library helpful?

http://www.pjrc.com/teensy/td_libs_FreqMeasure.html