Quote Originally Posted by richard View Post
from the manual :-
The resolution of PULSIN is dependent upon the oscillator frequency. If a 4MHz oscillator is used, the pulse width is returned in 10us increments. If a 20MHz oscillator is used, the pulse width will have a 2us resolution. Defining an OSC value has no effect on PULSIN. The resolution always changes with the actual oscillator speed.

more info
@16 MHz that's 2.5uS units
8.5mS =3400 ,1.5mS =600
Thank you both for your usefull comments.

@ Richard,

you are correct, I've done my self calculations and we are the same.
The problem must be somewhere else or at PIC configuration (maybe ??)

Since I don't have any other way to see what happens here, I'm simply printing on LCD the values I'm reading with the PULSIN command.
My results are correct @4 MHz but wrong at 16 MHz.

@4 MHz I get for "Start" pulse, "0" pulse and "1" pulse respectively : 898, 56, 168. These results are correct according to the NEC protocol (for ex. 898 * 10 us ~ 9 ms which is fine for the start pulse).

But @ 16 MHz I get : 3600, 229, 129.

The 3600 result is correct (~ 898 * 4),
The 229 result is also correct (~ 56 * 4),
BUT 128 is wrong and should be ~ 168 * 4 = 672 !!!

So here is my problem, I can read @16 MHz the "Start" pulse and "0" pulse, but the "1" pulse is wrong, it's way LOWER value than it should be.

What do you think about this ?