PDA

View Full Version : PULSIN & RCTIME resolution calculation



flotulopex
- 4th January 2010, 19:14
Hello,

I'm currently using PULSIN & RCTIME commands in a project having a 16LF88 PIC.

The PBP helpfile says 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.

Today, I found a "new" 16F1827 model that looks to be much better than the one I use now and more adapted to my usage (it is even far cheaper...). This new PIC can go up to 32MHz oscillator.

Am I correct to say the resolution of (i.e.) PULSIN & RCTIME will then be an increment of 1,25µs?

How do I really calculate this? I did 40/32...

Kamikaze47
- 5th January 2010, 09:35
1.25uS is correct. Those commands count the clock cycles to make the time measurement. The resolution is evidently 40 clock cycles (of the main osc frequency).

40 clock cycles at 4mhz is 10uS
40 clock cycles at 20mhz is 2uS
40 clock cycles at 32mhz is 1.25uS

flotulopex
- 5th January 2010, 14:34
Thank you ;)